Skip to content

Commit

Permalink
cache based on date
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Feb 2, 2024
1 parent d0d9f39 commit 5521c0e
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ concurrency:

defaults:
run:
shell: bash -l {0}
shell: micromamba-shell {0}

jobs:
date:
runs-on: ubuntu-latest
steps:
- run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
id: date
shell: bash
outputs:
date: ${{ steps.date.outputs.date }}
build:
needs: [ date ]
name: build environment
runs-on: ubuntu-latest
steps:
Expand All @@ -34,18 +43,21 @@ jobs:
environment-file: 00_install/environment.yml
create-args: >-
conda
cache-environment: true
cache-downloads: true
init-shell: bash
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
- run: python ./00_install/verify_install.py
- run: conda env export > roman-data-workshop-env-${{ github.sha }}.yml
- uses: actions/[email protected]
with:
name: roman-data-workshop-env-${{ github.sha }}.yml
path: roman-data-workshop-env-${{ github.sha }}.yml
data:
needs: [ date, build ]
name: download data
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -60,15 +72,18 @@ jobs:
environment-file: 00_install/environment.yml
create-args: >-
conda
cache-environment: true
cache-downloads: true
init-shell: bash
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
if: steps.data_cache.outputs.cache-hit != 'true'
- run: python data/download.py
if: steps.data_cache.outputs.cache-hit != 'true'
test:
needs: [ date, build, data ]
name: run notebooks
needs: [ build, data ]
runs-on: ubuntu-latest
env:
CRDS_SERVER_URL: https://roman-crds-test.stsci.edu
Expand All @@ -83,9 +98,12 @@ jobs:
environment-file: 00_install/environment.yml
create-args: >-
conda
cache-environment: true
cache-downloads: true
init-shell: bash
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
- run: echo "name=crds_context::$(crds list --operational-context)" >> $GITHUB_OUTPUT
id: crds_context
- uses: actions/cache@v3
Expand Down

0 comments on commit 5521c0e

Please sign in to comment.