Skip to content

CI

CI #1546

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- '*'
pull_request:
schedule:
# run every Wednesday at 5pm UTC
- cron: '17 0 * * 3'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Code style checks
os: ubuntu-latest
python: 3.x
toxenv: codestyle
- name: Python 3.11 with remote data and coverage
os: ubuntu-latest
python: '3.11'
toxenv: py311-test-cov
toxargs: -v
toxposargs: --remote-data=any
- name: Python 3.12 (Windows)
os: windows-latest
python: '3.12'
toxenv: py312-test
- name: Python 3.11 (MacOS)
os: macos-latest
python: '3.11'
toxenv: py311-test
- name: Python 3.13 (MacOS)
os: macos-latest
python: '3.13'
toxenv: py313-test
- name: Python 3.11 with oldest supported version of key dependencies
os: ubuntu-latest
python: '3.11'
toxenv: py311-test-oldestdeps
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ matrix.python }}
- name: Install Python dependencies
run: python -m pip install --upgrade tox
- name: Run tests
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
# TODO: Do we need --gcov-glob "*cextern*" ?
- name: Upload coverage to artifacts
if: ${{ contains(matrix.toxenv,'-cov') }}
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: coverage_${{ matrix.toxenv }}.xml
path: coverage.xml
if-no-files-found: error
upload-codecov:
needs: [ tests ]
permissions:
contents: none
runs-on: ubuntu-latest
name: Upload Coverage
steps:
# work around CodeCov upload issue
# see: https://github.com/codecov/codecov-action/issues/1801
- uses: actions/checkout@v5
- name: Download coverage artifacts
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
path: coverage
pattern: coverage_*
merge-multiple: true
- name: Upload report to Codecov
if: ${{ hashFiles('coverage/') != '' }}
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage
fail_ci_if_error: true
verbose: true
allowed_failures:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: (Allowed Failure) Python 3.12 with remote data and dev version of key dependencies
os: ubuntu-latest
python: '3.12'
toxenv: py312-test-devdeps
toxposargs: --remote-data=any
# doctest failure due to different no. of significant digits on arm64 (#1146)
- name: Python 3.12 (macOS)
os: macos-latest
python: '3.12'
toxenv: py312-test
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ matrix.python }}
- name: Install Python dependencies
run: python -m pip install --upgrade tox
- name: Run tests
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}