Migrate CI from Travis to GitHub Actions #4
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: tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # Third-party actions are pinned by full commit SHA (with a `# vN.M.P` | |
| # comment noting the tag at pin time) so that supply-chain attacks on the | |
| # action repos can't silently introduce new behavior. Dependabot/renovate | |
| # can bump these the same way it bumps any other dependency. | |
| jobs: | |
| style: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: '3.12' | |
| - name: Install style tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black | |
| - name: black | |
| run: black --diff --check . | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| # Tests run `git blame` against historical SHAs in the repo's own | |
| # history; the default shallow clone (fetch-depth: 1) breaks them. | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt coverage | |
| pip install -e . | |
| - name: Run tests | |
| run: PYTHONPATH=. coverage run $(which pytest) | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 | |
| with: | |
| flags: py${{ matrix.python-version }} | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| env: | |
| OS: ${{ runner.os }} | |
| PYTHON: ${{ matrix.python-version }} |