DOC add some more development commands for testing (#161) #379
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
PYTHONUNBUFFERED: "1" | |
FORCE_COLOR: "1" | |
jobs: | |
run-test-suite: | |
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# Switch back to macos-latest, once macos-14 has become macos-latest. | |
os: [ubuntu-latest, windows-latest, macos-14] | |
python-version: ['3.11'] # hatch env defines its own matrix with python versions | |
env: | |
# https://github.com/microsoft/azure-pipelines-tasks/issues/16426 | |
# https://github.com/orgs/community/discussions/26434 | |
MPLBACKEND: Agg | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Ensure latest pip | |
run: python -m pip install --upgrade pip | |
- name: Install hatch | |
run: | | |
pip install hatch | |
- if: matrix.python-version == '3.11' && runner.os == 'Linux' | |
name: Formatter & Linter | |
run: hatch run format:check | |
- if: matrix.python-version == '3.11' && runner.os == 'Linux' | |
name: Build docs | |
run: hatch run docs:build | |
- if: matrix.python-version == '3.11' && runner.os == 'Linux' | |
name: Run tests with coverage report | |
# run: hatch run cov --cov-report=xml | |
# Run coverage with hatch test matrix and cov-append. | |
run: | | |
hatch run cov-erase | |
hatch run test:cov --cov-report=xml | |
- if: matrix.python-version == '3.11' && runner.os == 'Linux' | |
name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v3 | |
- name: Run test matrix | |
run: | | |
hatch -e test run versions | |
hatch -e test run pytest |