Skip to content

Commit

Permalink
test: test windows only scheduled
Browse files Browse the repository at this point in the history
  • Loading branch information
lkstrp committed Nov 18, 2024
1 parent c45591f commit 55189ae
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ on:
branches:
- master
schedule:
- cron: "0 5 * * *"
- cron: "0 5 * * 1-6"
- cron: "0 5 * * 0"

# Cancel any in-progress runs when a new run is triggered
concurrency:
Expand All @@ -27,33 +28,36 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
include:
- os: ubuntu
env_file: envs/linux-pinned.yaml
- os: macos
env_file: envs/macos-pinned.yaml
- os: windows
env_file: envs/windows-pinned.yaml
# 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:
- name: Setup env file path (ubuntu)
if: matrix.os == 'ubuntu'
run: |
echo "env_file=envs/linux-pinned.yaml" >> $GITHUB_ENV
- name: Setup env file path (macos and windows)
if: matrix.os != 'ubuntu'
run: |
echo "env_file=envs/${{ matrix.os }}-pinned.yaml" >> $GITHUB_ENV
- uses: actions/checkout@v4

- name: Setup secrets & cache dates
- name: Setup cache keys
run: |
echo -ne "url: ${CDSAPI_URL}\nkey: ${CDSAPI_TOKEN}\n" > ~/.cdsapirc
echo "week=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
- uses: actions/cache@v4
with:
path: |
data
cutouts
key: data-cutouts-${{ env.week }}
key: data-cutouts-${{ env.WEEK }}

- uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -63,12 +67,12 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles(format('{0}', matrix.env_file)) }}
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-eur -f ${{ matrix.env_file }}
run: conda env update -n pypsa-eur -f ${{ env.env_file }}

- name: Run snakemake test workflows
run: |
Expand Down Expand Up @@ -114,20 +118,18 @@ jobs:
echo "pinned=false" >> $GITHUB_ENV
fi
- name: Setup secrets & cache dates
- name: Setup cache keys
if: env.pinned == 'false'
run: |
echo -ne "url: ${CDSAPI_URL}\nkey: ${CDSAPI_TOKEN}\n" > ~/.cdsapirc
echo "week=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_ENV # env
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
- uses: actions/cache@v4
if: env.pinned == 'false'
with:
path: |
data
cutouts
key: data-cutouts-${{ env.week }}
key: data-cutouts-${{ env.WEEK }}

- uses: conda-incubator/setup-miniconda@v3
if: env.pinned == 'false'
Expand Down Expand Up @@ -157,7 +159,7 @@ jobs:
make test
- name: Upload artifacts
if: env.pinned == 'false'
if: env.pinned == 'false' && always()
uses: actions/upload-artifact@v4
with:
name: results-inhouse-${{ matrix.inhouse }}
Expand Down

0 comments on commit 55189ae

Please sign in to comment.