test-workflow #338
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: test-workflow | |
| on: | |
| # when any branch in the repository is pushed | |
| push: | |
| # when a pull request is created | |
| pull_request: | |
| # when manually triggered to run | |
| workflow_dispatch: | |
| # when scheduled | |
| schedule: | |
| - cron: '0 0 * * 0' # weekly | |
| permissions: | |
| contents: read | |
| jobs: | |
| # run tests | |
| test: | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | |
| os: ['ubuntu-slim', 'windows-latest'] # TODO: re-add 'macos-latest' | |
| # do not cancel any jobs when a single job fails | |
| fail-fast: false | |
| name: Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Setup python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: requirements-dev.txt | |
| # ubuntu-slim does not preinstall libsodium (ubuntu-latest does); | |
| # pysodium ctypes-loads it at import, so install it on Linux runners. | |
| - name: Install libsodium | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends libsodium23 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --no-cache-dir --upgrade pip | |
| python -m pip install --no-cache-dir --requirement requirements-dev.txt | |
| - name: Run code linting checks | |
| run: make ci-lint | |
| - name: Run tests with code coverage | |
| run: make coverage | |
| - name: Upload coverage data to coveralls.io | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| flag-name: ${{ matrix.python-version }} on ${{ matrix.os }} | |
| parallel: true | |
| coveralls: | |
| name: Indicate completion to coveralls.io when all parallel jobs finished | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Finished | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| parallel-finished: true |