use reusable workflow from WebbPSF repository to download and cache data #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: download and cache data | |
on: | |
schedule: | |
- cron: "42 4 * * 3" | |
workflow_dispatch: | |
inputs: | |
webbpsf_minimal: | |
description: minimal WebbPSF dataset | |
type: boolean | |
required: false | |
default: true | |
pull_request: | |
jobs: | |
download_webbpsf_data: | |
uses: zacharyburnett/webbpsf/.github/workflows/download_data.yml@ci/create_data_dir | |
with: | |
minimal: ${{ github.event_name != 'workflow_dispatch' && true || inputs.webbpsf_minimal }} | |
combine_data_cache: | |
needs: [ download_webbpsf_data ] | |
runs-on: ubuntu-latest | |
env: | |
GALSIM_DATA_URL: https://github.com/GalSim-developers/GalSim/raw/releases/2.4/examples/data/ | |
steps: | |
- name: download GalSim data | |
id: galsim_data | |
run: | | |
mkdir ./galsim_data/ | |
wget ${{ env.GALSIM_DATA_URL }}/real_galaxy_catalog_23.5_example.fits -O ./galsim_data/real_galaxy_catalog_23.5_example.fits | |
wget ${{ env.GALSIM_DATA_URL }}/real_galaxy_catalog_23.5_example_selection.fits -O ./galsim_data/real_galaxy_catalog_23.5_example_selection.fits | |
wget ${{ env.GALSIM_DATA_URL }}/real_galaxy_catalog_23.5_example_fits.fits -O ./galsim_data/real_galaxy_catalog_23.5_example_fits.fits | |
echo "hash=${{ hashFiles( './galsim_data/' ) }}" >> $GITHUB_OUTPUT | |
mv ./galsim_data/ ${{ needs.download_webbpsf_data.outputs.cache_path }} | |
echo "GALSIM_CAT_PATH=${{ needs.download_webbpsf_data.outputs.cache_path }}/galsim_data/real_galaxy_catalog_23.5_example.fits" >> $GITHUB_OUTPUT | |
- name: retrieve cached WebbPSF data | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ needs.download_webbpsf_data.outputs.cache_path }} | |
key: ${{ needs.download_webbpsf_data.outputs.cache_key }} | |
# 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@v4 | |
with: | |
path: ${{ needs.download_webbpsf_data.outputs.cache_path }} | |
key: data-${{ needs.download_webbpsf_data.outputs.cache_key }}-galsim-data-${{ steps.galsim_data.outputs.hash }} |