|
1 | | -name: unit tests |
| 1 | +name: tests |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 | pull_request: |
8 | 8 |
|
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
9 | 16 | jobs: |
10 | | - build: |
| 17 | + lint: |
| 18 | + name: lint and type check |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v5 |
| 22 | + with: |
| 23 | + # setuptools-scm derives the version from tags |
| 24 | + fetch-depth: 0 |
| 25 | + persist-credentials: false |
| 26 | + - uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: '3.13' |
| 29 | + cache: pip |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + pip install --group dev . |
| 34 | + - name: Lint |
| 35 | + run: ruff check --output-format=github . |
| 36 | + - name: Check formatting |
| 37 | + run: ruff format --check . |
| 38 | + - name: Static type check |
| 39 | + run: mypy |
| 40 | + |
| 41 | + test: |
| 42 | + name: test on Python ${{ matrix.python-version }} |
11 | 43 | runs-on: ubuntu-latest |
12 | 44 | strategy: |
| 45 | + fail-fast: false |
13 | 46 | matrix: |
14 | 47 | python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] |
15 | 48 | steps: |
16 | | - - uses: actions/checkout@v2 |
17 | | - - name: Set up Python ${{ matrix.python-version }} |
18 | | - uses: actions/setup-python@v2 |
| 49 | + - uses: actions/checkout@v5 |
| 50 | + with: |
| 51 | + fetch-depth: 0 |
| 52 | + persist-credentials: false |
| 53 | + - uses: actions/setup-python@v5 |
19 | 54 | with: |
20 | 55 | python-version: ${{ matrix.python-version }} |
21 | | - - name: Install Python dependencies |
| 56 | + cache: pip |
| 57 | + - name: Install dependencies |
22 | 58 | run: | |
23 | | - python -m pip install --upgrade pip wheel |
24 | | - pip install pytest mypy |
25 | | - pip install . |
26 | | - - name: Static type check |
27 | | - run: | |
28 | | - mypy gedcom7 |
| 59 | + python -m pip install --upgrade pip |
| 60 | + pip install --group dev . |
29 | 61 | - name: Test with pytest |
30 | | - run: | |
31 | | - pytest |
| 62 | + run: pytest --cov=gedcom7 --cov-report=term-missing --cov-report=xml |
| 63 | + - name: Upload coverage report |
| 64 | + if: matrix.python-version == '3.13' |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: coverage |
| 68 | + path: coverage.xml |
| 69 | + if-no-files-found: error |
0 commit comments