Skip to content

Commit

Permalink
don't assume cache path
Browse files Browse the repository at this point in the history
fix context availability
  • Loading branch information
zacharyburnett committed Nov 20, 2024
1 parent 199ce09 commit e48dfaa
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
- eigen
- fftw
setenv: |
WEBBPSF_PATH: ${{ needs.latest_data_cache.outputs.cache_path }}webbpsf-data/
GALSIM_CAT_PATH: ${{ needs.latest_data_cache.outputs.cache_path }}galsim_data/real_galaxy_catalog_23.5_example.fits
WEBBPSF_PATH: ${{ needs.latest_data_cache.outputs.cache_path }}/data/webbpsf-data/
GALSIM_CAT_PATH: ${{ needs.latest_data_cache.outputs.cache_path }}/data/galsim_data/real_galaxy_catalog_23.5_example.fits
FFTW_DIR: /opt/homebrew/opt/fftw/lib/
cache-path: ${{ needs.latest_data_cache.outputs.cache_path }}
cache-path: ${{ needs.latest_data_cache.outputs.cache_path }}/data
cache-key: ${{ needs.latest_data_cache.outputs.cache_key }}
envs: |
- linux: py310-oldestdeps-cov-xdist
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
- eigen
- fftw
setenv: |
WEBBPSF_PATH: ${{ needs.latest_data_cache.outputs.cache_path }}webbpsf-data/
GALSIM_CAT_PATH: ${{ needs.latest_data_cache.outputs.cache_path }}galsim_data/real_galaxy_catalog_23.5_example.fits
WEBBPSF_PATH: ${{ needs.latest_data_cache.outputs.cache_path }}/webbpsf-data/
GALSIM_CAT_PATH: ${{ needs.latest_data_cache.outputs.cache_path }}/galsim_data/real_galaxy_catalog_23.5_example.fits
FFTW_DIR: /opt/homebrew/opt/fftw/lib/
cache-path: ${{ needs.latest_data_cache.outputs.cache_path }}
cache-key: ${{ needs.latest_data_cache.outputs.cache_key }}
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
env:
GALSIM_DATA_URL: https://github.com/GalSim-developers/GalSim/raw/releases/2.4/examples/data/
steps:
- id: cache_path
run: echo path=${{ inputs.cache_path != '' && inputs.cache_path || format('{0}/data', runner.temp) }} >> $GITHUB_OUTPUT
- name: download GalSim data
run: |
mkdir galsim_data
Expand All @@ -45,7 +47,7 @@ jobs:
wget ${{ env.GALSIM_DATA_URL }}/real_galaxy_catalog_23.5_example_fits.fits -O galsim_data/real_galaxy_catalog_23.5_example_fits.fits
- id: galsim_data
run: echo "hash=${{ hashFiles( 'galsim_data/' ) }}" >> $GITHUB_OUTPUT
- run: echo GALSIM_PATH=${{ runner.temp }}/data/galsim_data/ >> $GITHUB_ENV
- run: echo GALSIM_PATH=${{ steps.cache_path.outputs.path }}/galsim_data/ >> $GITHUB_ENV
- run: |
mkdir -p ${{ env.GALSIM_PATH }}
mv ./galsim_data/* ${{ env.GALSIM_PATH }}
Expand All @@ -55,18 +57,17 @@ jobs:
with:
path: ${{ needs.download_webbpsf_data.outputs.cache_path }}
key: ${{ needs.download_webbpsf_data.outputs.cache_key }}
- run: mv ${{ needs.download_webbpsf_data.outputs.cache_path }}/webbpsf-data/ ${{ runner.temp }}/data/
- run: echo WEBBPSF_PATH=${{ runner.temp }}/data/webbpsf-data/ >> $GITHUB_ENV
- id: cache
run: |
echo path=${{ inputs.cache_path != '' && inputs.cache_path || format('{0}/data', runner.temp) }} >> $GITHUB_OUTPUT
echo key=data-${{ needs.download_webbpsf_data.outputs.cache_key }}-galsim-data-${{ steps.galsim_data.outputs.hash }} >> $GITHUB_OUTPUT
- run: mv ${{ needs.download_webbpsf_data.outputs.cache_path }}/webbpsf-data/ ${{ steps.cache_path.outputs.path }}/
continue-on-error: true
- run: echo WEBBPSF_PATH=${{ steps.cache_path.outputs.path }}/webbpsf-data/ >> $GITHUB_ENV
- id: cache_key
run: echo key=data-${{ needs.download_webbpsf_data.outputs.cache_key }}-galsim-data-${{ steps.galsim_data.outputs.hash }} >> $GITHUB_OUTPUT
# save a new cache to the same generalized data directory, combined with extra data
- name: save a single combined data cache
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ${{ steps.cache.outputs.path }}
key: ${{ steps.cache.outputs.key }}
path: ${{ steps.cache_path.outputs.path }}
key: ${{ steps.cache_key.outputs.key }}
outputs:
cache_key: ${{ steps.cache.outputs.key }}
cache_path: ${{ steps.cache.outputs.path }}
cache_key: ${{ steps.cache_path.outputs.key }}
cache_path: ${{ steps.cache_key.outputs.path }}
10 changes: 8 additions & 2 deletions .github/workflows/retrieve_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: retrieve latest data cache key

on:
workflow_call:
inputs:
cache_path:
type: string
required: false
default: ""
outputs:
cache_key:
value: ${{ jobs.retrieve_cache.outputs.cache_key }}
Expand All @@ -13,6 +18,8 @@ jobs:
name: retrieve latest data cache key
runs-on: ubuntu-latest
steps:
- id: cache_path
run: echo cache_path=${{ inputs.cache_path != '' && inputs.cache_path || format('{0}/data', runner.temp) }} >> $GITHUB_OUTPUT
- name: retrieve latest data cache key
id: latest_cache_key
run: |
Expand All @@ -24,8 +31,7 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
- run: echo cache_key=${{ steps.latest_cache_key.outputs.cache_key }}
- id: cache_path
run: echo cache_path=${{ runner.temp }}/data/ >> $GITHUB_OUTPUT
- run: echo cache_path=${{ steps.cache_path.outputs.cache_path }}
outputs:
cache_key: ${{ steps.latest_cache_key.outputs.cache_key }}
cache_path: ${{ steps.cache_path.outputs.cache_path }}

0 comments on commit e48dfaa

Please sign in to comment.