Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 1a4dd8f

Browse files
committed
Use custom cabal.project-${ghcVersion} if exists
1 parent a66c6e7 commit 1a4dd8f

File tree

5 files changed

+40
-21
lines changed

5 files changed

+40
-21
lines changed

.azure/linux-cabal.bashrc

+6
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
if [ -z "$PROJECT_FILE" ]; then
2+
export PROJECT_FILE="cabal.project"
3+
if [ -f "cabal.project-$GHC_VERSION" ]; then
4+
export PROJECT_FILE="cabal.project-$GHC_VERSION"
5+
fi
6+
fi
17
export PATH=$HOME/.cabal/bin:/opt/cabal/$CABAL_VERSION/bin:/opt/ghc/$GHC_VERSION/bin:$HOME/.local/bin:$PATH

.azure/linux-cabal.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ jobs:
4545
displayName: Update cabal
4646
- bash: |
4747
source .azure/linux-cabal.bashrc
48-
cabal v2-build --disable-tests --disable-benchmarks --only-dependencies
48+
cabal v2-build --disable-tests --disable-benchmarks --only-dependencies --project-file $PROJECT_FILE
4949
displayName: Build dependencies
5050
- bash: |
5151
source .azure/linux-cabal.bashrc
52-
cabal v2-build --disable-tests --disable-benchmarks
52+
cabal v2-build --disable-tests --disable-benchmarks --project-file $PROJECT_FILE
5353
displayName: Build `hie`
5454
- bash: |
5555
source .azure/linux-cabal.bashrc
56-
cabal v2-install # `hie` binary required locally for tests
56+
cabal v2-install --project-file $PROJECT_FILE # `hie` binary required locally for tests
5757
displayName: Install `hie`
5858
- bash: |
5959
source .azure/linux-cabal.bashrc
60-
cabal v2-build --enable-tests --enable-benchmarks --only-dependencies
60+
cabal v2-build --enable-tests --enable-benchmarks --only-dependencies --project-file $PROJECT_FILE
6161
displayName: Build Test-dependencies
6262
- bash: |
6363
sudo apt update
@@ -70,20 +70,20 @@ jobs:
7070
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
7171
- bash: |
7272
source .azure/linux-cabal.bashrc
73-
cabal v2-build hoogle
74-
cabal v2-exec hoogle generate
73+
cabal v2-build hoogle --project-file $PROJECT_FILE
74+
cabal v2-exec hoogle generate --project-file $PROJECT_FILE
7575
displayName: "Install Runtime Test-Dependencies: hoogle database"
7676
- bash: |
7777
source .azure/linux-cabal.bashrc
78-
cabal v2-test :unit-test
78+
cabal v2-test :unit-test --project-file $PROJECT_FILE
7979
displayName: "Run Test: unit-test"
8080
- bash: |
8181
source .azure/linux-cabal.bashrc
82-
cabal v2-test :dispatcher-test :plugin-dispatcher-test :wrapper-test
82+
cabal v2-test :dispatcher-test :plugin-dispatcher-test :wrapper-test --project-file $PROJECT_FILE
8383
displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test"
8484
- bash: |
8585
source .azure/linux-cabal.bashrc
86-
cabal v2-test :func-test
86+
cabal v2-test :func-test --project-file $PROJECT_FILE
8787
displayName: "Run Test: func-test"
8888
- bash: |
8989
mkdir -p .azure-cache

.azure/macos-cabal.bashrc

+6
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
if [ -z "$PROJECT_FILE" ]; then
2+
export PROJECT_FILE="cabal.project"
3+
if [ -f "cabal.project-$GHC_VERSION" ]; then
4+
export PROJECT_FILE="cabal.project-$GHC_VERSION"
5+
fi
6+
fi
17
export CABAL_ROOT=$HOME/.cabal
28
export PATH=$CABAL_ROOT/bin:$PATH

.azure/windows-cabal.bashrc

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
if [ -z "$PROJECT_FILE" ]; then
2+
export PROJECT_FILE="cabal.project"
3+
if [ -f "cabal.project-$GHC_VERSION" ]; then
4+
export PROJECT_FILE="cabal.project-$GHC_VERSION"
5+
fi
6+
fi
17
if [ -z "$CABAL_DIR" ]; then
28
CABAL_DIR="$APPDATA\\cabal"
39
fi

.azure/windows-cabal.yml

+13-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ jobs:
55
vmImage: windows-2019
66
strategy:
77
matrix:
8-
# It still is not in chocolatey
8+
# ghc versions 8.8.1 and 8.8.2 are not usable in windows
9+
# due to https://gitlab.haskell.org/ghc/ghc/issues/17575
910
# ghc-8.8.2:
1011
# GHC_VERSION: "8.8.2"
1112
ghc-8.6.5:
@@ -51,28 +52,28 @@ jobs:
5152
displayName: Install cabal
5253
- bash: |
5354
source .azure/windows-cabal.bashrc
54-
cabal v2-update
55+
cabal v2-update --project-file $PROJECT_FILE
5556
echo "store-dir: $CABAL_STORE_DIR" >> $CABAL_ROOT/config
5657
echo "overwrite-policy: always" >> $CABAL_ROOT/config
5758
displayName: Update cabal
5859
- bash: |
5960
source .azure/windows-cabal.bashrc
60-
cabal v2-build all --disable-tests --disable-benchmarks --only-dependencies
61+
cabal v2-build all --disable-tests --disable-benchmarks --only-dependencies --project-file $PROJECT_FILE
6162
displayName: Build dependencies
6263
- bash: |
6364
source .azure/windows-cabal.bashrc
64-
cabal v2-build all --disable-tests --disable-benchmarks
65+
cabal v2-build all --disable-tests --disable-benchmarks --project-file $PROJECT_FILE
6566
displayName: Build `hie`
6667
- bash: |
6768
source .azure/windows-cabal.bashrc
6869
# `hie` binary required locally for tests
6970
# we have to use a separate store for install and builds
7071
# to workaround https://github.com/haskell/cabal/issues/6483
71-
cabal --store-dir ${CABAL_STORE_DIR}i v2-install
72+
cabal --store-dir ${CABAL_STORE_DIR}i v2-install --project-file $PROJECT_FILE
7273
displayName: Install `hie`
7374
- bash: |
7475
source .azure/windows-cabal.bashrc
75-
cabal v2-build all --enable-tests --enable-benchmarks --only-dependencies
76+
cabal v2-build all --enable-tests --enable-benchmarks --only-dependencies --project-file $PROJECT_FILE
7677
displayName: Build Test-dependencies
7778
- bash: |
7879
mkdir -p /usr/local
@@ -88,31 +89,31 @@ jobs:
8889
displayName: "Install Runtime Test-Dependencies: liquidhaskell"
8990
- bash: |
9091
source .azure/windows-cabal.bashrc
91-
cabal v2-build hoogle
92-
cabal v2-exec hoogle generate
92+
cabal v2-build hoogle --project-file $PROJECT_FILE
93+
cabal v2-exec hoogle generate --project-file $PROJECT_FILE
9394
displayName: "Install Runtime Test-Dependencies: hoogle database"
9495
- bash: |
9596
curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip
9697
unzip -o /usr/bin/stack.zip -d /usr/bin/
9798
mkdir -p "$STACK_ROOT"
98-
# If we don't install the ghc used in test projects in advance, tests fail
99+
# If we don't install the ghc used in test projects in advance, tests fail
99100
stack setup --stack-yaml stack-${GHC_VERSION}.yaml
100101
displayName: "Install Runtime Unit Test-Dependencies: stack"
101102
- bash: |
102103
source .azure/windows-cabal.bashrc
103-
cabal v2-test :unit-test
104+
cabal v2-test :unit-test --project-file $PROJECT_FILE
104105
displayName: "Run Test: unit-test"
105106
- bash: |
106107
source .azure/windows-cabal.bashrc
107108
# Needed for wrapper-test
108109
stack setup --stack-yaml stack-8.8.1.yaml
109110
stack setup --stack-yaml stack-8.6.5.yaml
110111
# TODO Enable :dispatcher-test suite
111-
cabal v2-test :plugin-dispatcher-test :wrapper-test # :dispatcher-test
112+
cabal v2-test :plugin-dispatcher-test :wrapper-test # :dispatcher-test --project-file $PROJECT_FILE
112113
displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test"
113114
- bash: |
114115
source .azure/windows-cabal.bashrc
115-
cabal v2-test :func-test
116+
cabal v2-test :func-test --project-file $PROJECT_FILE
116117
displayName: "Run Test: func-test"
117118
- bash: |
118119
source .azure/windows-cabal.bashrc

0 commit comments

Comments
 (0)