From b452f1bec5c041cffbc5160e7f90eaf6daab82a0 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Tue, 19 Sep 2017 21:51:35 +0200 Subject: Adapt CI scripts for readonly sourcedir --- scripts/ci/steps/00-config.sh | 10 ++++++++++ scripts/ci/steps/10-dependencies.sh | 4 ++-- scripts/ci/steps/20-sdist.sh | 8 ++------ scripts/ci/steps/30-build.sh | 6 +++--- scripts/ci/steps/40-test.sh | 3 ++- 5 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 scripts/ci/steps/00-config.sh (limited to 'scripts') 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 -- cgit v1.2.3