Skip to content

Commit 66b7307

Browse files
committed
Try to use Cabal in GitHub Actions
1 parent 28b7f3a commit 66b7307

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

.github/workflows/main.yml

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
env:
2-
cache_generation: 2021-06-22
2+
cache_generation: 2023-06-12
3+
ghc_version: 9.0.2
34

45
# NOTE: Please keep .mergify.yml in sync when adding or removing any jobs.
56
name: main
@@ -37,11 +38,11 @@ jobs:
3738
- name: "Cache"
3839
uses: actions/cache@v3
3940
with:
40-
key: ${{ matrix.os.runner }}-${{ hashFiles('stack.yaml') }}-${{ env.cache_generation }}
41+
key: ${{ matrix.os.runner }}-${{ env.ghc_version }}-${{ hashFiles('**/cabal.project', '**/cabal.project.freeze', '**/*.cabal') }}-${{ env.cache_generation }}
4142
restore-keys: |
42-
${{ matrix.os.runner }}-
43+
${{ matrix.os.runner }}-${{ env.ghc_version }}-
4344
path: |
44-
${{ steps.setup-haskell-cabal.outputs.stack-root }}
45+
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
4546
- name: Install libsodium
4647
shell: bash
4748
run: |
@@ -68,10 +69,7 @@ jobs:
6869
continue
6970
fi
7071
71-
# We use --test --no-run-tests to avoid re-building all the local packages in the
72-
# subsequent test step.
73-
# See https://github.com/commercialhaskell/stack/issues/4977.
74-
stack build --test --no-run-tests --copy-bins --local-bin-path ./bin "${package}"
72+
cabal install --enable-test --install-method=copy --installdir=./bin "${package}"
7573
done
7674
- name: "Run tests"
7775
shell: bash
@@ -93,7 +91,7 @@ jobs:
9391
continue
9492
fi
9593
96-
stack test "${package}"
94+
cabal test "${package}"
9795
done
9896
- name: "Prepare packaging"
9997
shell: bash
@@ -122,7 +120,7 @@ jobs:
122120
123121
function package() (
124122
local package="${1}"
125-
local version="$(stack query locals "${package}" version)"
123+
local version="$(jq -r ".\"install-plan\"[] | select(.\"pkg-name\" == \"${package}\") | .\"pkg-version\"" < dist-newstyle/cache/plan.json | head -n 1)"
126124
shift
127125
local assets=("${@}")
128126
local package_file="${package}-${version}-${architecture}-${{runner.os}}.${{ matrix.os.file-extension }}"

0 commit comments

Comments
 (0)