Nightly workflow tests #857
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: Nightly workflow tests | |
on: | |
# Uncomment these two lines for debugging, but leave them commented on 'main' | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
schedule: | |
# 05:00 UTC = 06:00 CET = 07:00 CEST | |
- cron: "0 5 * * *" | |
jobs: | |
nightly: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install poetry | |
shell: bash | |
run: | | |
pipx install poetry | |
which poetry | |
poetry --version # Check poetry installation | |
- name: Set up Python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: poetry | |
- name: Install test dependencies and package | |
shell: bash | |
run: | | |
poetry install --no-interaction --all-extras --only 'main,tests' | |
- name: Download MAGICC | |
run: | | |
mkdir -p bin/magicc/magicc-v7.5.3 | |
wget -O "bin/magicc/magicc-v7.5.3.tar.gz" "${{ secrets.MAGICC_LINK_FROM_MAGICC_DOT_ORG }}" | |
tar -xf bin/magicc/magicc-v7.5.3.tar.gz -C bin/magicc/magicc-v7.5.3 | |
MAGICC_RUN_DIR=bin/magicc/magicc-v7.5.3/run/ poetry run python scripts/generate-magicc-sr15-input-files.py | |
mkdir -p data/magicc-drawnsets | |
wget -O "data/magicc-drawnsets/magicc-ar6-0fd0f62-f023edb-drawnset.tar.gz" "${{ secrets.MAGICC_PROB_DISTRIBUTION_LINK_FROM_MAGICC_DOT_ORG }}" | |
tar -xf "data/magicc-drawnsets/magicc-ar6-0fd0f62-f023edb-drawnset.tar.gz" -C data/magicc-drawnsets | |
- name: Test with pytest | |
env: | |
MAGICC_EXECUTABLE_7: /home/runner/work/climate-assessment/climate-assessment/bin/magicc/magicc-v7.5.3/bin/magicc | |
MAGICC_WORKER_NUMBER: 4 | |
MAGICC_WORKER_ROOT_DIR: /tmp | |
run: | | |
MAGICC_PROBABILISTIC_FILE=data/magicc-drawnsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json poetry run pytest tests -m nightly -r a -vv | |
- name: Test run with .env only | |
run: | | |
echo "MAGICC_EXECUTABLE_7=${PWD}/bin/magicc/magicc-v7.5.3/bin/magicc" > .env | |
echo "MAGICC_WORKER_NUMBER=4" >> .env | |
echo "MAGICC_WORKER_ROOT_DIR=/tmp" >> .env | |
MAGICC_PROBABILISTIC_FILE=data/magicc-drawnsets/0fd0f62-derived-metrics-id-f023edb-drawnset.json poetry run pytest tests/nightly/test_workflow_nightly.py -m nightly -r a -vv |