Test snapshots #271
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 snapshots | |
on: | |
# Please enable this if your PR targets snapshot data or functionality for that | |
# pull_request: | |
# branches: [ main ] | |
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 | |
env: | |
gams: "43.4.1" | |
python: "3.12" | |
upstream: main | |
jobs: | |
snapshots: | |
runs-on: ubuntu-latest | |
name: Test snapshots ubuntu-latest | |
steps: | |
- name: Cache test data | |
uses: actions/cache@v4 | |
with: | |
path: message-local-data | |
key: ubuntu-latest | |
- name: Check out message-ix-models | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.python }} | |
cache: pip | |
cache-dependency-path: "**/pyproject.toml" | |
- uses: iiasa/actions/setup-gams@main | |
with: | |
version: ${{ env.gams }} | |
license: ${{ secrets.GAMS_LICENSE }} | |
- uses: ts-graphviz/setup-graphviz@v2 | |
with: | |
macos-skip-brew-update: true | |
- name: Install packages and dependencies | |
# By default, install: | |
# - ixmp, message_ix: from GitHub branches/tags per env.upstream (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@${{ env.upstream }}" | |
# pip install --upgrade "message-ix @ git+https://github.com/iiasa/message_ix.git@${{ env.upstream }}" | |
pip install --upgrade "message-ix @ git+https://github.com/iiasa/message_ix.git@issue/723" | |
pip install .[docs,tests] dask[dataframe] | |
- 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 "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 |