From fdd8ffb39098e38c0179dd647f05b846012f10a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Wed, 1 Mar 2017 03:39:23 +0100 Subject: [PATCH] ci: Use custom images to cover GHC 7.6-8.0 --- .gitlab-ci.yml | 60 +++++++++++++++++++++++++---------- scripts/docker.sh | 80 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 16 deletions(-) create mode 100755 scripts/docker.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c690f7..0beac30 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,20 +1,22 @@ stages: - build -before_script: - - cabal update - - mkdir -p ../ghc-mod.sdist - - ls -l .. - - touch ChangeLog - - cabal sdist --output-directory=../ghc-mod.sdist - - rm -f cabal.sandbox.config && cabal sandbox init - - cp cabal.sandbox.config ../ghc-mod.sdist - - cd ../ghc-mod.sdist +.before_script_template: &common_before_script + before_script: + - ls -l .. + - apt-get update && apt-get install alex happy + - mkdir -p ../ghc-mod.sdist-$CI_PIPELINE_ID + - touch ChangeLog + - cabal update + - cabal sdist --output-directory=../ghc-mod.sdist-$CI_PIPELINE_ID + - cd ../ghc-mod.sdist-$CI_PIPELINE_ID after_script: - - rm -rf "$CI_PROJECT_DIR"/../ghc-mod.sdist + - cd "$CI_PROJECT_DIR" + - ghc-pkg list | tee packages.list + - rm -rf "$CI_PROJECT_DIR"/../ghc-mod.sdist-$CI_PIPELINE_ID -.job_template: &common_script +.script_template: &common_script script: - echo $PWD - ghc-pkg list @@ -23,24 +25,50 @@ after_script: - cabal --version - cabal configure --enable-tests - cabal build -j2 - - ghc-pkg list - which cabal - cabal --version - ./dist/build/spec/spec - ./dist/build/doctest/doctest - cabal haddock -job-ghc801: - image: haskell:8.0.1 +.artifacts_template: &common_artifacts + artifacts: + paths: + - packages.list + - ~/.cabal/logs + when: always + +job-ghc800: + image: registry.gitlab.com/dxld/ghc-mod:ghc8.0.2-cabal-install1.24.0.2 stage: build + <<: *common_before_script <<: *common_script + <<: *common_artifacts job-ghc710: - image: haskell:7.10.3 + image: registry.gitlab.com/dxld/ghc-mod:ghc7.10.3-cabal-install1.22.8.0 stage: build + <<: *common_before_script <<: *common_script + <<: *common_artifacts job-ghc708: - image: haskell:7.8.4 + image: registry.gitlab.com/dxld/ghc-mod:ghc7.8.4-cabal-install1.18.1.0 stage: build + <<: *common_before_script <<: *common_script + <<: *common_artifacts + + +job-ghc706: + image: registry.gitlab.com/dxld/ghc-mod:ghc7.6.3-cabal-install1.18.1.0 + stage: build + before_script: + - cabal update + - cabal install alex + - cabal install happy + - cp ~/.cabal/bin/{alex,happy} /usr/local/bin + - rm -rf ~/.cabal/{bin,lib,libexec,setup-exe-cache,share,store} ~/.ghc + allow_failure: true + <<: *common_script + <<: *common_artifacts \ No newline at end of file diff --git a/scripts/docker.sh b/scripts/docker.sh new file mode 100755 index 0000000..7140529 --- /dev/null +++ b/scripts/docker.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +namespace="registry.gitlab.com/dxld/ghc-mod" +target="$1" + +tmpdir=$(mktemp -p "${TMPDIR:-/tmp/}" -d ghc-mod-docker-XXXX) || exit 1 +trap 'rm -r '"$tmpdir" 0 2 15 + +while read ghc ghc_arch ghc_ext cabal image ghc_hash cabal_hash; do + [ -n "$target" -a x"$ghc" != x"$target" ] && continue + + ghc_url="https://downloads.haskell.org/~ghc/$ghc/ghc-${ghc}-${ghc_arch}.tar.${ghc_ext}" + cabal_install_url="https://www.haskell.org/cabal/release/cabal-install-${cabal}/cabal-install-${cabal}.tar.gz" + + ADDITIONAL_COMMANDS="" + WGET_OPTIONS="" + + if [ x"$image" = x"debian:squeeze" ]; then + WGET_OPTIONS="--no-check-certificate" + GHC_VERIFY_COMMANDS="sha256sum -c ghc.sha256sum &&" + CABAL_VERIFY_COMMANDS="sha256sum -c cabal.sha256sum &&" + ADDITIONAL_PACKAGES=" libncursesw5" + ADDITIONAL_COMMANDS='COPY sources.list /etc/apt/ +COPY 10-no-check-valid-until /etc/apt/apt.conf.d/ +COPY *.sha256sum /root/ +' + + echo "$ghc_hash ghc-${ghc}-${ghc_arch}.tar.${ghc_ext}" \ + | cat > "$tmpdir"/ghc.sha256sum + echo "$cabal_hash cabal-install-${cabal}.tar.gz" \ + | cat > "$tmpdir"/cabal.sha256sum + + cat > "$tmpdir"/sources.list < "$tmpdir"/10-no-check-valid-until < "$tmpdir"/Dockerfile <