aboutsummaryrefslogtreecommitdiff
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
parent5bf0f98fdff9ec190ff8a491638ca23147bec8cc (diff)
Extract CI config into scripts
-rw-r--r--.gitlab-ci.yml46
-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
9 files changed, 47 insertions, 32 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f396795..4ba52c7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,50 +1,32 @@
stages:
- build
-before_script:
- - apt-get update && apt-get install -y git
-
- - cabal update
-
- - mkdir -p ../cabal-helper.sdist
- - ls -l ..
- - cabal sdist --output-directory=../cabal-helper.sdist
- - cd ../cabal-helper.sdist
-
-after_script:
- - rm -rf "$CI_PROJECT_DIR"/../cabal-helper.sdist
-
-.job_template: &common_script
- script:
- - echo $PWD
- - ghc-pkg list
- - $CI_PROJECT_DIR/scripts/retry.sh cabal install -j2 --user --only-dependencies --enable-tests --enable-documentation
- - which cabal
- - cabal --version
- - cabal configure --enable-tests
- - cabal build -j2
- - ghc-pkg list
- - which cabal
- - cabal --version
- - ./dist/build/compile-test/compile-test
- - cabal haddock
-
job-ghc8.2.1-cabal-install2.0.0.0:
image: registry.gitlab.com/dxld/ghc-mod:ghc8.2.1-cabal-install2.0.0.0
stage: build
- <<: *common_script
+ script: "$CI_PROJECT_DIR/scripts/ci/build.sh"
job-ghc8.0.2-cabal-install1.24.0.2:
image: registry.gitlab.com/dxld/ghc-mod:ghc8.0.2-cabal-install1.24.0.2
stage: build
- <<: *common_script
+ script: "$CI_PROJECT_DIR/scripts/ci/build.sh"
+
+job-ghc7.10.3-cabal-install1.24.0.2:
+ image: registry.gitlab.com/dxld/ghc-mod:ghc7.10.3-cabal-install1.24.0.2
+ stage: build
+ script: "$CI_PROJECT_DIR/scripts/ci/build.sh"
+
+job-ghc7.8.4-cabal-install1.24.0.2:
+ image: registry.gitlab.com/dxld/ghc-mod:ghc7.8.4-cabal-install1.24.0.2
+ stage: build
+ script: "$CI_PROJECT_DIR/scripts/ci/build.sh"
job-ghc7.10.3-cabal-install1.22.9.0:
image: registry.gitlab.com/dxld/ghc-mod:ghc7.10.3-cabal-install1.22.8.0
stage: build
- <<: *common_script
+ script: "$CI_PROJECT_DIR/scripts/ci/build.sh"
job-ghc7.8.4-cabal-install1.18.2.0:
image: registry.gitlab.com/dxld/ghc-mod:ghc7.8.4-cabal-install1.18.2.0
stage: build
- <<: *common_script
+ script: "$CI_PROJECT_DIR/scripts/ci/build.sh" \ No newline at end of file
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