cache data bundle

This commit is contained in:
Fabian Neumann 2022-03-24 12:36:54 +01:00
parent 31f9864daf
commit ad4bd56ab2

View File

@ -19,7 +19,8 @@ on:
- cron: "0 5 * * TUE" - cron: "0 5 * * TUE"
env: env:
CACHE_NUMBER: 1 # Change this value to manually reset the environment cache CONDA_CACHE_NUMBER: 1 # Change this value to manually reset the environment cache
BUNDLE_CACHE_NUMBER: 1
jobs: jobs:
build: build:
@ -66,6 +67,12 @@ jobs:
miniforge-version: latest miniforge-version: latest
activate-environment: pypsa-eur activate-environment: pypsa-eur
use-mamba: true use-mamba: true
- name: Cache data bundle
uses: actions/cache@v3
with:
path: data/bundle
key: data-bundle-${{ env.BUNDLE_CACHE_NUMBER }}
- name: Set cache date - name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
@ -75,7 +82,7 @@ jobs:
id: cache id: cache
with: with:
path: ${{ matrix.prefix }} path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('envs/environment.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} key: ${{ matrix.label }}-conda-${{ hashFiles('envs/environment.yaml') }}-${{ env.DATE }}-${{ env.CONDA_CACHE_NUMBER }}
- name: Update environment due to outdated or unavailable cache - name: Update environment due to outdated or unavailable cache
run: mamba env update -n pypsa-eur -f envs/environment.yaml run: mamba env update -n pypsa-eur -f envs/environment.yaml