Confirm support for Python 3.13 and drop 3.8 #2489
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: Test | ||
on: | ||
pull_request: | ||
branches: [ main , "migrate**"] | ||
schedule: | ||
# 05:00 UTC = 06:00 CET = 07:00 CEST | ||
- cron: "0 5 * * *" | ||
# Cancel previous runs that have not completed | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
warm-lfs-cache: | ||
strategy: | ||
matrix: | ||
os: [ macos-13, macos-latest, ubuntu-latest, windows-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: nschloe/action-cached-lfs-checkout@v1 | ||
pytest: | ||
needs: warm-lfs-cache | ||
strategy: | ||
matrix: | ||
os: | ||
- macos-13 | ||
- macos-latest | ||
- ubuntu-latest | ||
- windows-latest | ||
upstream: | ||
# In each group: | ||
# - Versions of ixmp and message_ix to test. | ||
# - Latest supported Python version for those or other dependencies. | ||
# - Extra dependencies, in particular fixed/maximum versions to resolve conficts. | ||
# - dask[dataframe] >= 2024.3.0 requires dask-expr and in turn pandas >= 2.0. | ||
# https://github.com/iiasa/message-ix-models/pull/156#issuecomment-2020152360 | ||
# - genno: upstream versions < 3.8.0 import genno.computations, removed in 1.25.0. | ||
# https://github.com/iiasa/message-ix-models/pull/156 | ||
# - pytest: upstream versions < 3.9.0 use a hook argument removed in pytest 8.1.0. | ||
# https://github.com/iiasa/message-ix-models/pull/155 | ||
# | ||
# Minimum version given in pyproject.toml + earlier version of Python | ||
- version: v3.4.0 # 2022-01-27 | ||
python-version: "3.11" | ||
extra-deps: '"dask < 2024.3.0" "genno < 1.25" "pandas < 2.0" "pytest == 8.0.0"' | ||
dask-dataframe: false | ||
- version: v3.5.0 # 2022-05-06 | ||
python-version: "3.11" | ||
extra-deps: '"dask < 2024.3.0" "genno < 1.25" "pandas < 2.0" "pytest == 8.0.0"' | ||
dask-dataframe: false | ||
- version: v3.6.0 # 2022-08-18 | ||
python-version: "3.11" | ||
extra-deps: '"dask < 2024.3.0" "genno < 1.25" "pandas < 2.0" "pytest == 8.0.0"' | ||
dask-dataframe: false | ||
- version: v3.7.0 # 2023-05-17 | ||
python-version: "3.11" | ||
extra-deps: ' "genno < 1.25" "pytest == 8.0.0"' | ||
dask-dataframe: true | ||
- version: v3.8.0 # 2024-01-12 | ||
python-version: "3.12" | ||
extra-deps: ' "pytest == 8.0.0"' | ||
dask-dataframe: true | ||
# Latest released version + latest released Python | ||
- version: v3.9.0 # 2024-06-04 | ||
python-version: "3.13" | ||
extra-deps: '' | ||
dask-dataframe: true | ||
# Development version + latest released Python | ||
- version: main | ||
python-version: "3.13" | ||
extra-deps: '' | ||
dask-dataframe: true | ||
exclude: | ||
# Specific version combinations that are invalid / not to be used | ||
# These versions of ixmp are not able locate the arm64 GAMS API binaries | ||
- { os: macos-latest, upstream.version: v3.4.0 } | ||
Check failure on line 81 in .github/workflows/pytest.yaml GitHub Actions / TestInvalid workflow file
|
||
- { os: macos-latest, upstream.version: v3.5.0 } | ||
- { os: macos-latest, upstream.version: v3.6.0 } | ||
- { os: macos-latest, upstream.version: v3.7.0 } | ||
- { os: macos-latest, upstream.version: v3.8.0 } | ||
- { os: macos-latest, upstream.version: v3.9.0 } | ||
# Redundant with macos-latest | ||
- { os: macos-13, upstream.version: main } | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
name: ${{ matrix.os }}-py${{ matrix.upstream.python-version }}-upstream-${{ matrix.upstream.version }} | ||
steps: | ||
- name: Cache test data | ||
uses: actions/cache@v4 | ||
with: | ||
path: message-local-data | ||
key: ${{ matrix.os }} | ||
- name: Check out message-ix-models | ||
uses: nschloe/action-cached-lfs-checkout@v1 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.upstream.python-version }} | ||
cache: pip | ||
cache-dependency-path: "**/pyproject.toml" | ||
- uses: iiasa/actions/setup-gams@main | ||
with: | ||
version: 43.4.1 | ||
license: ${{ secrets.GAMS_LICENSE }} | ||
- uses: ts-graphviz/setup-graphviz@v2 | ||
# TEMPORARY Work around ts-graphviz/setup-graphviz#630 | ||
if: ${{ ! startswith(matrix.os, 'macos-') }} | ||
- name: Install packages and dependencies | ||
# By default, install: | ||
# - ixmp, message_ix: from GitHub branches/tags per matrix.upstream-version (above) | ||
# - other dependencies including genno: from PyPI. | ||
# | ||
# To test against unreleased code (on `main`, or other branches | ||
# for open PRs), temporarily uncomment, add, or edit lines below | ||
# as needed. DO NOT merge such changes to `main`. | ||
run: | | ||
# pip install --upgrade "genno @ git+https://github.com/khaeru/genno.git@main" | ||
pip install --upgrade "ixmp @ git+https://github.com/iiasa/ixmp.git@${{ matrix.upstream.version }}" | ||
pip install --upgrade "message-ix @ git+https://github.com/iiasa/message_ix.git@${{ matrix.upstream.version }}" | ||
pip install .[docs,tests] ${{ matrix.upstream.extra-deps }} | ||
# TEMPORARY With Python 3.13 pyam-iamc resolves to 1.3.1, which in turn | ||
# limits pint < 0.17. Override. | ||
pip install --upgrade pint | ||
- name: Configure local data path | ||
run: | | ||
mkdir -p message-local-data/cache | ||
mix-models config set "message local data" "$(realpath message-local-data)" | ||
mix-models config show | ||
shell: bash | ||
- name: Run test suite using pytest | ||
run: | | ||
pytest message_ix_models \ | ||
-m "not (ece_db or snapshot)" \ | ||
-rA --verbose --color=yes --durations=20 \ | ||
--cov-report=term-missing --cov-report=xml \ | ||
--numprocesses=auto \ | ||
--local-cache --jvmargs="-Xmx6G" | ||
shell: bash | ||
- name: Upload test coverage to Codecov.io | ||
uses: codecov/codecov-action@v5 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} # required | ||
pre-commit: | ||
name: Code quality | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: { python-version: "3.13" } | ||
- 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 list -L 999 | cut -f2 | grep pre-commit | xargs -I{} gh cache delete "{}" || true | ||
env: { GH_TOKEN: "${{ github.token }}" } | ||
- uses: pre-commit/[email protected] |