Skip to content

Commit

Permalink
CI "Meta checks": correct cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Apr 2, 2024
1 parent e600087 commit 56426e4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/quick-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ jobs:
meta:
name: Meta checks
runs-on: ubuntu-latest
env:
cabal_build: >-
cabal build --builddir=dist-newstyle-meta --project-file=cabal.project.meta
gen-cabal-macros
gen-paths-module
gen-spdx
gen-spdx-exc
# This job is not run in a container, any recent GHC should be fine
steps:
- uses: actions/cache@v4
with:
path: ~/.local/state/cabal
key: linux-store-meta
# OBSOLETE: workaround to fix ghcup directory rights.
# # See https://github.com/haskell/cabal/pull/8739
# - name: Sudo chmod to permit ghcup to update its cache
Expand All @@ -44,6 +47,17 @@ jobs:
- name: Update Hackage index
run: cabal v2-update
- uses: actions/checkout@v4
- name: Generate build plan for correct cache key
run: ${{ env.cabal_build }} --dry-run
- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
with:
path: ~/.local/state/cabal
key: linux-store-meta-${{ hashfiles('dist-newstyle-meta/cache/plan.json') }}
restore-keys: linux-store-meta-
- name: Build tools
run: ${{ env.cabal_build }}
- name: Regenerate files
run: |
make -B spdx
Expand All @@ -52,6 +66,13 @@ jobs:
run: |
git status > /dev/null
git diff-files -p --exit-code
- name: Cache dependencies
uses: actions/cache/save@v4
if: always() && steps.cache.outputs.cache-hit != 'true'
with:
path: ~/.local/state/cabal
key: ${{ steps.cache.outputs.cache-primary-key }}

doctest:
name: Doctest Cabal
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ style-commit: ## Run the code styler on the previous commit
SPDX_LICENSE_HS:=Cabal-syntax/src/Distribution/SPDX/LicenseId.hs
SPDX_EXCEPTION_HS:=Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs

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

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

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

Expand Down

0 comments on commit 56426e4

Please sign in to comment.