Skip to content

Commit 7623e61

Browse files
committed
use ghWrapExpr in more places
1 parent effc16a commit 7623e61

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

src/HaskellCI/GitHub.hs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
311311
Binary.put cfgGhcupJobs -- GHC location affects doctest, e.g
312312

313313
when (doctestEnabled) $ githubUses "cache (tools)" "actions/cache/restore@v4"
314-
[ ("key", "${{ runner.os }}-${{ matrix.compiler }}-tools-" ++ toolsConfigHash)
314+
[ ("key", intercalate "-" [
315+
ghWrapExpr "runner.os"
316+
, ghWrapExpr "matrix.compiler"
317+
, "tools", toolsConfigHash
318+
])
315319
, ("path", "~/.haskell-ci-tools")
316320
]
317321

@@ -348,7 +352,12 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
348352
sh_if range "doctest --version"
349353

350354
when (doctestEnabled) $ githubUsesIf "save cache (tools)" "actions/cache/save@v4" "always()"
351-
[ ("key", "${{ runner.os }}-${{ matrix.compiler }}-tools-" ++ toolsConfigHash)
355+
[ ("key", intercalate "-" [
356+
ghWrapExpr "runner.os"
357+
, ghWrapExpr "matrix.compiler"
358+
, "tools"
359+
, toolsConfigHash
360+
])
352361
, ("path", "~/.haskell-ci-tools")
353362
]
354363

@@ -444,8 +453,16 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
444453
-- This a hack. https://github.com/actions/cache/issues/109
445454
-- Hashing Java - Maven style.
446455
githubUses "restore cache" "actions/cache/restore@v4"
447-
[ ("key", "${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}")
448-
, ("restore-keys", "${{ runner.os }}-${{ matrix.compiler }}-")
456+
[ ("key", intercalate "-" [
457+
ghWrapExpr "runner.os"
458+
, ghWrapExpr "matrix.compiler"
459+
, ghWrapExpr "github.sha"
460+
])
461+
, ("restore-keys", intercalate "-" [
462+
ghWrapExpr "runner.os"
463+
, ghWrapExpr "matrix.compiler"
464+
, ""
465+
]) -- Includes a trailing dash
449466
, ("path", "~/.cabal/store")
450467
]
451468

@@ -579,7 +596,11 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
579596
sh_cs $ "$CABAL v2-haddock --disable-documentation" ++ haddockFlags ++ " $ARG_COMPILER " ++ withHaddock ++ " " ++ allFlags ++ " all"
580597

581598
githubUsesIf "save cache" "actions/cache/save@v4" "always()"
582-
[ ("key", "${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}")
599+
[ ("key", intercalate "-" [
600+
ghWrapExpr "runner.os"
601+
, ghWrapExpr "matrix.compiler"
602+
, ghWrapExpr "github.sha"
603+
])
583604
, ("path", "~/.cabal/store")
584605
]
585606

@@ -591,7 +612,7 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do
591612
}
592613
, ghJobs = Map.fromList $ buildList $ do
593614
item (mainJobName, GitHubJob
594-
{ ghjName = actionName ++ " - Linux - ${{ matrix.compiler }}"
615+
{ ghjName = intercalate " - " [actionName, "Linux", ghWrapExpr "matrix.compiler"]
595616
-- NB: The Ubuntu version used in `runs-on` isn't
596617
-- particularly important since we use a Docker container.
597618
, ghjRunsOn = ghcRunsOnVer

0 commit comments

Comments
 (0)