Skip to content

Better test improvement #536

Better test improvement

Better test improvement #536

Workflow file for this run

name: CI
on:
push:
pull_request:
schedule:
# run every Wednesday at 5pm UTC
- cron: '17 0 * * 3'
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.10 (MacOS)
os: macos-latest
python: '3.10'
toxenv: py310-test
- name: Python 3.10 with oldest supported version of key dependencies
os: ubuntu-latest
python: '3.10'
toxenv: py310-test-oldestdeps
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.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@604373da6381bf24206979c74d06a550515601b9 # v4.4.1
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:
- name: Download coverage artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: coverage
pattern: coverage_*
merge-multiple: true
- name: Upload report to Codecov
if: ${{ hashFiles('coverage/') != '' }}
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.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 }}