Re-write #3
Workflow file for this run
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: | |
python-version: "3.11" | |
pdm-dependency-install-flags: "-G dev" | |
- name: mypy | |
run: MYPYPATH=stubs pdm run 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: | |
python-version: "3.11" | |
pdm-dependency-install-flags: "-G docs -G dev" | |
- name: docs | |
run: | | |
pdm run typer openscm_zenodo.cli utils docs --output docs/cli/index.md --name openscm-zenodo | |
pdm run mkdocs build --strict | |
# Check CHANGELOG will build too | |
pdm run towncrier build --yes | |
pdm run mkdocs build --strict | |
# Just in case, undo the staged changes | |
git restore --staged . && git restore . | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-latest" ] | |
python-version: [ "3.9", "3.10", "3.11" ] | |
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: | |
python-version: ${{ matrix.python-version }} | |
pdm-dependency-install-flags: "-G tests" | |
# TODO: sort out zenodo token | |
- name: Run tests | |
run: | | |
pdm run pytest -r a -v src tests --doctest-modules --cov=src --cov-report=term-missing --cov-report=xml | |
pdm run 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-version: [ "3.9", "3.10", "3.11" ] | |
runs-on: "${{ matrix.os }}" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
with: | |
python-version: ${{ matrix.python-version }} | |
pdm-dependency-install-flags: "--prod" | |
- name: Check importable without extras | |
run: pdm run 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" | |
pdm-dependency-install-flags: "not-used" | |
run-pdm-install: false | |
- name: Build package | |
run: | | |
pdm build | |
- name: Check build | |
run: | | |
tar -tvf dist/openscm_zenodo-*.tar.gz --wildcards '*openscm_zenodo/py.typed' | |
tar -tvf dist/openscm_zenodo-*.tar.gz --wildcards 'openscm_zenodo-*/LICENCE' | |
check-dependency-licences: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
with: | |
python-version: "3.9" | |
pdm-dependency-install-flags: "-G dev" | |
- name: Check licences of dependencies | |
shell: bash | |
run: | | |
TEMP_FILE=$(mktemp) | |
pdm export --without=tests --without=docs --without=dev > $TEMP_FILE | |
pdm run liccheck -r $TEMP_FILE -R licence-check.txt | |
cat licence-check.txt |