Skip to content

Commit

Permalink
Fix missing path in cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Jun 27, 2024
1 parent f4c4b88 commit 2baefda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/test-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
pull_request:

jobs:
sanity-check:
test-cache:
strategy:
fail-fast: false
matrix:
Expand All @@ -35,7 +35,7 @@ jobs:
# This might hit cache

- name: Check action itself
- name: Check action itself (attempt 1)
id: attempt_1
uses: alire-project/setup-alire@v3-next
with:
Expand All @@ -44,7 +44,7 @@ jobs:

# Next attemp should hit cache given the previous run

- name: Check action itself
- name: Check action itself (attempt 2)
if: steps.attempt_1.outputs.cache_hit != 'true'
id: attempt_2
uses: alire-project/setup-alire@v3-next
Expand All @@ -54,7 +54,7 @@ jobs:

- shell: bash
run: |
echo Caching attempt 1: ${{steps.attempt_1.outputs.cache_hit}} :: Caching attempt 2: ${{steps.attempt_2.outputs.cache_hit}}
echo Caching attempt 1: ${{steps.attempt_1.outputs.cache-hit}} :: 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')
Expand All @@ -72,7 +72,6 @@ jobs:
alr exec -- gprbuild --version
# Verify proper builds

- run: alr -n version | grep "os:" | grep LINUX
if: matrix.os == 'ubuntu-latest'
shell: bash
Expand Down
8 changes: 5 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,21 @@ runs:
echo "key=alr[${{ steps.find-hash.outputs.version }}][${{ inputs.toolchain }}][${{ runner.os }}][${{ steps.find-hash.outputs.hash }}]" >> $GITHUB_OUTPUT
- name: Reuse cached installation
if: ${{ inputs.cache == 'true' && inputs.toolchain_dir == '' }}
if: ${{ inputs.cache == 'true' }}
id: cache-alr
uses: actions/cache/restore@v3
with:
path: |
~/.cache/alire
~/.config/alire
./alire_install
~/.local/share/alire
~/AppData/Local/alire
key: ${{steps.cache-key.outputs.key}}
# .cache contains msys64 install on Windows
# .config contains the toolchain at the default location, besides index config
# ./alire_install contains alr itself
# ~/AppData is used with Alire 2.0 onwards
# ~/AppData and ./local/share/alire is used with Alire 2.0 onwards
# Note that '~' is recommended on Windows too: https://github.com/actions/cache

- name: Check cache output
Expand Down Expand Up @@ -170,12 +171,13 @@ runs:
# it's not saved until workflow completion and by then it's too late.
# When cache was hit, attempting to save will fail and emit a warning, so avoid it.
- name: Cache install
if: ${{ inputs.cache == 'true' && inputs.toolchain_dir == '' && steps.cache-alr.outputs.cache-hit != 'true' }}
if: ${{ inputs.cache == 'true' && steps.cache-alr.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v3
with:
path: |
~/.cache/alire
~/.config/alire
~/.local/share/alire
./alire_install
~/AppData/Local/alire
key: ${{ steps.cache-alr.outputs.cache-primary-key }}
Expand Down

0 comments on commit 2baefda

Please sign in to comment.