|
1 | | -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
2 | | -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 1 | +# Runs on every push / pull-request against master. |
| 2 | +# Matrix: Python 3.10 – 3.13 | type-check (mypy) + tests (pytest) + coverage |
3 | 3 |
|
4 | 4 | name: Python Client - CI |
5 | 5 |
|
6 | 6 | on: |
7 | 7 | push: |
8 | | - branches: [ master ] |
| 8 | + branches: [master] |
9 | 9 | pull_request: |
10 | | - branches: [ master ] |
| 10 | + branches: [master] |
11 | 11 |
|
12 | 12 | jobs: |
13 | | - build: |
14 | | - |
| 13 | + test: |
| 14 | + name: "Test · Python ${{ matrix.python-version }}" |
15 | 15 | runs-on: ubuntu-latest |
| 16 | + |
16 | 17 | strategy: |
| 18 | + fail-fast: false |
17 | 19 | matrix: |
18 | | - python-version: [3.6, 3.7, 3.8] |
| 20 | + python-version: ["3.10", "3.11", "3.12", "3.13"] |
19 | 21 |
|
20 | 22 | steps: |
21 | | - - uses: actions/checkout@v2 |
22 | | - - name: Set up Python ${{ matrix.python-version }} |
23 | | - uses: actions/setup-python@v2 |
24 | | - with: |
25 | | - python-version: ${{ matrix.python-version }} |
26 | | - - name: Install dependencies |
27 | | - run: | |
28 | | - python -m pip install --upgrade pip |
29 | | - pip install flake8 pytest |
30 | | - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
31 | | - - name: Lint with flake8 |
32 | | - run: | |
33 | | - # stop the build if there are Python syntax errors or undefined names |
34 | | - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
35 | | - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
36 | | - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
37 | | - - name: Test with pytest |
38 | | - run: | |
39 | | - pytest |
40 | | - - name: Upload Codecov |
41 | | - run: | |
42 | | - bash <(curl -s https://codecov.io/bash) |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: "Set up Python ${{ matrix.python-version }}" |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: ${{ matrix.python-version }} |
| 29 | + cache: pip |
| 30 | + |
| 31 | + - name: Install dependencies |
| 32 | + run: pip install -e ".[dev]" |
| 33 | + |
| 34 | + - name: Type-check (mypy) |
| 35 | + run: mypy |
| 36 | + |
| 37 | + - name: Test with pytest |
| 38 | + run: pytest --cov-report=xml |
| 39 | + |
| 40 | + - name: Upload coverage to Codecov |
| 41 | + if: matrix.python-version == '3.13' |
| 42 | + uses: codecov/codecov-action@v4 |
| 43 | + with: |
| 44 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 45 | + files: coverage.xml |
| 46 | + fail_ci_if_error: false |
| 47 | + |
| 48 | + build: |
| 49 | + name: "Verify build" |
| 50 | + runs-on: ubuntu-latest |
| 51 | + needs: test |
| 52 | + |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + |
| 56 | + - uses: actions/setup-python@v5 |
| 57 | + with: |
| 58 | + python-version: "3.13" |
| 59 | + cache: pip |
| 60 | + |
| 61 | + - name: Install build tools |
| 62 | + run: pip install build twine |
| 63 | + |
| 64 | + - name: Build distribution |
| 65 | + run: python -m build |
| 66 | + |
| 67 | + - name: Check distribution metadata |
| 68 | + run: twine check dist/* |
0 commit comments