aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2017-09-19 21:51:35 +0200
committerDaniel Gröber <dxld@darkboxed.org>2017-09-19 22:00:56 +0200
commitb452f1bec5c041cffbc5160e7f90eaf6daab82a0 (patch)
tree6777a2a5aea5c67a9d5ada8cc5bb371d0495ca44 /scripts
parentf5dee82eed5ece2819b33b6bb41b990cdd407b39 (diff)
Adapt CI scripts for readonly sourcedir
Diffstat (limited to 'scripts')
-rw-r--r--scripts/ci/steps/00-config.sh10
-rw-r--r--scripts/ci/steps/10-dependencies.sh4
-rw-r--r--scripts/ci/steps/20-sdist.sh8
-rw-r--r--scripts/ci/steps/30-build.sh6
-rw-r--r--scripts/ci/steps/40-test.sh3
5 files changed, 19 insertions, 12 deletions
diff --git a/scripts/ci/steps/00-config.sh b/scripts/ci/steps/00-config.sh
new file mode 100644
index 0000000..b628abd
--- /dev/null
+++ b/scripts/ci/steps/00-config.sh
@@ -0,0 +1,10 @@
+if [ -w . ]; then
+ sandbox=./.cabal-sandbox
+ sandbox_config=./cabal.sandbox.config
+else
+ sandbox=$HOME/cabal-sandbox
+ sandbox_config=$HOME/cabal.sandbox.config
+fi
+
+source_dir="$(mktemp --tmpdir -d "cabal-helper.sdistXXXXXXXXX")"
+build_dir="$(mktemp --tmpdir -d "cabal-helper.distXXXXXXXXX")"
diff --git a/scripts/ci/steps/10-dependencies.sh b/scripts/ci/steps/10-dependencies.sh
index c506bb8..290cce2 100644
--- a/scripts/ci/steps/10-dependencies.sh
+++ b/scripts/ci/steps/10-dependencies.sh
@@ -1,3 +1,3 @@
cabal update
-cabal sandbox init
-cabal install --only-dependencies
+cabal --sandbox-config="$sandbox_config" sandbox init --sandbox="$sandbox"
+cabal --sandbox-config="$sandbox_config" install --only-dependencies
diff --git a/scripts/ci/steps/20-sdist.sh b/scripts/ci/steps/20-sdist.sh
index dd4554e..bd8fbe1 100644
--- a/scripts/ci/steps/20-sdist.sh
+++ b/scripts/ci/steps/20-sdist.sh
@@ -1,10 +1,6 @@
-source_dir="$(mktemp --tmpdir -d "cabal-helper.sdistXXXXXXXXX")"
mkdir -p "$source_dir"
+mkdir -p "$build_dir"
-cabal sdist --output-directory="$source_dir"
-
-if [ -e cabal.sandbox.config ]; then
- cp cabal.sandbox.config "$source_dir"
-fi
+cabal --sandbox-config="$sandbox_config" sdist --builddir="$build_dir" --output-directory="$source_dir"
cd "$source_dir"
diff --git a/scripts/ci/steps/30-build.sh b/scripts/ci/steps/30-build.sh
index 1f5e2ef..1dbaad7 100644
--- a/scripts/ci/steps/30-build.sh
+++ b/scripts/ci/steps/30-build.sh
@@ -1,3 +1,3 @@
-cabal configure --enable-tests
-cabal build
-cabal haddock
+cabal --sandbox-config="$sandbox_config" configure --builddir="$build_dir" --enable-tests
+cabal --sandbox-config="$sandbox_config" build --builddir="$build_dir"
+cabal --sandbox-config="$sandbox_config" haddock --builddir="$build_dir"
diff --git a/scripts/ci/steps/40-test.sh b/scripts/ci/steps/40-test.sh
index ee15c1f..ed813a6 100644
--- a/scripts/ci/steps/40-test.sh
+++ b/scripts/ci/steps/40-test.sh
@@ -1 +1,2 @@
-cabal test --show-details=direct
+cabal_helper_libexecdir="$build_dir"/build/cabal-helper-wrapper \
+ cabal --sandbox-config="$sandbox_config" test --builddir="$build_dir" --show-details=direct