test-workflow #222
This file contains 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 | |
jobs: | |
# run tests | |
test: | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
os: ['ubuntu-latest', 'macos-latest', 'windows-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@v4 | |
with: | |
submodules: true | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: requirements-dev.txt | |
- name: Install dependencies | |
run: | | |
pip install --no-cache-dir --upgrade pip | |
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 |