download CRDS test cache #79
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 CRDS test cache | |
on: | |
workflow_call: | |
outputs: | |
path: | |
value: ${{ jobs.cache.outputs.path }} | |
testing_cache: | |
value: ${{ jobs.cache.outputs.testing_cache }} | |
key: | |
value: ${{ jobs.cache.outputs.key }} | |
workflow_dispatch: | |
schedule: | |
# Weekly Monday midnight | |
- cron: "0 0 * * 1" | |
env: | |
CRDS_TEST_ROOT: /tmp | |
CRDS_PATH: /tmp/crds-cache-default-test | |
CRDS_TESTING_CACHE: /tmp/crds-cache-test | |
CRDS_CLIENT_RETRY_COUNT: 3 | |
CRDS_CLIENT_RETRY_DELAY_SECONDS: 20 | |
LD_LIBRARY_PATH: /usr/local/lib | |
defaults: | |
run: | |
shell: bash -leo pipefail {0} {0} | |
jobs: | |
contexts: | |
uses: ./.github/workflows/contexts.yml | |
cache: | |
needs: [ contexts ] | |
name: download and cache CRDS test files | |
runs-on: ubuntu-latest | |
outputs: | |
path: ${{ env.CRDS_PATH }} | |
testing_cache: ${{ env.CRDS_TESTING_CACHE }} | |
key: ${{ steps.key.outputs.key }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: spacetelescope/crds | |
- id: key | |
run: echo "key=test-cache-${{ needs.contexts.outputs.hst }}-${{ needs.contexts.outputs.jwst }}" >> $GITHUB_OUTPUT | |
- id: lookup-cache | |
name: check for existence of combined CRDS cache (`${{ steps.key.outputs.key }}`) | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
${{ env.CRDS_PATH }} | |
${{ env.CRDS_TESTING_CACHE }} | |
key: ${{ steps.key.outputs.key }} | |
lookup-only: true | |
- if: steps.lookup-cache.outputs.cache-hit != 'true' | |
id: retrieve-previous-cache | |
name: retrieve a previous combined CRDS cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
${{ env.CRDS_PATH }} | |
${{ env.CRDS_TESTING_CACHE }} | |
key: ${{ steps.key.outputs.key }} | |
restore-keys: | | |
test-cache- | |
- if: steps.retrieve-previous-cache.outputs.cache-matched-key == '' | |
run: | | |
git clone https://github.com/spacetelescope/crds-cache-test.git | |
mv crds-cache-test ${{ env.CRDS_TEST_ROOT }} | |
- if: steps.lookup-cache.outputs.cache-hit != 'true' | |
uses: mamba-org/setup-micromamba@v2 | |
with: | |
environment-name: crds-testing | |
create-args: >- | |
python=3.11 | |
asdf | |
astropy | |
filelock | |
fitsverify | |
numpy | |
parsley | |
requests | |
init-shell: bash | |
cache-environment: true | |
cache-downloads: true | |
- if: steps.lookup-cache.outputs.cache-hit != 'true' | |
run: ./install | |
- if: steps.lookup-cache.outputs.cache-hit != 'true' | |
run: pip install git+https://github.com/spacetelescope/jwst roman-datamodels | |
- if: steps.lookup-cache.outputs.cache-hit != 'true' | |
run: ./setup_test_cache ${{ env.CRDS_TEST_ROOT }} u | |
- if: steps.lookup-cache.outputs.cache-hit != 'true' | |
name: save combined CRDS cache (`${{ steps.key.outputs.key }}`) | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
${{ env.CRDS_PATH }} | |
${{ env.CRDS_TESTING_CACHE }} | |
key: ${{ steps.key.outputs.key }} | |