Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI changelogs: switch to XDG, fix cache key (backport #9849) #10008

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 37 additions & 30 deletions .github/workflows/changelogs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Assorted
name: Changelogs

on:
push:
Expand All @@ -25,41 +25,48 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Set PATH
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/cache@v3
with:
path: ~/.cabal/store
key: linux-store-changelogs
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo mkdir -p /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: ghcup

# Cannot install changelog-d directly from remote tarball due to
# https://github.com/haskell/cabal/issues/7360
# Also, we would like to get the build plan for the cache key.
- name: Fetch changelog-d
run: |
ghcup config set cache true
ghcup install ghc recommended
ghcup set ghc recommended
changelog_d_latest="$(curl https://codeberg.org/api/v1/repos/fgaz/changelog-d/branches/master | jq -r .commit.id)"
echo "Using changelog-d revision $changelog_d_latest"
curl "https://codeberg.org/fgaz/changelog-d/archive/$changelog_d_latest.tar.gz" -o changelog-d.tar.gz
tar -xf changelog-d.tar.gz

- name: Update Hackage index
run: cabal v2-update
# Cannot install it from tarball due to
# https://github.com/haskell/cabal/issues/7360
- uses: actions/checkout@v4

- name: Build plan for changelog-d
working-directory: changelog-d
run: |
cabal v2-build --dry-run --allow-newer=changelog-d:base

- name: Restore dependencies of changelog-d
uses: actions/cache/restore@v4
id: cache
with:
repository: "fgaz/changelog-d"
path: "changelog-d"
path: ~/.local/state/cabal
key: linux-store-changelogs-${{ hashfiles('changelog-d/dist-newstyle/cache/plan.json') }}
restore-keys: linux-store-changelogs

- name: Install changelog-d
working-directory: changelog-d
run: |
pushd changelog-d
cabal v2-install
popd
- uses: actions/checkout@v4
cabal v2-install --allow-newer=changelog-d:base

- name: Cache dependencies of changelog-d
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 }}

- name: Checkout cabal sources
uses: actions/checkout@v4

- name: Run changelog-d
run: |
changelog-d changelog.d
2 changes: 1 addition & 1 deletion license-list-data/exceptions-3.23.json
Original file line number Diff line number Diff line change
Expand Up @@ -769,4 +769,4 @@
}
],
"releaseDate": "2024-02-08"
}
}
2 changes: 1 addition & 1 deletion license-list-data/licenses-3.23.json
Original file line number Diff line number Diff line change
Expand Up @@ -7994,4 +7994,4 @@
}
],
"releaseDate": "2024-02-08"
}
}
Loading