Unit Tests #9
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"] | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
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@v3 | |
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@v4 | |
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 |