Skip to content

Commit

Permalink
Fix #9815: switch quick-jobs CI to XDG
Browse files Browse the repository at this point in the history
Fix #9815:
- Cache `~/.local/state/cabal` instead of `~/.cabal/store`
- `~/.local/bin` is used instead of `~/.cabal/bin` and is already in the PATH
  (verify this by calling `alex` after installing it)

As I am passing by:
- bump cache action to v4
- double-quote `$USER` to keep actionlint happy
- move `if` from shell-level to job-level
- allow newest `alex`
  • Loading branch information
andreasabel authored and coot committed Apr 6, 2024
1 parent a378728 commit 8b3d500
Showing 1 changed file with 14 additions and 30 deletions.
44 changes: 14 additions & 30 deletions .github/workflows/quick-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,19 @@ jobs:
runs-on: ubuntu-latest
# This job is not run in a container, any recent GHC should be fine
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
- uses: actions/cache@v4
with:
path: ~/.cabal/store
path: ~/.local/state/cabal
key: linux-store-meta
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
if: runner.os == 'Linux'
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chown -R "${USER}" /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: ghcup
run: |
ghcup --version
Expand All @@ -47,7 +42,8 @@ jobs:
- name: Update Hackage index
run: cabal v2-update
- name: Install alex
run: cabal v2-install alex --constraint='alex ==3.2.7.3'
run: cabal v2-install alex --constraint='alex >=3.2.7.3'
- run: alex --version
- uses: actions/checkout@v4
- name: Regenerate files
run: |
Expand All @@ -62,23 +58,19 @@ jobs:
name: Doctest Cabal
runs-on: ubuntu-latest
steps:
- name: Set PATH
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cabal/store
path: ~/.local/state/cabal
key: linux-store-doctest
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
if: runner.os == 'Linux'
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chown -R "${USER}" /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: ghcup
run: |
ghcup --version
Expand All @@ -96,23 +88,19 @@ jobs:
name: Check Field Syntax Reference
runs-on: ubuntu-latest
steps:
- name: Set PATH
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cabal/store
path: ~/.local/state/cabal
key: linux-store-buildinfo-doc-diff
# See https://github.com/haskell/cabal/pull/8739
- name: Sudo chmod to permit ghcup to update its cache
if: runner.os == 'Linux'
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ls -lah /usr/local/.ghcup/cache
sudo mkdir -p /usr/local/.ghcup/cache
sudo ls -lah /usr/local/.ghcup/cache
sudo chown -R $USER /usr/local/.ghcup
sudo chown -R "${USER}" /usr/local/.ghcup
sudo chmod -R 777 /usr/local/.ghcup
fi
- name: ghcup
run: |
ghcup --version
Expand All @@ -128,9 +116,6 @@ jobs:
name: Check Release Project
runs-on: ubuntu-latest
steps:
- name: Set PATH
run: |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
- name: ghcup
run: |
ghcup --version
Expand All @@ -144,4 +129,3 @@ jobs:
run: cabal build all --dry-run --project-file=cabal.project.release
- name: Check Release with Latest Hackage
run: cabal build all --dry-run --project-file=cabal.project.release --index-state="hackage.haskell.org HEAD"

0 comments on commit 8b3d500

Please sign in to comment.