Skip to content

Commit

Permalink
ci(pytest): set cache loading based on needs outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Oct 19, 2023
1 parent fd0053f commit 349316c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/r-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
environment:
name: ${{ inputs.environment || 'test' }}

outputs:
img_cache_loaded: ${{ steps.load-cache.outputs.img_cache_loaded }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -32,11 +35,13 @@ jobs:
continue-on-error: true

- name: Load Cached Imgs
id: load-cache
if: ${{ steps.download-images.outputs.download_path == '/tmp/images' }}
run: |
for image_tar in /tmp/images/*; do
docker image load --input $image_tar || true
done
echo "img_cache_loaded=true" >> $GITHUB_OUTPUT
- name: Environment to .env
env:
Expand Down Expand Up @@ -74,7 +79,8 @@ jobs:
-- pytest
cache-images:
if: ${{ jobs.run-pytest.steps.download-images.outputs.download_path != '/tmp/images' }}
needs: [run-pytest]
if: ${{ needs.run-pytest.outputs.img_cache_loaded }}
uses: hotosm/gh-workflows/.github/workflows/image_cache.yml@main
with:
image_names: |
Expand Down

0 comments on commit 349316c

Please sign in to comment.