CI #2051
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 | |
on: | |
push: | |
branches: | |
- master | |
- '[0-9].[0-9]+' # matches to backport branches, e.g. 3.6 | |
tags: [ 'v*' ] | |
pull_request: | |
branches: | |
- master | |
- '[0-9].[0-9]+' | |
schedule: | |
- cron: '0 6 * * *' # Daily 6AM UTC build | |
jobs: | |
lint: | |
name: Linter | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 # pre-commit env update can take time | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Cache PyPI | |
uses: actions/cache@v4 | |
with: | |
key: pip-lint-${{ hashFiles('requirements.txt') }} | |
path: ~/.cache/pip | |
restore-keys: | | |
pip-lint- | |
- name: Install dependencies | |
run: | | |
make install | |
- name: Run linter | |
run: | | |
make lint | |
- name: Run twine checker | |
run: | | |
make check | |
test: | |
name: Test | |
needs: lint | |
strategy: | |
matrix: | |
pyver: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
os: [ubuntu, macos, windows] | |
include: | |
- pyver: pypy-3.10 | |
os: ubuntu | |
runs-on: ${{ matrix.os }}-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.pyver }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT # - name: Cache | |
shell: bash | |
- name: Cache PyPI | |
uses: actions/cache@v4 | |
with: | |
key: pip-ci-${{ runner.os }}-${{ matrix.pyver }}-${{ hashFiles('requirements/*.txt') }} | |
path: ${{ steps.pip-cache.outputs.dir }} | |
restore-keys: | | |
pip-ci-${{ runner.os }}-${{ matrix.pyver }}- | |
- name: Install dependencies | |
run: | | |
make install | |
- name: Run unittests | |
env: | |
COLOR: 'yes' | |
run: | | |
python -m pytest tests | |
python -m coverage xml | |
- name: Upload coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
flags: unit | |
fail_ci_if_error: false | |
test-summary: | |
if: always() | |
needs: [lint, test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Test matrix status | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: test-summary | |
# Run only on pushing a tag | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
make install | |
- name: Make dists | |
run: | |
python -m build | |
- name: Make Release | |
uses: aio-libs/create-release@v1.6.6 | |
with: | |
changes_file: CHANGES.rst | |
name: async-timeout | |
version_file: async_timeout/__init__.py | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
pypi_token: ${{ secrets.PYPI_TOKEN }} | |
fix_issue_regex: '\(`#(\\d+) <https://github.com/aio-libs/async-timeout/issues/\\1>`_\)' | |
fix_issue_repl: "(#\\1)" |