CI #1001
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 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/[email protected] | |
- name: Cache pre-commit | |
uses: actions/[email protected] | |
with: | |
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
path: ~/.cache/pre-commit | |
restore-keys: | | |
pre-commit- | |
- name: Cache pip | |
uses: actions/[email protected] | |
with: | |
key: pip-lint-${{ hashFiles('setup.cfg', 'requirements.txt') }} | |
path: ~/.cache/pip | |
restore-keys: | | |
pip-lint- | |
- name: Install dependencies | |
uses: py-actions/py-dependency-install@v4 | |
with: | |
path: requirements.txt | |
- name: Run linter | |
run: | | |
make pre-commit | |
mypy: | |
name: Mypy | |
strategy: | |
matrix: | |
pyver: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
fail-fast: false | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.pyver }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Get pip cache dir | |
id: pip-cache | |
shell: bash | |
run: | | |
echo "dir=$(pip cache dir)" >> "$GITHUB_OUTPUT" # - name: Cache | |
- name: Cache PyPI | |
uses: actions/[email protected] | |
with: | |
key: pip-ci-${{ runner.os }}-${{ matrix.pyver }}-${{ hashFiles('setup.cfg', 'requirements.txt') }} | |
path: ${{ steps.pip-cache.outputs.dir }} | |
restore-keys: | | |
pip-ci-${{ runner.os }}-${{ matrix.pyver }}- | |
- name: Install dependencies | |
uses: py-actions/py-dependency-install@v4 | |
with: | |
path: requirements.txt | |
- name: Run mypy | |
run: | | |
make mypy | |
test: | |
name: Test | |
strategy: | |
matrix: | |
pyver: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
os: [ubuntu, windows] | |
fail-fast: false | |
runs-on: ${{ matrix.os }}-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.pyver }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.pyver }} | |
- name: Get pip cache dir | |
id: pip-cache | |
shell: bash | |
run: | | |
echo "dir=$(pip cache dir)" >> "$GITHUB_OUTPUT" # - name: Cache | |
- name: Cache PyPI | |
uses: actions/[email protected] | |
with: | |
key: pip-ci-${{ runner.os }}-${{ matrix.pyver }}-${{ hashFiles('setup.cfg', 'requirements.txt') }} | |
path: ${{ steps.pip-cache.outputs.dir }} | |
restore-keys: | | |
pip-ci-${{ runner.os }}-${{ matrix.pyver }}- | |
- name: Install dependencies | |
uses: py-actions/py-dependency-install@v4 | |
with: | |
path: requirements.txt | |
- name: Run unittests | |
run: | | |
make cov | |
- name: Generate coverage XML | |
run: | | |
coverage xml | |
- name: Upload coverage artifact | |
uses: aio-libs/[email protected] | |
with: | |
key: ${{ matrix.pyver }}-${{ matrix.os }} | |
check: | |
name: Test matrix status | |
needs: [lint, test, mypy] | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
- name: Upload coverage | |
uses: aio-libs/[email protected] | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: release | |
needs: check | |
# 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/[email protected] | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip build | |
- name: Make dists | |
run: | | |
python -m build | |
- name: Release | |
uses: aio-libs/[email protected] | |
with: | |
changes_file: CHANGES.rst | |
name: aioloop-proxy | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
pypi_token: ${{ secrets.PYPI_API_TOKEN }} | |
check_ref: ${{ github.ref }} | |
fix_issue_regex: ":issue:`(\\d+)`" | |
fix_issue_repl: "(#\\1)" |