docs: Improve documentation #42
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 | |
pull_request: | |
paths: | |
- action.yml | |
- scripts/** | |
- .github/workflows/test.yaml | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
cache: [cache, no-cache] | |
cache-hit: [cache-hit, no-cache-hit] | |
exclude: | |
- cache: no-cache | |
cache-hit: cache-hit | |
steps: | |
- name: Restore Hello World cache | |
if: matrix.cache == 'cache' && matrix.cache-hit == 'cache-hit' | |
id: cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ runner.tool_cache }}/hello-world | |
key: hello-world-${{ runner.os }}-${{ matrix.cache-hit }} | |
- name: Download Hello World binary (Unix-like) | |
if: (runner.os == 'Linux' || runner.os == 'macOS') && ! steps.cache.outputs.cache-hit | |
working-directory: ${{ runner.temp }} | |
run: | | |
if [ $RUNNER_OS = macOS ]; then os=macos; else os=linux; fi | |
mkdir hello-world | |
wget -O hello-world/hello $GITHUB_SERVER_URL/AnimMouse/Hello-World-Binaries/raw/main/hello-$os | |
chmod +x hello-world/hello | |
- name: Download Hello World binary (Windows) | |
if: runner.os == 'Windows' && ! steps.cache.outputs.cache-hit | |
working-directory: ${{ runner.temp }} | |
run: | | |
New-Item hello-world -ItemType Directory | |
Invoke-WebRequest $env:GITHUB_SERVER_URL/AnimMouse/Hello-World-Binaries/raw/main/hh2.golden.exe -OutFile hello-world\hello.exe | |
- name: Install Hello World binary using tool-cache | |
uses: AnimMouse/tool-cache@main | |
with: | |
folder_name: hello-world | |
cache_hit: ${{ steps.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' && ! steps.cache.outputs.cache-hit | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ runner.tool_cache }}/hello-world | |
key: hello-world-${{ runner.os }}-${{ matrix.cache-hit }} |