Skip to content

Add commodity flow of capacity variables #2059

Add commodity flow of capacity variables

Add commodity flow of capacity variables #2059

Workflow file for this run

name: Test
on:
pull_request:
branches: [ main ]
# 05:00 UTC = 06:00 CET = 07:00 CEST
schedule:
- cron: "0 5 * * *"
# Cancel previous runs that have not completed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
GAMS_VERSION: 29.1.0
# See description in lint.yml
depth: 100
jobs:
pytest:
strategy:
matrix:
os:
- macos-13
- ubuntu-latest
- windows-latest
python-version:
- "3.8" # Earliest version supported by message_ix
- "3.9"
- "3.10"
- "3.11"
- "3.12" # Latest version supported by message_ix
# Below this comment are newly released or development versions of
# Python. For these versions, binary wheels are not available for some
# dependencies, e.g. llvmlite, numba, numpy, and/or pandas. Compiling
# these on the job runner requires a more elaborate build environment,
# currently out of scope for the message_ix project.
# - "3.13.0-alpha.1" # Development version
fail-fast: false
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}-py${{ matrix.python-version }}
steps:
- name: Check out message_ix
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.depth }}
- name: Fetch tags (for setuptools-scm)
run: git fetch --tags --depth=${{ env.depth }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: "**/pyproject.toml"
- uses: ts-graphviz/setup-graphviz@v2
# TEMPORARY Work around ts-graphviz/setup-graphviz#630
if: ${{ ! startswith(matrix.os, 'macos-') }}
- name: Cache GAMS installer and R packages
uses: actions/cache@v4
with:
path: |
gams
key: ${{ matrix.os }}-gams${{ env.GAMS_VERSION }}
restore-keys: |
${{ matrix.os }}-
- uses: iiasa/actions/setup-gams@main
with:
version: ${{ env.GAMS_VERSION }}
# license: ${{ secrets.GAMS_LICENSE }}
- name: Install Python package and dependencies
# By default, the below installs ixmp from the main branch. To run against
# other code, e.g. other branches for open PRs), temporarily edit as
# appropriate. DO NOT merge such changes to `main`.
run: |
pip install --upgrade "ixmp @ git+https://github.com/iiasa/ixmp.git@main"
pip install .[tests]
# TEMPORARY Work around unionai-oss/pandera#1685;
# see https://github.com/khaeru/genno/issues/140
pip install "numpy < 2"
- name: Run test suite using pytest
env:
# For test_cli.test_dl; see code in message_ix.cli.dl
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pytest message_ix \
-m "not nightly and not tutorial" \
-rA --verbose --color=yes --durations=20 \
--cov-report=xml \
--numprocesses=auto --dist=loadgroup
shell: bash
- name: Upload test coverage to Codecov.io
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
tutorials:
strategy:
matrix:
os:
- macos-13
- ubuntu-latest
- windows-latest
fail-fast: false
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} tutorials
steps:
- name: Check out message_ix
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.depth }}
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: "**/pyproject.toml"
- name: Set RETICULATE_PYTHON
# Use the environment variable set by the setup-python action, above.
run: echo "RETICULATE_PYTHON=$pythonLocation" >> "$GITHUB_ENV"
shell: bash
- uses: ts-graphviz/setup-graphviz@v2
# TEMPORARY Work around ts-graphviz/setup-graphviz#630
if: ${{ ! startswith(matrix.os, 'macos-') }}
- uses: r-lib/actions/setup-r@v2
id: setup-r
with:
windows-path-include-rtools: false
- name: Cache GAMS installer and R packages
uses: actions/cache@v4
with:
path: |
gams
${{ env.R_LIBS_USER }}
key: tutorial-${{ matrix.os }}-gams${{ env.GAMS_VERSION }}-R${{ steps.setup-r.outputs.installed-r-version }}
restore-keys: |
tutorial-${{ matrix.os }}-gams${{ env.GAMS_VERSION }}-
tutorial-${{ matrix.os }}-
- uses: iiasa/actions/setup-gams@main
with:
version: ${{ env.GAMS_VERSION }}
# license: ${{ secrets.GAMS_LICENSE }}
- name: Install Python package and dependencies
# By default, the below installs ixmp from the main branch. To run against
# other code, e.g. other branches for open PRs), temporarily edit as
# appropriate. DO NOT merge such changes to `main`.
run: |
pip install --upgrade "ixmp @ git+https://github.com/iiasa/ixmp.git@main"
pip install .[tests]
# TEMPORARY Work around unionai-oss/pandera#1685;
# see https://github.com/khaeru/genno/issues/140
pip install "numpy < 2"
- name: Install R dependencies and tutorial requirements
run: |
install.packages("remotes")
remotes::install_cran(
c("dplyr", "IRkernel", "reticulate"),
dependencies = TRUE,
# force = TRUE,
)
IRkernel::installspec()
shell: Rscript {0}
- name: Run test suite using pytest
run: |
pytest message_ix \
-m "tutorial" \
-rA --verbose --color=yes --durations=20 \
--cov-report=xml \
--numprocesses=auto --dist=loadgroup
shell: bash
- name: Upload test coverage to Codecov.io
uses: codecov/codecov-action@v4
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: # Same as the "Latest version supported by message_ix", above
python-version: "3.12"
- 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]