Merge pull request #126 from scottclowe/ci_upgrade-actions #680
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
# Regular tests | |
# | |
# Use this to ensure your tests are passing on every push and PR (skipped on | |
# pushes which only affect documentation). | |
# There is also a cron job set to run weekly on the default branch, to check | |
# against dependency chain rot. | |
# | |
# You should make sure you run jobs on at least the *oldest* and the *newest* | |
# versions of python that your codebase is intended to support. | |
name: tests | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 0 * * 1" | |
branches: [ $default-branch ] | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.8", "3.12"] | |
include: | |
- os: windows-latest | |
python-version: "3.12" | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
- name: System information | |
run: python .github/workflows/system_info.py | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel | |
python -m pip install flake8 | |
python -m pip install --editable .[test] | |
- name: Sanity check with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings | |
python -m flake8 . --count --exit-zero --statistics | |
- name: Debug environment | |
run: python -m pip freeze | |
- name: Test with pytest | |
run: | | |
python -m pytest --cov=package_name --cov-report term --cov-report xml --cov-config .coveragerc --junitxml=testresults.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: unittests | |
env_vars: OS,PYTHON | |
name: Python ${{ matrix.python-version }} on ${{ runner.os }} | |
- name: Build HTML docs | |
run: | | |
python -m pip install --editable .[docs] | |
cd docs | |
make html | |
cd .. |