Include OTP and Elixir version in cache keys

This commit is contained in:
Claudio Ortolina
2024-12-19 20:32:30 +00:00
parent 9dce1cacb9
commit 7b2d641190
+6 -5
View File
@@ -8,6 +8,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
id: setup-beam
with: with:
version-type: strict version-type: strict
version-file: .tool-versions version-file: .tool-versions
@@ -18,9 +19,9 @@ jobs:
cache-name: cache-elixir-deps cache-name: cache-elixir-deps
with: with:
path: deps path: deps
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} key: ${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: | restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}- ${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-mix-${{ env.cache-name }}-
# Step: Define how to cache the `_build` directory. After the first run, # Step: Define how to cache the `_build` directory. After the first run,
# this speeds up tests runs a lot. This includes not re-compiling our # this speeds up tests runs a lot. This includes not re-compiling our
@@ -32,10 +33,10 @@ jobs:
cache-name: cache-compiled-build cache-name: cache-compiled-build
with: with:
path: _build path: _build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} key: ${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: | restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}- ${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix- ${{ runner.os }}-otp-${{ steps.setup-beam.outputs.otp-version }}-elixir-${{ steps.setup-beam.outputs.elixir-version }}-mix-
# Step: Conditionally bust the cache when job is re-run. # Step: Conditionally bust the cache when job is re-run.
# Sometimes, we may have issues with incremental builds that are fixed by # Sometimes, we may have issues with incremental builds that are fixed by