Learning from updating MAC-SP data #517
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: | |
push: | |
branches: [main] | |
tags: ['v*'] | |
jobs: | |
mypy: | |
if: ${{ !github.event.pull_request.draft }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
with: | |
pixi-environments: "all-dev" | |
- name: mypy | |
run: | | |
MYPYPATH=stubs pixi run --frozen -e all-dev mypy src | |
docs: | |
if: ${{ !github.event.pull_request.draft }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
with: | |
pixi-environments: "docs" | |
- name: docs | |
run: | | |
pixi run --frozen -e docs typer input4mips_validation.cli utils docs --output docs/cli/index.md --name input4mips-validation | |
pixi run --frozen -e docs mkdocs build --strict | |
- name: docs-with-changelog | |
run: | | |
# Check CHANGELOG will build too | |
pixi run --frozen -e all-dev towncrier build --yes | |
pixi run --frozen -e all-dev mkdocs build --strict | |
# Just in case, undo the staged changes | |
git restore --staged . && git restore . | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-latest" ] | |
test-python-id: [ "py39", "py310", "py311" ] | |
runs-on: "${{ matrix.os }}" | |
defaults: | |
run: | |
# This might be needed for Windows | |
# and doesn't seem to affect unix-based systems so we include it. | |
# If you have better proof of whether this is needed or not, | |
# feel free to update. | |
shell: bash | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
with: | |
# When running the tests, install with all optional dependencies | |
# to get maximum test coverage. | |
# If we find that we're getting failures | |
# when people try to run without installing optional dependencies, | |
# we should add a CI step that runs the tests without optional dependencies too. | |
# We don't have that right now, because we're not sure this pain point exists. | |
# (Although pixi actually controls this, rather than the flags passed here.) | |
pixi-environments: "test-${{ matrix.test-python-id }}" | |
- name: Run tests | |
run: | | |
pixi run --frozen -e "test-${{ matrix.test-python-id }}" pytest -r a -v src tests --doctest-modules --cov=src --cov-report=term-missing --cov-report=xml | |
pixi run --frozen -e "test-${{ matrix.test-python-id }}" coverage report | |
- name: Upload coverage reports to Codecov with GitHub Action | |
uses: codecov/codecov-action@v4.2.0 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
imports-without-extras: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-latest" ] | |
python-id: [ "py39", "py310", "py311" ] | |
runs-on: "${{ matrix.os }}" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
with: | |
pixi-environments: "${{ matrix.python-id }}" | |
- name: Check importable without extras | |
run: pixi run --frozen -e "${{ matrix.python-id }}" python scripts/test-install.py | |
check-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: "3.9" | |
- name: Build package | |
run: | | |
pdm build | |
- name: Check build | |
run: | | |
tar -tvf dist/input4mips_validation-*.tar.gz --wildcards '*input4mips_validation/py.typed' | |
tar -tvf dist/input4mips_validation-*.tar.gz --wildcards 'input4mips_validation-*/LICENCE' | |
check-lock-file: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Check locked install | |
uses: prefix-dev/setup-pixi@v0.8.1 | |
with: | |
locked: true | |
# # Not sure how to do this with conda in the mix yet, | |
# # hence leave out for now | |
# check-dependency-licences: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Check out repository | |
# uses: actions/checkout@v4 | |
# - uses: ./.github/actions/setup | |
# with: | |
# pixi-environments: "all-dev" | |
# - name: Check licences of dependencies | |
# shell: bash | |
# run: | | |
# TEMP_FILE=$(mktemp) | |
# pdm export --prod > $TEMP_FILE | |
# pixi run --frozen -e all-dev liccheck -r $TEMP_FILE -R licence-check.txt | |
# cat licence-check.txt |