Skip to content

Commit d2bedea

Browse files
committed
CI: remove dependency on cabal-plan (#8891)
1 parent 2ebcbe2 commit d2bedea

File tree

3 files changed

+26
-55
lines changed

3 files changed

+26
-55
lines changed

.github/workflows/validate.yml

+2-23
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,6 @@ jobs:
7878
run: |
7979
git config --global protocol.file.allow always
8080
81-
# The '+exe' constraint below is important, otherwise cabal-install
82-
# might decide to build the library but not the executable which is
83-
# what we need.
84-
- name: Install cabal-plan
85-
run: |
86-
cd $(mktemp -d)
87-
cabal install cabal-plan --allow-newer="base" --constraint='cabal-plan +exe'
88-
echo "$HOME/.cabal/bin:$HOME/.local/bin" >> $GITHUB_PATH
89-
9081
# The tool is not essential to the rest of the test suite. If
9182
# hackage-repo-tool is not present, any test that requires it will
9283
# be skipped.
@@ -132,11 +123,11 @@ jobs:
132123
- name: Tar cabal head executable
133124
if: matrix.ghc == env.GHC_FOR_RELEASE
134125
run: |
135-
CABAL_EXEC=$(cabal-plan list-bin --builddir=dist-newstyle-validate-ghc-${{ matrix.ghc }} cabal-install:exe:cabal)
126+
CABAL_EXEC=$(cabal list-bin --builddir=dist-newstyle-validate-ghc-${{ matrix.ghc }} --project-file=cabal.project.validate cabal-install:exe:cabal)
136127
# We have to tar the executable to preserve executable permissions
137128
# see https://github.com/actions/upload-artifact/issues/38
138129
if [[ ${{ runner.os }} == 'Windows' ]]; then
139-
# `cabal-plan` gives us a windows path but tar needs the posix one
130+
# `cabal list-bin` gives us a windows path but tar needs the posix one
140131
CABAL_EXEC=$(cygpath $CABAL_EXEC)
141132
fi
142133
if [[ "${{ runner.os }}" == "macOS" ]]; then
@@ -235,12 +226,6 @@ jobs:
235226
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
236227
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
237228

238-
- name: Install cabal-plan
239-
run: |
240-
cd $(mktemp -d)
241-
cabal install cabal-plan --allow-newer="base" --constraint='cabal-plan +exe'
242-
echo "$HOME/.cabal/bin:$HOME/.local/bin" >> $GITHUB_PATH
243-
244229
- name: Validate build
245230
run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build
246231

@@ -283,12 +268,6 @@ jobs:
283268
ghc-version: ${{ matrix.ghc }}
284269
cabal-version: latest # default, we are not using it in this job
285270

286-
- name: Install cabal-plan
287-
run: |
288-
cd $(mktemp -d)
289-
cabal install cabal-plan --allow-newer="base" --constraint='cabal-plan +exe'
290-
echo "$HOME/.cabal/bin:$HOME/.local/bin" >> $GITHUB_PATH
291-
292271
- name: Download cabal executable from workflow artifacts
293272
uses: actions/download-artifact@v3
294273
with:

Makefile

+4-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ $(TEMPLATE_PATHS) : templates/Paths_pkg.template.hs cabal-dev-scripts/src/GenPat
5757

5858
buildinfo-fields-reference : phony
5959
cabal build --builddir=dist-newstyle-bi --project-file=cabal.project.buildinfo buildinfo-reference-generator
60-
$$(cabal-plan list-bin --builddir=dist-newstyle-bi buildinfo-reference-generator) buildinfo-reference-generator/template.zinza | tee $@
60+
$$(cabal list-bin --builddir=dist-newstyle-bi buildinfo-reference-generator) buildinfo-reference-generator/template.zinza | tee $@
6161

6262
# analyse-imports
6363
analyse-imports : phony
@@ -113,24 +113,22 @@ hackage-roundtrip-tests :
113113
$(CABALRUN) hackage-tests -- roundtrip +RTS -s -qg -I0 -A64M -N${THREADS} -RTS ${TEST}
114114

115115
cabal-install-test:
116-
@which cabal-plan
117116
$(CABALBUILD) -j3 cabal-tests cabal
118117
rm -rf .ghc.environment.*
119-
cd cabal-testsuite && `cabal-plan list-bin cabal-tests` --with-cabal=`cabal-plan list-bin cabal` --hide-successes -j3 ${TEST}
118+
cd cabal-testsuite && `cabal list-bin cabal-tests` --with-cabal=`cabal list-bin cabal` --hide-successes -j3 ${TEST}
120119

121120
# hackage-benchmarks (solver)
122121

123122
hackage-benchmarks-run:
124123
$(CABALBUILD) -j3 hackage-benchmark cabal
125124
rm -rf .ghc.environment.*
126-
$$(cabal-plan list-bin hackage-benchmark) --cabal1=cabal --cabal2=$$(cabal-plan list-bin cabal) --packages="hakyll servant-auth-server" --print-trials --concurrently
125+
$$(cabal list-bin hackage-benchmark) --cabal1=cabal --cabal2=$$(cabal list-bin cabal) --packages="hakyll servant-auth-server" --print-trials --concurrently
127126

128127

129128
# This doesn't run build, as you first need to test with cabal-install-test :)
130129
cabal-install-test-accept:
131-
@which cabal-plan
132130
rm -rf .ghc.environment.*
133-
cd cabal-testsuite && `cabal-plan list-bin cabal-tests` --with-cabal=`cabal-plan list-bin cabal` --hide-successes -j3 --accept ${TEST}
131+
cd cabal-testsuite && `cabal list-bin cabal-tests` --with-cabal=`cabal list-bin cabal` --hide-successes -j3 --accept ${TEST}
134132

135133
# Docker validation
136134

validate.sh

+20-26
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See https://github.com/haskell/cabal/issues/8049
1313
HC=ghc
1414
CABAL=cabal
15-
CABALPLAN=cabal-plan
1615
JOBS=4
1716
LIBTESTS=true
1817
CLITESTS=true
@@ -50,7 +49,6 @@ Available options:
5049
--(no-)run-cli-suite Run cabal-testsuite with client
5150
-w, --with-compiler HC With compiler
5251
--with-cabal CABAL With cabal-install
53-
--with-cabal-plan CABALPLAN With cabal-plan
5452
--extra-hc HC Extra compiler to run test-suite with
5553
--(no-)doctest Run doctest on library
5654
--(no-)solver-benchmarks Build and trial run solver-benchmarks
@@ -196,11 +194,6 @@ while [ $# -gt 0 ]; do
196194
shift
197195
shift
198196
;;
199-
--with-cabal-plan)
200-
CABALPLAN=$2
201-
shift
202-
shift
203-
;;
204197
--extra-hc)
205198
EXTRAHCS="$EXTRAHCS $2"
206199
shift
@@ -315,7 +308,7 @@ BUILDDIR=dist-newstyle-validate-$BASEHC
315308
CABAL_TESTSUITE_BDIR="$(pwd)/$BUILDDIR/build/$ARCH/$BASEHC/cabal-testsuite-3"
316309

317310
CABALNEWBUILD="${CABAL} v2-build $JOBS -w $HC --builddir=$BUILDDIR --project-file=$PROJECTFILE"
318-
CABALPLANLISTBIN="${CABALPLAN} list-bin --builddir=$BUILDDIR"
311+
CABALLISTBIN="${CABAL} list-bin --builddir=$BUILDDIR --project-file=$PROJECTFILE"
319312

320313
# header
321314
#######################################################################
@@ -327,7 +320,6 @@ cat <<EOF
327320
compiler: $HC
328321
runhaskell: $RUNHASKELL
329322
cabal-install: $CABAL
330-
cabal-plan: $CABALPLAN
331323
jobs: $JOBS
332324
Cabal tests: $LIBTESTS
333325
cabal-install tests: $CLITESTS
@@ -347,7 +339,6 @@ print_header print-tool-versions
347339

348340
timed $HC --version
349341
timed $CABAL --version
350-
timed $CABALPLAN --version
351342

352343
for EXTRAHC in $EXTRAHCS; do
353344
timed $EXTRAHC --version
@@ -368,8 +359,11 @@ step_time_summary() {
368359

369360
step_build() {
370361
print_header "build"
362+
print_header "Step Build: dry run"
371363
timed $CABALNEWBUILD $TARGETS --dry-run || exit 1
372-
$CABALPLAN topo --builddir=$BUILDDIR || exit 1
364+
print_header "Step Build: full build plan (cached and to-be-built dependencies):"
365+
jq -r '."install-plan" | map(."pkg-name" + "-" + ."pkg-version" + " " + ."component-name") | join("\n")' "$BUILDDIR/cache/plan.json"
366+
print_header "Step Build: actual build"
373367
timed $CABALNEWBUILD $TARGETS || exit 1
374368
}
375369

@@ -386,22 +380,22 @@ timed doctest -package-env=doctest-Cabal --fast Cabal/Distribution Cabal/Languag
386380
step_lib_tests() {
387381
print_header "Cabal: tests"
388382

389-
CMD="$($CABALPLANLISTBIN Cabal-tests:test:unit-tests) $TESTSUITEJOBS --hide-successes --with-ghc=$HC"
383+
CMD="$($CABALLISTBIN Cabal-tests:test:unit-tests) $TESTSUITEJOBS --hide-successes --with-ghc=$HC"
390384
(cd Cabal-tests && timed $CMD) || exit 1
391385

392-
CMD="$($CABALPLANLISTBIN Cabal-tests:test:check-tests) $TESTSUITEJOBS --hide-successes"
386+
CMD="$($CABALLISTBIN Cabal-tests:test:check-tests) $TESTSUITEJOBS --hide-successes"
393387
(cd Cabal-tests && timed $CMD) || exit 1
394388

395-
CMD="$($CABALPLANLISTBIN Cabal-tests:test:parser-tests) $TESTSUITEJOBS --hide-successes"
389+
CMD="$($CABALLISTBIN Cabal-tests:test:parser-tests) $TESTSUITEJOBS --hide-successes"
396390
(cd Cabal-tests && timed $CMD) || exit 1
397391

398-
CMD="$($CABALPLANLISTBIN Cabal-tests:test:rpmvercmp) $TESTSUITEJOBS --hide-successes"
392+
CMD="$($CABALLISTBIN Cabal-tests:test:rpmvercmp) $TESTSUITEJOBS --hide-successes"
399393
(cd Cabal-tests && timed $CMD) || exit 1
400394

401-
CMD="$($CABALPLANLISTBIN Cabal-tests:test:no-thunks-test) $TESTSUITEJOBS --hide-successes"
395+
CMD="$($CABALLISTBIN Cabal-tests:test:no-thunks-test) $TESTSUITEJOBS --hide-successes"
402396
(cd Cabal-tests && timed $CMD) || exit 1
403397

404-
CMD=$($CABALPLANLISTBIN Cabal-tests:test:hackage-tests)
398+
CMD=$($CABALLISTBIN Cabal-tests:test:hackage-tests)
405399
(cd Cabal-tests && timed $CMD read-fields) || exit 1
406400
if $HACKAGETESTSALL; then
407401
(cd Cabal-tests && timed $CMD parsec) || exit 1
@@ -418,14 +412,14 @@ fi
418412
step_lib_suite() {
419413
print_header "Cabal: cabal-testsuite"
420414

421-
CMD="$($CABALPLANLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR $TESTSUITEJOBS --with-ghc=$HC --hide-successes"
415+
CMD="$($CABALLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR $TESTSUITEJOBS --with-ghc=$HC --hide-successes"
422416
(cd cabal-testsuite && timed $CMD) || exit 1
423417
}
424418

425419
step_lib_suite_extras() {
426420
for EXTRAHC in $EXTRAHCS; do
427421

428-
CMD="$($CABALPLANLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR $TESTSUITEJOBS --with-ghc=$EXTRAHC --hide-successes"
422+
CMD="$($CABALLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR $TESTSUITEJOBS --with-ghc=$EXTRAHC --hide-successes"
429423
(cd cabal-testsuite && timed $CMD) || exit 1
430424

431425
done
@@ -438,19 +432,19 @@ step_cli_tests() {
438432
print_header "cabal-install: tests"
439433

440434
# this are sorted in asc time used, quicker tests first.
441-
CMD="$($CABALPLANLISTBIN cabal-install:test:long-tests) $TESTSUITEJOBS --hide-successes"
435+
CMD="$($CABALLISTBIN cabal-install:test:long-tests) $TESTSUITEJOBS --hide-successes"
442436
(cd cabal-install && timed $CMD) || exit 1
443437

444438
# This doesn't work in parallel either
445-
CMD="$($CABALPLANLISTBIN cabal-install:test:unit-tests) -j1 --hide-successes"
439+
CMD="$($CABALLISTBIN cabal-install:test:unit-tests) -j1 --hide-successes"
446440
(cd cabal-install && timed $CMD) || exit 1
447441

448442
# Only single job, otherwise we fail with "Heap exhausted"
449-
CMD="$($CABALPLANLISTBIN cabal-install:test:mem-use-tests) -j1 --hide-successes"
443+
CMD="$($CABALLISTBIN cabal-install:test:mem-use-tests) -j1 --hide-successes"
450444
(cd cabal-install && timed $CMD) || exit 1
451445

452446
# This test-suite doesn't like concurrency
453-
CMD="$($CABALPLANLISTBIN cabal-install:test:integration-tests2) -j1 --hide-successes --with-ghc=$HC"
447+
CMD="$($CABALLISTBIN cabal-install:test:integration-tests2) -j1 --hide-successes --with-ghc=$HC"
454448
(cd cabal-install && timed $CMD) || exit 1
455449
}
456450

@@ -460,7 +454,7 @@ CMD="$($CABALPLANLISTBIN cabal-install:test:integration-tests2) -j1 --hide-succe
460454
step_cli_suite() {
461455
print_header "cabal-install: cabal-testsuite"
462456

463-
CMD="$($CABALPLANLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR --with-cabal=$($CABALPLANLISTBIN cabal-install:exe:cabal) $TESTSUITEJOBS --with-ghc=$HC --hide-successes"
457+
CMD="$($CABALLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUITE_BDIR --with-cabal=$($CABALLISTBIN cabal-install:exe:cabal) $TESTSUITEJOBS --with-ghc=$HC --hide-successes"
464458
(cd cabal-testsuite && timed $CMD) || exit 1
465459
}
466460

@@ -470,15 +464,15 @@ CMD="$($CABALPLANLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TEST
470464
step_solver_benchmarks_tests() {
471465
print_header "solver-benchmarks: test"
472466

473-
CMD="$($CABALPLANLISTBIN solver-benchmarks:test:unit-tests)"
467+
CMD="$($CABALLISTBIN solver-benchmarks:test:unit-tests)"
474468
(cd Cabal && timed $CMD) || exit 1
475469
}
476470

477471
step_solver_benchmarks_run() {
478472
print_header "solver-benchmarks: run"
479473

480474
SOLVEPKG=Chart-diagrams
481-
CMD="$($CABALPLANLISTBIN solver-benchmarks:exe:hackage-benchmark) --cabal1=$CABAL --cabal2=$($CABALPLANLISTBIN cabal-install:exe:cabal) --trials=5 --packages=$SOLVEPKG --print-trials"
475+
CMD="$($CABALLISTBIN solver-benchmarks:exe:hackage-benchmark) --cabal1=$CABAL --cabal2=$($CABALLISTBIN cabal-install:exe:cabal) --trials=5 --packages=$SOLVEPKG --print-trials"
482476
(cd Cabal && timed $CMD) || exit 1
483477
}
484478

0 commit comments

Comments
 (0)