Skip to content

Commit 1723ad0

Browse files
andreasabelcoot
authored andcommitted
CI changelogs: switch to XDG, fix cache key
This is the same as #9845 but for the changelogs.yml workflow. `changelog-d` currently has restrictive bound `base < 4.19` which we need to ignore if we want to build on the latest GHC as shipped by the GHA runner.
1 parent b3a63f4 commit 1723ad0

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

.github/workflows/changelogs.yml

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Assorted
1+
name: Changelogs
22

33
on:
44
push:
@@ -25,43 +25,48 @@ jobs:
2525
runs-on: ubuntu-latest
2626

2727
steps:
28-
- name: Set PATH
29-
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
30-
run: |
31-
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
32-
- uses: actions/cache@v3
33-
with:
34-
path: ~/.cabal/store
35-
key: linux-store-changelogs
36-
# See https://github.com/haskell/cabal/pull/8739
37-
- name: Sudo chmod to permit ghcup to update its cache
38-
run: |
39-
if [[ "${{ runner.os }}" == "Linux" ]]; then
40-
sudo mkdir -p /usr/local/.ghcup/cache
41-
sudo chown -R $USER /usr/local/.ghcup
42-
sudo chmod -R 777 /usr/local/.ghcup
43-
fi
44-
- name: ghcup
45-
run: |
46-
ghcup config set cache true
47-
ghcup install ghc recommended
48-
ghcup set ghc recommended
49-
- name: Update Hackage index
50-
run: cabal v2-update
51-
# Cannot install it directly from remote tarball due to
28+
29+
# Cannot install changelog-d directly from remote tarball due to
5230
# https://github.com/haskell/cabal/issues/7360
31+
# Also, we would like to get the build plan for the cache key.
5332
- name: Fetch changelog-d
5433
run: |
5534
changelog_d_latest="$(curl https://codeberg.org/api/v1/repos/fgaz/changelog-d/branches/master | jq -r .commit.id)"
5635
echo "Using changelog-d revision $changelog_d_latest"
5736
curl "https://codeberg.org/fgaz/changelog-d/archive/$changelog_d_latest.tar.gz" -o changelog-d.tar.gz
5837
tar -xf changelog-d.tar.gz
38+
39+
- name: Update Hackage index
40+
run: cabal v2-update
41+
42+
- name: Build plan for changelog-d
43+
working-directory: changelog-d
44+
run: |
45+
cabal v2-build --dry-run --allow-newer=changelog-d:base
46+
47+
- name: Restore dependencies of changelog-d
48+
uses: actions/cache/restore@v4
49+
id: cache
50+
with:
51+
path: ~/.local/state/cabal
52+
key: linux-store-changelogs-${{ hashfiles('changelog-d/dist-newstyle/cache/plan.json') }}
53+
restore-keys: linux-store-changelogs
54+
5955
- name: Install changelog-d
56+
working-directory: changelog-d
6057
run: |
61-
pushd changelog-d
62-
cabal v2-install
63-
popd
64-
- uses: actions/checkout@v4
58+
cabal v2-install --allow-newer=changelog-d:base
59+
60+
- name: Cache dependencies of changelog-d
61+
uses: actions/cache/save@v4
62+
if: always() && steps.cache.outputs.cache-hit != 'true'
63+
with:
64+
path: ~/.local/state/cabal
65+
key: ${{ steps.cache.outputs.cache-primary-key }}
66+
67+
- name: Checkout cabal sources
68+
uses: actions/checkout@v4
69+
6570
- name: Run changelog-d
6671
run: |
6772
changelog-d changelog.d

0 commit comments

Comments
 (0)