Pin GitHub Actions (#19) #37
This file contains hidden or 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: polymath CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'stable/**' | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| env: | |
| FORCE_COLOR: "1" # Make tools pretty. | |
| TOX_TESTENV_PASSENV: FORCE_COLOR | |
| PIP_DISABLE_PIP_VERSION_CHECK: "1" | |
| PIP_NO_PYTHON_VERSION_WARNING: "1" | |
| PYTHON_LATEST: "3.14" | |
| jobs: | |
| tests: | |
| name: Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| disable-sudo: true | |
| egress-policy: block | |
| allowed-endpoints: > | |
| files.pythonhosted.org:443 | |
| objects.githubusercontent.com:443 | |
| github.com:443 | |
| pypi.org:443 | |
| api.github.com:443 | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -Im pip install --upgrade pip setuptools wheel | |
| python -Im pip install .[ci] | |
| - name: Test | |
| run: tox | |
| - name: ⬆️ Upload coverage data | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: coverage-data-${{ matrix.python-version }} | |
| path: .coverage.* | |
| include-hidden-files: true | |
| if-no-files-found: ignore | |
| retention-days: 1 | |
| coverage: | |
| name: Combine & check coverage. | |
| runs-on: ubuntu-latest | |
| needs: tests | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| disable-sudo: true | |
| egress-policy: block | |
| allowed-endpoints: > | |
| files.pythonhosted.org:443 | |
| objects.githubusercontent.com:443 | |
| github.com:443 | |
| pypi.org:443 | |
| api.github.com:443 | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| # Use latest Python, so it understands all syntax. | |
| python-version: ${{env.PYTHON_LATEST}} | |
| - run: python -Im pip install --upgrade coverage | |
| - name: Download coverage data | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| pattern: coverage-data-* | |
| merge-multiple: true | |
| - name: + Combine coverage | |
| run: | | |
| python -Im coverage combine | |
| python -Im coverage html --skip-covered --skip-empty | |
| python -Im coverage report | |
| echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY | |
| python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY | |
| - name: 📈 Upload HTML report if check failed. | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: html-report | |
| path: htmlcov |