-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Test cache | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test-cache: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- macos-13 # x64 | ||
- macos-latest # arm64 | ||
- ubuntu-latest | ||
- windows-latest | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# This might hit cache | ||
|
||
- name: Check action itself (attempt 1) | ||
id: attempt_1 | ||
uses: ./ | ||
with: | ||
crates: gprbuild hello | ||
prefix: alire_prefix | ||
|
||
# We want to later on test the pristine prefix restored from cache | ||
- name: Clean prefix for next attempt | ||
run: rm -rf alire_prefix | ||
|
||
# Next attemp should hit cache given the previous run | ||
|
||
- name: Check action itself (attempt 2) | ||
if: steps.attempt_1.outputs.cache_hit != 'true' | ||
id: attempt_2 | ||
uses: ./ | ||
with: | ||
crates: gprbuild hello | ||
prefix: alire_prefix | ||
|
||
- name: Diagnose cache use | ||
shell: bash | ||
run: | | ||
echo "Caching attempt 1: ${{steps.attempt_1.outputs.cache_hit}}" | ||
echo "Caching attempt 2: ${{steps.attempt_2.outputs.cache_hit}}" | ||
# Fail if no cache was hit | ||
- if: (steps.attempt_1.outputs.cache_hit != 'true') && (steps.attempt_2.outputs.cache_hit != 'true') | ||
uses: actions/github-script@v3 | ||
with: | ||
script: | | ||
core.setFailed('FAIL: No cache hit observed') | ||
- name: Run check | ||
shell: bash | ||
run: | | ||
which gprbuild && \ | ||
gprbuild --version && \ | ||
hello | grep "Hello, world!" |
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