Test with no cache hit #26
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: Test Tool Cache | ||
on: | ||
push: | ||
paths: | ||
- action.yml | ||
- scripts/** | ||
- .github/workflows/test.yaml | ||
jobs: | ||
test-unix-like: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
cache: [cache, no-cache] | ||
cache-hit: [cache-hit, no-cache-hit] | ||
steps: | ||
- name: Restore Hello World cache | ||
if: matrix.cache == cache && matrix.cache-hit == cache-hit | ||
Check failure on line 21 in .github/workflows/test.yaml GitHub Actions / Test Tool CacheInvalid workflow file
|
||
id: restore-cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ runner.tool_cache }}/hello-world-program | ||
key: cache-hit-hello-world-program | ||
- name: Checkout Linux Hello World binary | ||
if: matrix.os == 'ubuntu-latest' && steps.restore-cache.outputs.cache-hit != true | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: hello-world-linux | ||
persist-credentials: false | ||
- name: Checkout macOS Hello World binary | ||
if: matrix.os == 'macos-latest' && steps.restore-cache.outputs.cache-hit != true | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: hello-world-macos | ||
persist-credentials: false | ||
- name: Move the binary to runner temp folder | ||
if: steps.restore-cache.outputs.cache-hit != true | ||
run: | | ||
mkdir $RUNNER_TEMP/hello-world-program | ||
mv hello $RUNNER_TEMP/hello-world-program | ||
- name: Install the Hello World binary using tool-cache | ||
uses: AnimMouse/tool-cache@main | ||
with: | ||
folder_name: hello-world-program | ||
cache_hit: ${{ steps.restore-cache.outputs.cache-hit }} | ||
- name: Test if the Hello World binary is installed by tool-cache | ||
run: hello | ||
- name: Save Hello World cache | ||
if: matrix.cache == cache | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: ${{ runner.tool_cache }}/hello-world-program | ||
key: ${{ matrix.cache-hit }}-hello-world-program | ||
test-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout Windows Hello World binary | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: hello-world-windows | ||
persist-credentials: false | ||
- name: Move the binary to runner temp folder | ||
run: | | ||
New-Item $env:RUNNER_TEMP\hello-world-program -ItemType Directory | ||
Move-Item hh2.golden.exe $env:RUNNER_TEMP\hello-world-program | ||
- name: Install the Windows Hello World binary using tool-cache | ||
uses: AnimMouse/tool-cache@main | ||
with: | ||
folder_name: hello-world-program | ||
- name: Test if the Windows Hello World binary is installed by tool-cache | ||
run: hh2.golden |