add separate workflow to download CRDS test cache #7
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: build cache | |
on: | |
workflow_dispatch: | |
schedule: | |
# Weekly Monday 9AM | |
- cron: "0 9 * * 1" | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- labeled | |
- unlabeled | |
- synchronize | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -leo pipefail {0} {0} | |
env: | |
CRDS_PATH: /tmp/crds-cache-default-test/ | |
CRDS_TEST_ROOT: /tmp | |
CRDS_CLIENT_RETRY_COUNT: 3 | |
CRDS_CLIENT_RETRY_DELAY_SECONDS: 20 | |
LD_LIBRARY_PATH: /usr/local/lib | |
jobs: | |
contexts: | |
name: retrieve latest CRDS contexts | |
runs-on: ubuntu-latest | |
outputs: | |
crds_path: ${{ env.CRDS_PATH }} | |
hst: ${{ steps.hst_crds_context.outputs.pmap }} | |
jwst: ${{ steps.jwst_crds_context.outputs.pmap }} | |
roman: ${{ steps.roman_crds_context.outputs.pmap }} | |
steps: | |
- id: hst_crds_context | |
env: | |
OBSERVATORY: hst | |
CRDS_SERVER_URL: https://hst-crds.stsci.edu | |
run: > | |
echo "pmap=$( | |
curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}"], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ | | |
python -c "import sys, json; print(json.load(sys.stdin)['result'])" | |
)" >> $GITHUB_OUTPUT | |
- id: jwst_crds_context | |
env: | |
OBSERVATORY: jwst | |
CRDS_SERVER_URL: https://jwst-crds.stsci.edu | |
run: > | |
echo "pmap=$( | |
curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}"], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ | | |
python -c "import sys, json; print(json.load(sys.stdin)['result'])" | |
)" >> $GITHUB_OUTPUT | |
- id: roman_crds_context | |
env: | |
OBSERVATORY: roman | |
CRDS_SERVER_URL: https://roman-crds.stsci.edu | |
run: > | |
echo "pmap=$( | |
curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}"], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ | | |
python -c "import sys, json; print(json.load(sys.stdin)['result'])" | |
)" >> $GITHUB_OUTPUT | |
- run: echo "${{ steps.hst_crds_context.outputs.pmap }} ${{ steps.jwst_crds_context.outputs.pmap }} ${{ steps.roman_crds_context.outputs.pmap }}" | |
cache: | |
if: (github.repository == 'spacetelescope/crds' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'update CRDS cache'))) | |
needs: [ contexts ] | |
name: run tests to build cache of CRDS reference files | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: crds-testing | |
create-args: >- | |
python=3.11 | |
fitsverify | |
init-shell: bash | |
cache-environment: true | |
cache-downloads: true | |
- run: | | |
pip install roman-datamodels | |
pip install git+https://github.com/spacetelescope/jwst | |
pip uninstall --yes crds | |
./install | |
pip install .[submission,test,docs,synphot] | |
- uses: actions/cache@v3 | |
if: always() | |
with: | |
path: ${{ env.CRDS_PATH }} | |
key: crds-${{ needs.data.outputs.hst }}-${{ needs.data.outputs.jwst }}-${{ needs.data.outputs.roman }} | |
- run: ./setup_test_cache ${{ env.CRDS_TEST_ROOT }} | |
- run: ./runtests |