diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-01-30 20:59:54 +0100 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2019-01-30 21:30:29 +0100 |
commit | e16f4c165d45368416cf6b064ada9ebdb12f9a90 (patch) | |
tree | de290282fb2857c84aae51f5438ff24d23a0339b | |
parent | bf9e458fd74a9d187be6929c212e46b341b05c8c (diff) |
ci: Move stack install logic into seperate script
-rwxr-xr-x | scripts/ci/install-stack.sh | 27 | ||||
-rw-r--r-- | scripts/ci/steps/25-deps.sh | 24 |
2 files changed, 28 insertions, 23 deletions
diff --git a/scripts/ci/install-stack.sh b/scripts/ci/install-stack.sh new file mode 100755 index 0000000..7be2700 --- /dev/null +++ b/scripts/ci/install-stack.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +BINDIR="$1"; shift + +cabal v2-install \ + --symlink-bindir="$BINDIR" \ + --constraint "network < 3" \ + --package-env=/dev/null \ + hpack || exit 1 + +stack_dir="$(mktemp --tmpdir -d "install-stack.XXXXXXXXX")" +trap 'rm -rf '"$stack_dir" 0 2 15 + +git clone \ + --depth=1 \ + --branch=stable \ + https://github.com/commercialhaskell/stack "$stack_dir" || exit 1 + +( + cd "$stack_dir" + "$BINDIR/hpack" + cabal v2-install \ + --symlink-bindir="$BINDIR" \ + --constraint "Cabal == 2.4.0.1" \ + --constraint "network < 3" . \ + --package-env=/dev/null || exit 1 +) || exit 1 diff --git a/scripts/ci/steps/25-deps.sh b/scripts/ci/steps/25-deps.sh index 3a0cb21..69e5ef3 100644 --- a/scripts/ci/steps/25-deps.sh +++ b/scripts/ci/steps/25-deps.sh @@ -18,29 +18,7 @@ ghc_ver=$(ghc --numeric-version) if verlte "$stack_ver" 1.9.3 && verlte 8.2.2 "$ghc_ver" then + "$CI_SCRIPTS_DIR"/install-stack.sh "$build_dir/bin" PATH="$build_dir/bin:$PATH" export PATH - - cabal v2-install \ - --symlink-bindir="$build_dir/bin" \ - --constraint "network < 3" \ - --package-env=/dev/null \ - hpack || exit 1 - - stack_dir="$(mktemp --tmpdir -d "cabal-helper.stacksrcXXXXXXXXX")" - - git clone \ - --depth=1 \ - --branch=stable \ - https://github.com/commercialhaskell/stack "$stack_dir" || exit 1 - - ( - cd "$stack_dir" - hpack - cabal v2-install \ - --symlink-bindir="$build_dir/bin" \ - --constraint "Cabal == 2.4.0.1" \ - --constraint "network < 3" . \ - --package-env=/dev/null || exit 1 - ) || exit 1 fi |