CI #1130
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: CI | |
on: | |
pull_request: | |
paths-ignore: | |
- '**/*.md' | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: 0 3 * * * | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
include: | |
# only test oldest and most recent Python on other platforms | |
- os: macos-latest | |
python-version: '3.8' | |
- os: macos-latest | |
python-version: '3.11' | |
- os: windows-latest | |
python-version: '3.8' | |
- os: windows-latest | |
python-version: '3.11' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build library | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
python -m pip install --requirement requirements/tests.txt | |
- name: Run test suite | |
run: | | |
python -m pip freeze | |
pytest --color yes | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: test_results | |
path: test_results/ | |
minimal-dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Build library | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tomli tomli_w | |
python scripts/hardpin_minimal_dependencies.py | |
python -m pip install . | |
python -m pip install --requirement requirements/tests.txt | |
- name: Run test suite | |
run: | | |
python -m pip freeze | |
pytest --color yes | |
image-tests: | |
name: Image tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Build library | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
python -m pip install --requirement requirements/tests.txt | |
- name: Run Image Tests | |
run: | | |
pytest --color=yes --mpl -m mpl_image_compare \ | |
--mpl-generate-summary=html \ | |
--mpl-results-path=pytest_mpl_results \ | |
--mpl-baseline-path=tests/baseline | |
- name: Generate new image baseline | |
if: failure() | |
run: | | |
pytest --color=yes --mpl -m mpl_image_compare \ | |
--mpl-generate-path=pytest_mpl_new_baseline \ | |
--last-failed | |
# always attempt to upload artifacts, even | |
# (and especially) in case of failure. | |
- name: Upload pytest-mpl report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cmyt_pytest_mpl_results | |
path: pytest_mpl_results/* | |
- name: Upload pytest-mpl baseline | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cmyt_pytest_mpl_new_baseline | |
path: pytest_mpl_new_baseline/* | |
if-no-files-found: ignore | |
type-check: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
# oldest and newest supported versions | |
- '3.8' | |
- '3.11' | |
concurrency: | |
# auto-cancel any in-progress job *on the same branch* | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }}-typecheck | |
cancel-in-progress: true | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
python -m pip install --requirement requirements/typecheck.txt | |
- name: Run mypy | |
run: mypy cmyt |