Unit Tests #6
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: Unit Tests | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 0 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pytest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
# Python 3.8/3.9 are on macos-13 but not macos-latest (macos-14-arm64) | |
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760 | |
exclude: | |
- { python-version: "3.8", os: "macos-latest" } | |
- { python-version: "3.9", os: "macos-latest" } | |
include: | |
- { python-version: "3.8", os: "macos-13" } | |
- { python-version: "3.9", os: "macos-13" } | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "requirements/dev.txt" | |
check-latest: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 | |
pip install -r requirements/dev.txt | |
- name: Setup cache | |
id: cache-pytest | |
uses: actions/cache@v4 | |
with: | |
path: .pytest_cache | |
key: ${{ matrix.os }}-${{ matrix.python-version }}-pytest | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.8" | |
cache: "pip" | |
cache-dependency-path: "requirements/docs.txt" | |
check-latest: true | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install ".[docs]" | |
- name: Check Links | |
if: github.event_name == 'schedule' | |
run: | | |
cd docs | |
make linkcheck | |
- name: Compile to html | |
run: | | |
cd docs | |
make html |