Skip to content

Commit

Permalink
allow data workflows (WebbPSF + GALSIM) to be used by upstream repos …
Browse files Browse the repository at this point in the history
…for downstream testing
  • Loading branch information
zacharyburnett committed Nov 20, 2024
1 parent 240e9a4 commit c8db2fd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ name: download and cache data
on:
schedule:
- cron: "42 4 * * 3"
workflow_call:
inputs:
webbpsf_minimal:
type: boolean
required: false
default: true
outputs:
cache_key:
value: ${{ jobs.combine_data_cache.outputs.cache_key }}
cache_path:
value: ${{ jobs.combine_data_cache.outputs.cache_path }}
workflow_dispatch:
inputs:
webbpsf_minimal:
Expand Down Expand Up @@ -30,7 +41,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=/tmp/data/galsim_data/ >> $GITHUB_ENV
- run: echo GALSIM_PATH=${{ runner.temp }}/data/galsim_data/ >> $GITHUB_ENV
- run: |
mkdir -p ${{ env.GALSIM_PATH }}
mv ./galsim_data/* ${{ env.GALSIM_PATH }}
Expand All @@ -40,11 +51,18 @@ 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/ /tmp/data/
- run: echo WEBBPSF_PATH=/tmp/data/webbpsf-data/ >> $GITHUB_ENV
- 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=${{ runner.temp }}/data/ >> $GITHUB_OUTPUT
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: /tmp/data/
key: data-${{ needs.download_webbpsf_data.outputs.cache_key }}-galsim-data-${{ steps.galsim_data.outputs.hash }}
path: ${{ steps.cache.outputs.path }}
key: ${{ steps.cache.outputs.key }}
outputs:
cache_key: ${{ steps.cache.outputs.key }}
cache_path: ${{ steps.cache.outputs.path }}
2 changes: 1 addition & 1 deletion .github/workflows/retrieve_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
- run: echo cache_key=${{ steps.latest_cache_key.outputs.cache_key }}
- id: cache_path
run: echo cache_path=/tmp/data/ >> $GITHUB_OUTPUT
run: echo cache_path=${{ runner.temp }}/data/ >> $GITHUB_OUTPUT
outputs:
cache_key: ${{ steps.latest_cache_key.outputs.cache_key }}
cache_path: ${{ steps.cache_path.outputs.cache_path }}

0 comments on commit c8db2fd

Please sign in to comment.