Skip to content

CI

CI #1398

Workflow file for this run

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: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
- 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-lint-${{ hashFiles('requirements.txt') }}
path: ${{ steps.pip-cache.outputs.dir }}
restore-keys: |
pip-lint-
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements.txt
- name: Run linters
run: |
make fmt
env:
CI_LINT_RUN: 1
test:
name: Test
needs: [lint]
strategy:
matrix:
pyver: ['3.9', '3.10', '3.11', '3.12', '3.13']
fail-fast: false
runs-on: ubuntu-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-${{ matrix.pyver }}-${{ hashFiles('requirements.txt') }}
path: ${{ steps.pip-cache.outputs.dir }}
restore-keys: |
pip-ci-${{ matrix.pyver }}-
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements.txt
- name: Run unittests
run: |
make test
python -m coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
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
- name: Install dependencies
run:
python -m pip install -U pip wheel twine build
- name: Make dists
run:
python -m build
- name: PyPI upload
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload dist/*