Skip to content

Commit e4aea62

Browse files
authored
Merge pull request #5265 from commercialhaskell/fix-nix-install
Load Nix correctly, fail early
2 parents fce0ec0 + a23db28 commit e4aea62

File tree

4 files changed

+32
-34
lines changed

4 files changed

+32
-34
lines changed

.azure/azure-linux-template.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,6 @@ jobs:
3636
./etc/scripts/get-hlint.sh
3737
export PATH="$(pwd)"/hlint:$PATH
3838
;;
39-
cabal)
40-
sudo add-apt-repository -y ppa:hvr/ghc
41-
sudo apt-get update
42-
sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER
43-
# See note here: https://github.com/haskell-CI/haskell-ci#alex--happy-with-ghc--78
44-
if [ "$GHCVER" = "head" ] || [ "${GHCVER%.*}" = "7.8" ] || [ "${GHCVER%.*}" = "7.10" ]; then
45-
sudo apt-get install happy-1.19.4 alex-3.1.3
46-
export PATH=/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:$PATH
47-
else
48-
sudo apt-get install happy alex
49-
fi
50-
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
51-
cabal --version
52-
cabal update
53-
PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
54-
cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
55-
;;
5639
*)
5740
export PATH=$HOME/.local/bin:$PATH
5841
stack --install-ghc $ARGS test --bench --only-dependencies

.azure/azure-nightly-template-linux.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ jobs:
77
vmImage: ${{ parameters.vmImage }}
88
steps:
99
- script: |
10+
set -ex
11+
1012
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
1113
echo $STACK_ROOT
1214
mkdir -p ~/.local/bin
@@ -17,31 +19,39 @@ jobs:
1719
cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" restore stack work --base-branch="${BASE_BRANCH}"
1820
etc/scripts/ci-setup.sh
1921
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.7/bin:$PATH
22+
23+
set +ex
2024
env:
2125
OS_NAME: ${{ parameters.os }}
2226
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
2327
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
2428
displayName: 'Installation ${{parameters.os}}'
2529
- script: |
30+
set -ex
31+
2632
# Retry installing nix due to nondeterministic error
2733
# Fatal error: glibc detected an invalid stdio handle
2834
# See:
2935
# https://github.com/nh2/static-haskell-nix/pull/27#issuecomment-502652181
3036
# https://github.com/NixOS/nix/issues/2733
3137
(for i in {1..5}; do bash <(curl https://nixos.org/nix/install) && exit 0; done; exit 1)
32-
source ~/.profile
38+
. ~/.nix-profile/etc/profile.d/nix.sh
3339
nix-channel --add https://nixos.org/channels/nixos-19.09 nixpkgs
3440
nix-channel --update # Get GHC 8.2.2
3541
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
3642
export PATH=$HOME/.local/bin:$PATH;
3743
stack etc/scripts/release.hs check
44+
45+
set +ex
3846
displayName: Integration Test
3947
- script: |
48+
set -ex
49+
4050
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
4151
export PATH=$HOME/.local/bin:$PATH;
42-
set -ex
4352
stack etc/scripts/release.hs build
4453
cp _release/stack-* $(Build.ArtifactStagingDirectory)
54+
4555
set +ex
4656
displayName: Build bindist
4757
condition: in(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues', 'Failed')
@@ -51,6 +61,8 @@ jobs:
5161
artifactName: stack-linux
5262
condition: in(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues', 'Failed')
5363
- script: |
64+
set -ex
65+
5466
export PATH=$HOME/.local/bin:$PATH;
5567
export AWS_ACCESS_KEY_ID="$(AWS_ACCESS_KEY_ID)";
5668
export AWS_SECRET_ACCESS_KEY="$(AWS_SECRET_ACCESS_KEY)";
@@ -59,6 +71,8 @@ jobs:
5971
cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" save stack;
6072
fi;
6173
cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" save stack work
74+
75+
set +ex
6276
env:
6377
OS_NAME: ${{ parameters.os }}
6478
displayName: 'Cache data'

.azure/azure-nightly-template-osx.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ jobs:
77
vmImage: ${{ parameters.vmImage }}
88
steps:
99
- script: |
10+
set -ex
11+
1012
export AWS_ACCESS_KEY_ID="$(AWS_ACCESS_KEY_ID)";
1113
export AWS_SECRET_ACCESS_KEY="$(AWS_SECRET_ACCESS_KEY)";
1214
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
@@ -20,21 +22,31 @@ jobs:
2022
etc/scripts/ci-setup.sh
2123
brew install mercurial
2224
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.7/bin:$PATH
25+
26+
set +ex
2327
env:
2428
OS_NAME: ${{ parameters.os }}
2529
displayName: 'Installation ${{parameters.os}}'
2630
- script: |
31+
set -ex
32+
2733
curl https://nixos.org/nix/install | sh
2834
. ~/.nix-profile/etc/profile.d/nix.sh
2935
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
3036
export PATH=$HOME/.local/bin:$PATH;
3137
stack etc/scripts/release.hs check
38+
39+
set +ex
3240
displayName: Integration Test
3341
- script: |
42+
set -ex
43+
3444
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
3545
export PATH=$HOME/.local/bin:$PATH;
3646
stack etc/scripts/release.hs build
3747
cp _release/stack-* $(Build.ArtifactStagingDirectory)
48+
49+
set +ex
3850
condition: in(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues', 'Failed')
3951
displayName: Build bindist
4052
- task: PublishBuildArtifacts@1
@@ -43,6 +55,8 @@ jobs:
4355
artifactName: stack-osx
4456
condition: in(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues', 'Failed')
4557
- script: |
58+
set -ex
59+
4660
export PATH=$HOME/.local/bin:$PATH;
4761
export AWS_ACCESS_KEY_ID="$(AWS_ACCESS_KEY_ID)";
4862
export AWS_SECRET_ACCESS_KEY="$(AWS_SECRET_ACCESS_KEY)";
@@ -51,6 +65,8 @@ jobs:
5165
cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" save stack;
5266
fi;
5367
cache-s3 --prefix="${CACHE_S3_PREFIX}" --git-branch="$(Build.SourceBranchName)" --suffix="${OS_NAME}" save stack work
68+
69+
set +ex
5470
env:
5571
OS_NAME: ${{ parameters.os }}
5672
displayName: 'Cache data'

etc/scripts/ci-setup.sh

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,3 @@ if [ `uname` = "Darwin" ]; then
2323
else
2424
travis_retry fetch_stack_linux
2525
fi
26-
27-
case "$BUILD" in
28-
stack)
29-
# However, we only need stack to download GHC for stack builds.
30-
travis_retry stack --no-terminal setup;
31-
;;
32-
cabal)
33-
mkdir -p $HOME/.cabal
34-
cat > $HOME/.cabal/config <<EOF
35-
remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/
36-
remote-repo-cache: $HOME/.cabal/packages
37-
jobs: \$ncpus
38-
EOF
39-
;;
40-
esac

0 commit comments

Comments
 (0)