diff --git a/.github/workflows/cache-minimal.yml b/.github/workflows/cache-minimal.yml new file mode 100644 index 00000000..db32ba6f --- /dev/null +++ b/.github/workflows/cache-minimal.yml @@ -0,0 +1,51 @@ +# Test minimal save/restore of a cache + +name: Minimal cache test + +on: + push: + branches: + - disabled + +jobs: + minimal-cache: + runs-on: ubuntu-latest + + steps: + - name: Create fake data + run: | + mkdir mydata + touch mydata/thedata.txt + + - name: Create unique key + id: cache-key + run: | + echo "key=cache test $(date -u)" >> $GITHUB_OUTPUT + + - name: Verify cache miss + id: miss + uses: actions/cache/restore@v4 + with: + path: mydata + key: ${{ steps.cache-key.outputs.key }} + lookup-only: true + + - name: Save cache + uses: actions/cache/save@v4 + with: + path: mydata + key: ${{ steps.cache-key.outputs.key }} + + - name: Query cache hit + id: hit + uses: actions/cache/restore@v4 + with: + path: mydata + key: ${{ steps.cache-key.outputs.key }} + fail-on-cache-miss: true + lookup-only: true + + - name: Print both cache hit and miss + run: | + echo "Cache miss? ${{ steps.miss.outputs.cache-hit }}" + echo "Cache hit? ${{ steps.hit.outputs.cache-hit }}" diff --git a/.github/workflows/test-cache.yml b/.github/workflows/test-cache.yml index dbeab342..85a5ad31 100644 --- a/.github/workflows/test-cache.yml +++ b/.github/workflows/test-cache.yml @@ -12,16 +12,19 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: + # - macos-latest + - ubuntu-latest + # - windows-latest config: - version: '2.0.1' branch: '' - - version: '1.2.2' - branch: '' - - version: 'nightly' - branch: '' - - version: '' - branch: 'master' + # - version: '1.2.2' + # branch: '' + # - version: 'nightly' + # branch: '' + # - version: '' + # branch: 'master' runs-on: ${{ matrix.os }} diff --git a/action.yml b/action.yml index e645c081..3010eea7 100644 --- a/action.yml +++ b/action.yml @@ -50,7 +50,7 @@ runs: id: cache-key shell: bash run: | - echo "key=alr[${{ steps.find-hash.outputs.version }}][${{ inputs.toolchain }}][${{ runner.os }}][${{ steps.find-hash.outputs.hash }}][c]" >> $GITHUB_OUTPUT + echo "key=alr[${{ steps.find-hash.outputs.version }}][${{ inputs.toolchain }}][${{ runner.os }}][${{ steps.find-hash.outputs.hash }}][d]" >> $GITHUB_OUTPUT # The last value in square brackets is to make the key unique for debugging - name: Reuse cached installation @@ -181,9 +181,8 @@ runs: ~/.local/share/alire ./alire_install ~/AppData/Local/alire - key: ${{ steps.cache-alr.outputs.cache-primary-key }} - # Note that '~' is recommended on Windows too: - # https://github.com/actions/cache + key: ${{ steps.cache-key.outputs.key }} + # Note that '~' is recommended on Windows too: https://github.com/actions/cache # Verify cache was saved properly - name: Cache verify @@ -193,5 +192,5 @@ runs: path: unused # Forced to provide it key: ${{steps.cache-key.outputs.key}} lookup-only: true - fail-on-cache-miss: true + fail-on-cache-miss: true # REMOVE BEFORE MERGE