Skip to content

Commit 506d119

Browse files
committed
Revert "CI: remove dependency on cabal-plan (#8891)"
This reverts commit e159a12.
1 parent e159a12 commit 506d119

File tree

3 files changed

+55
-26
lines changed

3 files changed

+55
-26
lines changed

.github/workflows/validate.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ 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+
8190
# The tool is not essential to the rest of the test suite. If
8291
# hackage-repo-tool is not present, any test that requires it will
8392
# be skipped.
@@ -123,11 +132,11 @@ jobs:
123132
- name: Tar cabal head executable
124133
if: matrix.ghc == env.GHC_FOR_RELEASE
125134
run: |
126-
CABAL_EXEC=$(cabal list-bin --builddir=dist-newstyle-validate-ghc-${{ matrix.ghc }} --project-file=cabal.project.validate cabal-install:exe:cabal)
135+
CABAL_EXEC=$(cabal-plan list-bin --builddir=dist-newstyle-validate-ghc-${{ matrix.ghc }} cabal-install:exe:cabal)
127136
# We have to tar the executable to preserve executable permissions
128137
# see https://github.com/actions/upload-artifact/issues/38
129138
if [[ ${{ runner.os }} == 'Windows' ]]; then
130-
# `cabal list-bin` gives us a windows path but tar needs the posix one
139+
# `cabal-plan` gives us a windows path but tar needs the posix one
131140
CABAL_EXEC=$(cygpath $CABAL_EXEC)
132141
fi
133142
if [[ "${{ runner.os }}" == "macOS" ]]; then
@@ -226,6 +235,12 @@ jobs:
226235
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
227236
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
228237

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+
229244
- name: Validate build
230245
run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build
231246

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

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+
271292
- name: Download cabal executable from workflow artifacts
272293
uses: actions/download-artifact@v3
273294
with:

Makefile

+6-4
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 list-bin --builddir=dist-newstyle-bi buildinfo-reference-generator) buildinfo-reference-generator/template.zinza | tee $@
60+
$$(cabal-plan list-bin --builddir=dist-newstyle-bi buildinfo-reference-generator) buildinfo-reference-generator/template.zinza | tee $@
6161

6262
# analyse-imports
6363
analyse-imports : phony
@@ -113,22 +113,24 @@ 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
116117
$(CABALBUILD) -j3 cabal-tests cabal
117118
rm -rf .ghc.environment.*
118-
cd cabal-testsuite && `cabal list-bin cabal-tests` --with-cabal=`cabal list-bin cabal` --hide-successes -j3 ${TEST}
119+
cd cabal-testsuite && `cabal-plan list-bin cabal-tests` --with-cabal=`cabal-plan list-bin cabal` --hide-successes -j3 ${TEST}
119120

120121
# hackage-benchmarks (solver)
121122

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

127128

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

133135
# Docker validation
134136

validate.sh

+26-20
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See https://github.com/haskell/cabal/issues/8049
1313
HC=ghc
1414
CABAL=cabal
15+
CABALPLAN=cabal-plan
1516
JOBS=4
1617
LIBTESTS=true
1718
CLITESTS=true
@@ -49,6 +50,7 @@ Available options:
4950
--(no-)run-cli-suite Run cabal-testsuite with client
5051
-w, --with-compiler HC With compiler
5152
--with-cabal CABAL With cabal-install
53+
--with-cabal-plan CABALPLAN With cabal-plan
5254
--extra-hc HC Extra compiler to run test-suite with
5355
--(no-)doctest Run doctest on library
5456
--(no-)solver-benchmarks Build and trial run solver-benchmarks
@@ -194,6 +196,11 @@ while [ $# -gt 0 ]; do
194196
shift
195197
shift
196198
;;
199+
--with-cabal-plan)
200+
CABALPLAN=$2
201+
shift
202+
shift
203+
;;
197204
--extra-hc)
198205
EXTRAHCS="$EXTRAHCS $2"
199206
shift
@@ -308,7 +315,7 @@ BUILDDIR=dist-newstyle-validate-$BASEHC
308315
CABAL_TESTSUITE_BDIR="$(pwd)/$BUILDDIR/build/$ARCH/$BASEHC/cabal-testsuite-3"
309316

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

313320
# header
314321
#######################################################################
@@ -320,6 +327,7 @@ cat <<EOF
320327
compiler: $HC
321328
runhaskell: $RUNHASKELL
322329
cabal-install: $CABAL
330+
cabal-plan: $CABALPLAN
323331
jobs: $JOBS
324332
Cabal tests: $LIBTESTS
325333
cabal-install tests: $CLITESTS
@@ -339,6 +347,7 @@ print_header print-tool-versions
339347

340348
timed $HC --version
341349
timed $CABAL --version
350+
timed $CABALPLAN --version
342351

343352
for EXTRAHC in $EXTRAHCS; do
344353
timed $EXTRAHC --version
@@ -359,11 +368,8 @@ step_time_summary() {
359368

360369
step_build() {
361370
print_header "build"
362-
print_header "Step Build: dry run"
363371
timed $CABALNEWBUILD $TARGETS --dry-run || 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"
372+
$CABALPLAN topo --builddir=$BUILDDIR || exit 1
367373
timed $CABALNEWBUILD $TARGETS || exit 1
368374
}
369375

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

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

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

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

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

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

398-
CMD=$($CABALLISTBIN Cabal-tests:test:hackage-tests)
404+
CMD=$($CABALPLANLISTBIN Cabal-tests:test:hackage-tests)
399405
(cd Cabal-tests && timed $CMD read-fields) || exit 1
400406
if $HACKAGETESTSALL; then
401407
(cd Cabal-tests && timed $CMD parsec) || exit 1
@@ -412,14 +418,14 @@ fi
412418
step_lib_suite() {
413419
print_header "Cabal: cabal-testsuite"
414420

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

419425
step_lib_suite_extras() {
420426
for EXTRAHC in $EXTRAHCS; do
421427

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

425431
done
@@ -432,19 +438,19 @@ step_cli_tests() {
432438
print_header "cabal-install: tests"
433439

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

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

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

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

@@ -454,7 +460,7 @@ CMD="$($CABALLISTBIN cabal-install:test:integration-tests2) -j1 --hide-successes
454460
step_cli_suite() {
455461
print_header "cabal-install: cabal-testsuite"
456462

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"
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"
458464
(cd cabal-testsuite && timed $CMD) || exit 1
459465
}
460466

@@ -464,15 +470,15 @@ CMD="$($CABALLISTBIN cabal-testsuite:exe:cabal-tests) --builddir=$CABAL_TESTSUIT
464470
step_solver_benchmarks_tests() {
465471
print_header "solver-benchmarks: test"
466472

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

471477
step_solver_benchmarks_run() {
472478
print_header "solver-benchmarks: run"
473479

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

0 commit comments

Comments
 (0)