Skip to content

Commit 56426e4

Browse files
committed
CI "Meta checks": correct cache key
1 parent e600087 commit 56426e4

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

.github/workflows/quick-jobs.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ jobs:
1818
meta:
1919
name: Meta checks
2020
runs-on: ubuntu-latest
21+
env:
22+
cabal_build: >-
23+
cabal build --builddir=dist-newstyle-meta --project-file=cabal.project.meta
24+
gen-cabal-macros
25+
gen-paths-module
26+
gen-spdx
27+
gen-spdx-exc
2128
# This job is not run in a container, any recent GHC should be fine
2229
steps:
23-
- uses: actions/cache@v4
24-
with:
25-
path: ~/.local/state/cabal
26-
key: linux-store-meta
2730
# OBSOLETE: workaround to fix ghcup directory rights.
2831
# # See https://github.com/haskell/cabal/pull/8739
2932
# - name: Sudo chmod to permit ghcup to update its cache
@@ -44,6 +47,17 @@ jobs:
4447
- name: Update Hackage index
4548
run: cabal v2-update
4649
- uses: actions/checkout@v4
50+
- name: Generate build plan for correct cache key
51+
run: ${{ env.cabal_build }} --dry-run
52+
- name: Restore cached dependencies
53+
uses: actions/cache/restore@v4
54+
id: cache
55+
with:
56+
path: ~/.local/state/cabal
57+
key: linux-store-meta-${{ hashfiles('dist-newstyle-meta/cache/plan.json') }}
58+
restore-keys: linux-store-meta-
59+
- name: Build tools
60+
run: ${{ env.cabal_build }}
4761
- name: Regenerate files
4862
run: |
4963
make -B spdx
@@ -52,6 +66,13 @@ jobs:
5266
run: |
5367
git status > /dev/null
5468
git diff-files -p --exit-code
69+
- name: Cache dependencies
70+
uses: actions/cache/save@v4
71+
if: always() && steps.cache.outputs.cache-hit != 'true'
72+
with:
73+
path: ~/.local/state/cabal
74+
key: ${{ steps.cache.outputs.cache-primary-key }}
75+
5576
doctest:
5677
name: Doctest Cabal
5778
runs-on: ubuntu-latest

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ style-commit: ## Run the code styler on the previous commit
4949
SPDX_LICENSE_HS:=Cabal-syntax/src/Distribution/SPDX/LicenseId.hs
5050
SPDX_EXCEPTION_HS:=Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs
5151

52+
# Note: the 'spdx' goal is used in .github/workflows/quick-jobs.yml.
53+
# Any changes to this goal need to be reconciled with this workflow.
54+
#
5255
.PHONY: spdx
5356
spdx : $(SPDX_LICENSE_HS) $(SPDX_EXCEPTION_HS)
5457

@@ -65,6 +68,9 @@ $(SPDX_EXCEPTION_HS) : templates/SPDX.LicenseExceptionId.template.hs cabal-dev-s
6568
TEMPLATE_MACROS:=Cabal/src/Distribution/Simple/Build/Macros/Z.hs
6669
TEMPLATE_PATHS:=Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs
6770

71+
# Note: the 'templates' goal is used in .github/workflows/quick-jobs.yml.
72+
# Any changes to this goal need to be reconciled with this workflow.
73+
#
6874
.PHONY: templates
6975
templates : $(TEMPLATE_MACROS) $(TEMPLATE_PATHS)
7076

0 commit comments

Comments
 (0)