Skip to content

Commit 6b957d0

Browse files
cache based on date
1 parent c0320dc commit 6b957d0

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,19 @@ concurrency:
2020

2121
defaults:
2222
run:
23-
shell: bash -l {0}
23+
shell: micromamba-shell {0}
2424

2525
jobs:
26+
date:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
30+
id: date
31+
shell: bash
32+
outputs:
33+
date: ${{ steps.date.outputs.date }}
2634
build:
35+
needs: [ date ]
2736
name: build environment
2837
runs-on: ubuntu-latest
2938
steps:
@@ -34,18 +43,21 @@ jobs:
3443
environment-file: 00_install/environment.yml
3544
create-args: >-
3645
conda
37-
cache-environment: true
3846
cache-downloads: true
39-
init-shell: bash
47+
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
48+
cache-environment: true
49+
cache-environment-key: environment-${{ needs.date.outputs.date }}
50+
init-shell: none
51+
generate-run-shell: true
4052
- run: python ./00_install/verify_install.py
4153
- run: conda env export > roman-data-workshop-env-${{ github.sha }}.yml
4254
- uses: actions/[email protected]
4355
with:
4456
name: roman-data-workshop-env-${{ github.sha }}.yml
4557
path: roman-data-workshop-env-${{ github.sha }}.yml
4658
data:
59+
needs: [ date, build ]
4760
name: download data
48-
needs: [ build ]
4961
runs-on: ubuntu-latest
5062
steps:
5163
- uses: actions/checkout@v3
@@ -60,15 +72,18 @@ jobs:
6072
environment-file: 00_install/environment.yml
6173
create-args: >-
6274
conda
63-
cache-environment: true
6475
cache-downloads: true
65-
init-shell: bash
76+
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
77+
cache-environment: true
78+
cache-environment-key: environment-${{ needs.date.outputs.date }}
79+
init-shell: none
80+
generate-run-shell: true
6681
if: steps.data_cache.outputs.cache-hit != 'true'
6782
- run: python data/download.py
6883
if: steps.data_cache.outputs.cache-hit != 'true'
6984
test:
85+
needs: [ date, build, data ]
7086
name: run notebooks
71-
needs: [ build, data ]
7287
runs-on: ubuntu-latest
7388
env:
7489
CRDS_SERVER_URL: https://roman-crds-test.stsci.edu
@@ -83,9 +98,12 @@ jobs:
8398
environment-file: 00_install/environment.yml
8499
create-args: >-
85100
conda
86-
cache-environment: true
87101
cache-downloads: true
88-
init-shell: bash
102+
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
103+
cache-environment: true
104+
cache-environment-key: environment-${{ needs.date.outputs.date }}
105+
init-shell: none
106+
generate-run-shell: true
89107
- run: echo "name=crds_context::$(crds list --operational-context)" >> $GITHUB_OUTPUT
90108
id: crds_context
91109
- uses: actions/cache@v3

0 commit comments

Comments
 (0)