From 2bd30ac61cab9c66d6155ed1ed3e5f4dd0470444 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Mon, 18 Sep 2017 20:49:24 +0200 Subject: Extract CI config into scripts --- scripts/ci/build.sh | 9 +++++++++ scripts/ci/print-packages.sh | 5 +++++ scripts/ci/steps/05-print-packages.sh | 1 + scripts/ci/steps/10-dependencies.sh | 3 +++ scripts/ci/steps/15-print-packages.sh | 1 + scripts/ci/steps/20-sdist.sh | 10 ++++++++++ scripts/ci/steps/30-build.sh | 3 +++ scripts/ci/steps/40-test.sh | 1 + 8 files changed, 33 insertions(+) create mode 100755 scripts/ci/build.sh create mode 100644 scripts/ci/print-packages.sh create mode 120000 scripts/ci/steps/05-print-packages.sh create mode 100644 scripts/ci/steps/10-dependencies.sh create mode 120000 scripts/ci/steps/15-print-packages.sh create mode 100644 scripts/ci/steps/20-sdist.sh create mode 100644 scripts/ci/steps/30-build.sh create mode 100644 scripts/ci/steps/40-test.sh (limited to 'scripts/ci') 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 -- cgit v1.2.3