Merge pull request #338 from PyPSA/cache-bundle

cache data bundle
This commit is contained in:
Fabian Neumann 2022-03-24 14:32:00 +01:00 committed by GitHub
commit 2cf8b53069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,13 +13,12 @@ on:
branches: branches:
- master - master
pull_request: pull_request:
branches:
- master
schedule: schedule:
- 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
DATA_CACHE_NUMBER: 1
jobs: jobs:
build: build:
@ -67,15 +66,25 @@ jobs:
activate-environment: pypsa-eur activate-environment: pypsa-eur
use-mamba: true use-mamba: true
- name: Set cache date - name: Set cache dates
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV run: |
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV
- name: Cache data and cutouts folders
uses: actions/cache@v3
with:
path: |
data
cutouts
key: data-cutouts-${{ env.WEEK }}-${{ env.DATA_CACHE_NUMBER }}
- name: Create environment cache - name: Create environment cache
uses: actions/cache@v2 uses: actions/cache@v2
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