download CRDS test cache #145
This file contains hidden or 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| 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@v5 # v4.0.2 | |
| 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@v5 | |
| 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-combined-cache.outputs.cache-hit != 'true' | |
| id: retrieve-hst-cache | |
| name: retrieve HST CRDS cache (`test-cache-${{ needs.contexts.outputs.hst }}`) | |
| uses: actions/cache@v5 # v4.0.2 | |
| with: | |
| path: ${{ env.CRDS_PATH }}/**/hst* | |
| key: test-cache-${{ needs.contexts.outputs.hst }} | |
| - if: steps.lookup-combined-cache.outputs.cache-hit != 'true' | |
| id: retrieve-jwst-cache | |
| name: retrieve JWST CRDS cache (`test-cache-${{ needs.contexts.outputs.jwst }}`) | |
| uses: actions/cache@v5 # v4.0.2 | |
| with: | |
| path: ${{ env.CRDS_PATH }}/**/jwst* | |
| key: test-cache-${{ needs.contexts.outputs.jwst }} | |
| - if: steps.lookup-cache.outputs.cache-hit != 'true' | |
| uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7 | |
| 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@v5 # v4.0.2 | |
| with: | |
| path: | | |
| ${{ env.CRDS_PATH }} | |
| ${{ env.CRDS_TESTING_CACHE }} | |
| key: ${{ steps.key.outputs.key }} | |