CI #1378
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@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Cache PyPI | |
uses: actions/cache@v3 | |
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.7", "3.8", "3.9", "3.10", "3.11-dev"] | |
os: [ubuntu, macos, windows] | |
include: | |
- pyver: pypy-3.9 | |
os: ubuntu | |
runs-on: ${{ matrix.os }}-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python ${{ matrix.pyver }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" # - name: Cache | |
- name: Cache PyPI | |
uses: actions/cache@v3 | |
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@v1 | |
with: | |
file: ./coverage.xml | |
flags: unit | |
fail_ci_if_error: false | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: test | |
# Run only on pushing a tag | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
make install | |
- name: Make dists | |
run: | |
python -m build | |
- name: Make Release | |
uses: aio-libs/[email protected] | |
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)" |