aboutsummaryrefslogtreecommitdiff
path: root/scripts/ci
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2017-09-18 20:49:24 +0200
committerDaniel Gröber <dxld@darkboxed.org>2017-09-18 20:51:38 +0200
commit2bd30ac61cab9c66d6155ed1ed3e5f4dd0470444 (patch)
treeb4d423c3fb1c002e352932bf2696e0a58b98ecc9 /scripts/ci
parent5bf0f98fdff9ec190ff8a491638ca23147bec8cc (diff)
Extract CI config into scripts
Diffstat (limited to 'scripts/ci')
-rwxr-xr-xscripts/ci/build.sh9
-rw-r--r--scripts/ci/print-packages.sh5
l---------scripts/ci/steps/05-print-packages.sh1
-rw-r--r--scripts/ci/steps/10-dependencies.sh3
l---------scripts/ci/steps/15-print-packages.sh1
-rw-r--r--scripts/ci/steps/20-sdist.sh10
-rw-r--r--scripts/ci/steps/30-build.sh3
-rw-r--r--scripts/ci/steps/40-test.sh1
8 files changed, 33 insertions, 0 deletions
diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh
new file mode 100755
index 0000000..7d2c136
--- /dev/null
+++ b/scripts/ci/build.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -ex
+
+CI_SCRIPTS_DIR="$(realpath "$(dirname "$0")")"
+
+for step in $(printf '%s\n' "$CI_SCRIPTS_DIR"/steps/* | sort); do
+ . $step
+done
diff --git a/scripts/ci/print-packages.sh b/scripts/ci/print-packages.sh
new file mode 100644
index 0000000..891cea6
--- /dev/null
+++ b/scripts/ci/print-packages.sh
@@ -0,0 +1,5 @@
+if [ -e cabal.sandbox.config ]; then
+ cabal sandbox hc-pkg list
+else
+ ghc-pkg list
+fi
diff --git a/scripts/ci/steps/05-print-packages.sh b/scripts/ci/steps/05-print-packages.sh
new file mode 120000
index 0000000..4a3479a
--- /dev/null
+++ b/scripts/ci/steps/05-print-packages.sh
@@ -0,0 +1 @@
+../print-packages.sh \ No newline at end of file
diff --git a/scripts/ci/steps/10-dependencies.sh b/scripts/ci/steps/10-dependencies.sh
new file mode 100644
index 0000000..c506bb8
--- /dev/null
+++ b/scripts/ci/steps/10-dependencies.sh
@@ -0,0 +1,3 @@
+cabal update
+cabal sandbox init
+cabal install --only-dependencies
diff --git a/scripts/ci/steps/15-print-packages.sh b/scripts/ci/steps/15-print-packages.sh
new file mode 120000
index 0000000..4a3479a
--- /dev/null
+++ b/scripts/ci/steps/15-print-packages.sh
@@ -0,0 +1 @@
+../print-packages.sh \ No newline at end of file
diff --git a/scripts/ci/steps/20-sdist.sh b/scripts/ci/steps/20-sdist.sh
new file mode 100644
index 0000000..dd4554e
--- /dev/null
+++ b/scripts/ci/steps/20-sdist.sh
@@ -0,0 +1,10 @@
+source_dir="$(mktemp --tmpdir -d "cabal-helper.sdistXXXXXXXXX")"
+mkdir -p "$source_dir"
+
+cabal sdist --output-directory="$source_dir"
+
+if [ -e cabal.sandbox.config ]; then
+ cp cabal.sandbox.config "$source_dir"
+fi
+
+cd "$source_dir"
diff --git a/scripts/ci/steps/30-build.sh b/scripts/ci/steps/30-build.sh
new file mode 100644
index 0000000..1f5e2ef
--- /dev/null
+++ b/scripts/ci/steps/30-build.sh
@@ -0,0 +1,3 @@
+cabal configure --enable-tests
+cabal build
+cabal haddock
diff --git a/scripts/ci/steps/40-test.sh b/scripts/ci/steps/40-test.sh
new file mode 100644
index 0000000..ee15c1f
--- /dev/null
+++ b/scripts/ci/steps/40-test.sh
@@ -0,0 +1 @@
+cabal test --show-details=direct