Skip to content

Fix summary

Fix summary #159

Workflow file for this run

# GitHub Actions workflow for testing and continuous integration.
#
# This file performs testing using tox and tox.ini to define and configure the test environments.
name: CI Tests
on:
push:
branches:
- main # GitHub now defaults to 'main' as the name of the primary branch. Change this as needed.
# tags: # run CI if specific tags are pushed
pull_request:
# branches: # only build on PRs against 'main' if you need to further limit when CI is run.
# - main
jobs:
# Github Actions supports ubuntu, windows, and macos virtual environments:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
check_commit:
# Check the commit message for the presence of keywords that indicate
# that the CI tests should be skipped, in favor of running doc builds only.
# Messages like [docs only], [docs-only], or [skip-tests] will skip
# Only the CI part of the workflow, not the doc build.
# [skip ci], [ci skip] etc. are instead handled by GitHub itself and will skip
# the entire workflow.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
# Found this solution at
# https://monadical.com/posts/filters-github-actions.html#Case-2-Pull-request
- name: check if message indicates that tests should be skipped
id: check_commit
run: |
message=$(git log -1 --pretty=format:'%B')
re="\[(docs.only|skip-tests).*\]"
if [[ $message =~ $re ]]; then
echo "match=true" >> $GITHUB_OUTPUT
echo "$message -> Match is true"
else
echo "$message -> Match is false"
fi
outputs:
match: ${{ steps.check_commit.outputs.match }}
docs-tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Test building of Sphinx docs
os: ubuntu-latest
python: '3.10'
toxenv: build_docs
- name: Test links of Sphinx docs
os: ubuntu-latest
python: '3.10'
toxenv: linkcheck
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: true
- name: Check out that no sensitive environment variable is shared
run: env
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Install system dependencies
run: sudo apt-get -y install graphviz pandoc
- name: Print Python, pip, setuptools, and tox versions
run: |
python -c "import sys; print(f'Python {sys.version}')"
python -c "import pip; print(f'pip {pip.__version__}')"
python -c "import setuptools; print(f'setuptools {setuptools.__version__}')"
python -c "import tox; print(f'tox {tox.__version__}')"
- name: Run tests
run: tox -e ${{ matrix.toxenv }}
ci-tests:
needs: check_commit
if: ${{ needs.check_commit.outputs.match != 'true' }}
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
include:
- name: Code style checks with black
os: ubuntu-latest
python: '3.10'
toxenv: black
experimental: false
- name: Python 3.11 with all optional dependencies and coverage checking
os: ubuntu-latest
python: '3.11'
toxenv: py311-test-alldeps-cov
experimental: false
- name: Linux - Python 3.8 with all optional dependencies at their 3.8-compatible versions
os: ubuntu-latest
python: '3.8'
toxenv: py38-test-alldeps
experimental: true
- name: OS X - Python 3.10 with all optional dependencies
os: macos-latest
python: '3.10'
toxenv: py310-test-alldeps
experimental: true
- name: Windows - Python 3.10 with all optional dependencies
os: windows-latest
python: '3.10'
toxenv: py310-test-alldeps
experimental: false
- name: Python 3.12 with latest dev versions of key dependencies
os: ubuntu-latest
python: '3.12'
toxenv: py312-test-devdeps
experimental: true
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up python ${{ matrix.python }} on ${{ matrix.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox codecov
# - name: Test with tox
# if: "startsWith(matrix.toxenv, 'py')"
# run: tox -e ${{ matrix.toxenv }} -- -svv
- name: Test with tox
run: tox -e ${{ matrix.toxenv }}
# This is an example of how to upload coverage to codecov
- name: Upload coverage to codecov
if: "endsWith(matrix.toxenv, '-cov')"
uses: codecov/[email protected]
with:
file: ./coverage.xml