Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make key unique #8

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .github/workflows/branch.yml

This file was deleted.

9 changes: 7 additions & 2 deletions .github/workflows/selftest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
cached: [false, true]

runs-on: ${{ matrix.os }}

steps:
- uses: alire-project/alr-install@v1-next
- name: Checkout
uses: actions/checkout@v2

- name: Selftest
uses: ./ # Uses the action code from the PR itself
with:
crates: gprbuild
# This can be changed to a more lightweight crate (hello)
# once we can install indexed releases.
cache: false # Don't use cache for testing
cache: ${{ matrix.cached }}

- name: Run check
shell: bash
Expand Down
19 changes: 16 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ runs:
echo "force=" >> $GITHUB_OUTPUT
fi

- name: Prepare cache id
- name: Prepare cache milestones
id: find-versions
shell: bash
run: |
Expand All @@ -65,14 +65,27 @@ runs:
echo Versions are: $versions
echo "milestones=$versions" >> $GITHUB_OUTPUT

- name: Prepare cache id
id: cache-key
shell: bash
run: |
echo "key=[alr-install][${{runner.os}}][${{runner.arch}}][${{inputs.prefix}}][${{steps.find-versions.outputs.milestones}}]" >> $GITHUB_OUTPUT

- name: Reuse cached installation
if: inputs.cache == 'true'
id: cache-install
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{inputs.prefix}}
key: '[alr-install][${{runner.os}}][${{inputs.prefix}}][${{steps.find-versions.outputs.milestones}}]'
key: ${{steps.cache-key.outputs.key}}

- name: Diagnose cache usage
shell: bash
run: |
echo "alr-install cache requested: ${{inputs.cache}}"
echo "alr-install cache hit: ${{steps.cache-install.outputs.cache-hit}}"
echo "alr-install cache key: ${{steps.cache-key.outputs.key}}"

- name: Run `alr install`
if: inputs.cache != 'true' || steps.cache-install.outputs.cache-hit != 'true'
Expand Down
Loading