Merge pull request #1176 from aio-libs/dependabot/github_actions/acti… #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI/CD | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- >- | |
[0-9]+.[0-9]+.[0-9]+ | |
pull_request: | |
branches: | |
- master | |
- >- | |
[0-9].[0-9]+.[0-9]+ | |
env: | |
FORCE_COLOR: 1 | |
jobs: | |
build: | |
name: Build distribution 📦 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install build dependencies | |
run: python -m pip install build twine | |
- name: Build distribution 📦 | |
run: python -m build | |
- name: Check distribution 📦 | |
run: python -m twine check --strict dist/* | |
- name: Upload distribution 📦 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
test: | |
name: Test Python ${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- 3.8 | |
- 3.9 | |
- >- | |
3.10 | |
- 3.11 | |
- 3.12 | |
- 3.13 | |
include: | |
- aiohttp-version: ==3.9.2 | |
- aiohttp-version: <4.0.0 | |
python-version: 3.11 | |
fail-fast: false | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Python ${{ matrix.pyver }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Lock and sync dependencies | |
env: | |
AIOHTTP_VERSION: ${{ matrix.aiohttp-version }} | |
run: | | |
python -V -V | |
python -m pip install -U pip codecov pip-tools | |
time pip-compile requirements-dev.in | |
time pip-sync requirements-dev.txt | |
- name: Run pre-commit hooks | |
if: matrix.python-version == '3.11' | |
run: | | |
make pre-commit | |
- name: Run unittests | |
env: | |
COLOR: 'yes' | |
run: | | |
make mototest | |
- name: Upload coverage to Codecov | |
if: matrix.python-version == '3.11' | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
files: ./coverage.xml | |
flags: unittests # optional | |
name: codecov-umbrella # optional | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |
pypi-publish: | |
name: Publish Python 🐍 distribution 📦 to PyPI | |
if: github.ref_type == 'tag' # only publish on tag pushes | |
needs: | |
- build | |
- test | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/project/aiobotocore/${{ github.ref_name }} | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- name: Download distribution 📦 | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |