Set boundary for ixmp4
#474
This file contains hidden or 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 workflows | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: "0 5 * * 0" | |
workflow_dispatch: | |
# Cancel any in-progress runs when a new run is triggered | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
BASE_ENV: envs/environment.yaml | |
jobs: | |
run-tests: | |
name: OS | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
# Run windows only on scheduled runs on Sundays, otherwise ignore | |
os: ${{ github.event.schedule == '0 5 * * 0' && fromJson('["ubuntu", "macos", "windows"]') || fromJson('["ubuntu", "macos"]') }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Setup env file path (ubuntu) | |
if: matrix.os == 'ubuntu' | |
run: | | |
echo "env_file=envs/linux-64.lock.yaml" >> $GITHUB_ENV | |
- name: Setup env file path (macos and windows) | |
if: matrix.os != 'ubuntu' | |
run: | | |
if [[ "${{ matrix.os }}" == "macos" ]]; then | |
echo "env_file=envs/osx-arm64.lock.yaml" >> $GITHUB_ENV | |
else | |
echo "env_file=envs/win-64.lock.yaml" >> $GITHUB_ENV | |
fi | |
- name: Use base env file if it was changed | |
run: | | |
git fetch origin ${{ github.event.repository.default_branch }} | |
if git diff --name-only origin/${{ github.event.repository.default_branch }} | grep '${{ env.BASE_ENV }}'; then | |
echo "Base env ${{ env.BASE_ENV }} changed. Using it instead of locked envs." | |
echo "env_file=${{ env.BASE_ENV }}" >> $GITHUB_ENV | |
else | |
echo "Base env ${{ env.BASE_ENV }} not changed. Using locked envs." | |
fi | |
- name: Setup cache keys | |
run: | | |
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
data | |
cutouts | |
resources/ariadne_database.csv | |
key: data-cutouts-${{ env.WEEK }} | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
activate-environment: pypsa-de | |
channel-priority: strict | |
- name: Cache Conda env | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CONDA }}/envs | |
key: conda-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles(format('{0}', env.env_file)) }} | |
id: cache-env | |
- name: Update environment | |
if: steps.cache-env.outputs.cache-hit != 'true' | |
run: | | |
conda env update -n pypsa-de -f ${{ env.env_file }} | |
echo "Run conda list" && conda list | |
- name: Run snakemake test workflows | |
run: | | |
make test | |
- name: Run unit tests | |
run: | | |
make unit-test | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: results-${{ matrix.os }} | |
path: | | |
logs | |
.snakemake/log | |
results | |
retention-days: 3 |