|
7 | 7 | - 'stable/**' |
8 | 8 |
|
9 | 9 | pull_request: |
| 10 | + branches: [main] |
10 | 11 |
|
11 | 12 | concurrency: |
12 | | - group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
13 | 14 | cancel-in-progress: true |
14 | 15 |
|
15 | | -permissions: |
16 | | - contents: read # to fetch code (actions/checkout) |
| 16 | +permissions: {} |
| 17 | + |
| 18 | +env: |
| 19 | + FORCE_COLOR: "1" # Make tools pretty. |
| 20 | + TOX_TESTENV_PASSENV: FORCE_COLOR |
| 21 | + PIP_DISABLE_PIP_VERSION_CHECK: "1" |
| 22 | + PIP_NO_PYTHON_VERSION_WARNING: "1" |
| 23 | + PYTHON_LATEST: "3.14" |
17 | 24 |
|
18 | 25 | jobs: |
19 | | - test-sqlite: |
| 26 | + tests: |
| 27 | + name: Python ${{ matrix.python-version }} |
20 | 28 | runs-on: ubuntu-latest |
| 29 | + permissions: |
| 30 | + contents: read # to fetch code (actions/checkout) |
| 31 | + |
21 | 32 | strategy: |
22 | 33 | matrix: |
23 | | - python: ['3.10', '3.11', '3.12', '3.13', '3.14'] |
| 34 | + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] |
24 | 35 |
|
25 | 36 | steps: |
26 | | - - uses: actions/checkout@v4 |
27 | | - - name: Set up Python ${{ matrix.python }} |
28 | | - uses: actions/setup-python@v5 |
| 37 | + - name: Harden Runner |
| 38 | + uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 |
| 39 | + with: |
| 40 | + disable-sudo: true |
| 41 | + egress-policy: block |
| 42 | + allowed-endpoints: > |
| 43 | + files.pythonhosted.org:443 |
| 44 | + objects.githubusercontent.com:443 |
| 45 | + github.com:443 |
| 46 | + pypi.org:443 |
| 47 | + api.github.com:443 |
| 48 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
29 | 49 | with: |
30 | | - python-version: ${{ matrix.python }} |
31 | | - - name: Install |
| 50 | + persist-credentials: false |
| 51 | + - name: Set up Python ${{ matrix.python-version }} |
| 52 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 53 | + with: |
| 54 | + python-version: ${{ matrix.python-version }} |
| 55 | + - name: Install dependencies |
32 | 56 | run: | |
33 | 57 | python -Im pip install --upgrade pip setuptools wheel |
34 | 58 | python -Im pip install .[ci] |
35 | 59 | - name: Test |
36 | 60 | run: tox |
| 61 | + |
| 62 | + - name: β¬οΈ Upload coverage data |
| 63 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 64 | + with: |
| 65 | + name: coverage-data-${{ matrix.python-version }} |
| 66 | + path: .coverage.* |
| 67 | + include-hidden-files: true |
| 68 | + if-no-files-found: ignore |
| 69 | + retention-days: 1 |
| 70 | + |
| 71 | + coverage: |
| 72 | + name: Combine & check coverage. |
| 73 | + runs-on: ubuntu-latest |
| 74 | + needs: tests |
| 75 | + permissions: |
| 76 | + contents: read # to fetch code (actions/checkout) |
| 77 | + |
| 78 | + steps: |
| 79 | + - name: Harden Runner |
| 80 | + uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 |
| 81 | + with: |
| 82 | + disable-sudo: true |
| 83 | + egress-policy: block |
| 84 | + allowed-endpoints: > |
| 85 | + files.pythonhosted.org:443 |
| 86 | + objects.githubusercontent.com:443 |
| 87 | + github.com:443 |
| 88 | + pypi.org:443 |
| 89 | + api.github.com:443 |
| 90 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 91 | + with: |
| 92 | + persist-credentials: false |
| 93 | + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 94 | + with: |
| 95 | + # Use latest Python, so it understands all syntax. |
| 96 | + python-version: ${{env.PYTHON_LATEST}} |
| 97 | + |
| 98 | + - run: python -Im pip install --upgrade coverage |
| 99 | + |
| 100 | + - name: Download coverage data |
| 101 | + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 102 | + with: |
| 103 | + pattern: coverage-data-* |
| 104 | + merge-multiple: true |
| 105 | + |
| 106 | + - name: οΌ Combine coverage |
| 107 | + run: | |
| 108 | + python -Im coverage combine |
| 109 | + python -Im coverage html --skip-covered --skip-empty |
| 110 | + python -Im coverage report |
| 111 | + echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY |
| 112 | + python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY |
| 113 | + - name: π Upload HTML report if check failed. |
| 114 | + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 115 | + with: |
| 116 | + name: html-report |
| 117 | + path: htmlcov |
0 commit comments