Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] allow user to specify cache path in reusable workflow #1049

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,33 @@ name: download CRDS test cache

on:
workflow_call:
inputs:
cache_path:
description: path to test cache on runner
type: string
required: false
default: '/tmp/crds'
outputs:
cache_path:
value: ${{ jobs.cache.outputs.cache_path }}
key:
value: ${{ jobs.cache.outputs.cache_key }}
path:
value: ${{ jobs.cache.outputs.path }}
value: ${{ jobs.cache.outputs.crds_path }}
testing_cache:
value: ${{ jobs.cache.outputs.testing_cache }}
key:
value: ${{ jobs.cache.outputs.key }}
workflow_dispatch:
inputs:
cache_path:
description: path to test cache on runner
type: string
required: false
default: '/tmp/crds'
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
Expand All @@ -33,11 +44,11 @@ jobs:
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:
- run: echo CRDS_TEST_ROOT=${{ inputs.cache_path != '' && inputs.cache_path || '/tmp/crds' }} >> $GITHUB_ENV
- run: |
echo CRDS_PATH=${{ env.CRDS_TEST_ROOT }}/crds-cache-default-test >> $GITHUB_ENV
echo CRDS_TESTING_CACHE=${{ env.CRDS_TEST_ROOT }}/crds-cache-test >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
repository: spacetelescope/crds
Expand Down Expand Up @@ -97,4 +108,8 @@ jobs:
${{ env.CRDS_PATH }}
${{ env.CRDS_TESTING_CACHE }}
key: ${{ steps.key.outputs.key }}

outputs:
cache_path: ${{ env.CRDS_TEST_ROOT }}
cache_key: ${{ steps.key.outputs.key }}
crds_path: ${{ env.CRDS_PATH }}
crds_testing_cache: ${{ env.CRDS_TESTING_CACHE }}
Loading