Skip to content

Improvements and housekeeping for 2024-W15 #594

Improvements and housekeeping for 2024-W15

Improvements and housekeeping for 2024-W15 #594

Workflow file for this run

name: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "0 5 * * *"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version:
# Force specific version of pint
# Earliest shown in pyproject.toml
- { python: "3.10", pint: "==0.11 'numpy < 1.23'" }
- { python: "3.x", pint: "==0.17" }
- { python: "3.x", pint: "==0.18" }
- { python: "3.x", pint: "==0.19.1" }
# No change, i.e. latest
- { python: "3.x", pint: "" }
fail-fast: false
name: pint${{ matrix.version.pint }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version.python }}
cache: pip
cache-dependency-path: "**/pyproject.toml"
- name: Install
run: |
python -m pip install --upgrade pip
pip install .[tests]
# Force a specific version of pint and perhaps other deps
pip install pint${{ matrix.version.pint }}
- name: Test
run: |
pytest iam_units \
-rA -vv --color=yes \
--cov=iam_units --cov-report=xml
- name: Test update code
run: |
# Analogous to "python -m iam_units.update …"
coverage run --append -m iam_units.update emissions || exit 0
- name: Upload test coverage to Codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
pre-commit:
name: Code quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Force recreation of pre-commit virtual environment for mypy
if: github.event_name == 'schedule' # Comment this line to run on a PR
run: gh cache delete $(gh cache list -L 999 | cut -f2 | grep pre-commit)
env: { GH_TOKEN: "${{ github.token }}" }
- uses: pre-commit/action@v3.0.1