Simplify CI. #114
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: build | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
flag: [""] | |
include: | |
- python-version: "3.7" | |
flag: "oldest" | |
- python-version: "3.12" | |
flag: "pre" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
run: | | |
case '${{ matrix.flag }}' in | |
oldest) | |
NUMPY_VERSION='==1.14.*' | |
MATPLOTLIB_VERSION='==3.1.0' | |
;; | |
pre) | |
PIP_INSTALL_PRE=true | |
;; | |
esac && | |
pip install --upgrade pip setuptools wheel pytest pytest-cov coverage[toml] && | |
# Force install of numpy before matplotlib. | |
pip install --upgrade --upgrade-strategy=only-if-needed --only-binary=:all: numpy"$NUMPY_VERSION" && | |
pip install --upgrade --upgrade-strategy=only-if-needed matplotlib"$MATPLOTLIB_VERSION" && | |
pip install . && | |
pip list | |
- name: Test | |
run: | | |
python -mpytest --cov --cov-branch | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ matrix.python-version }}-${{ matrix.flag }} | |
include-hidden-files: true | |
path: .coverage | |
coverage: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Run | |
run: | | |
shopt -s globstar && | |
GH_TOKEN=${{ secrets.GITHUB_TOKEN }} \ | |
gh run download ${{ github.run-id }} -p 'coverage-*' && | |
python -mpip install --upgrade coverage && | |
python -mcoverage combine coverage-*/.coverage && # Unifies paths across envs. | |
python -mcoverage annotate && | |
grep -HnTC2 '^!' **/*,cover | sed s/,cover//: && | |
python -mcoverage report --show-missing |