ci: Use custom images to cover GHC 7.6-8.0

This commit is contained in:
Daniel Gröber 2017-03-01 03:39:23 +01:00
parent f4935b6074
commit fdd8ffb390
2 changed files with 124 additions and 16 deletions

View File

@ -1,20 +1,22 @@
stages: stages:
- build - build
before_script: .before_script_template: &common_before_script
- cabal update before_script:
- mkdir -p ../ghc-mod.sdist - ls -l ..
- ls -l .. - apt-get update && apt-get install alex happy
- touch ChangeLog - mkdir -p ../ghc-mod.sdist-$CI_PIPELINE_ID
- cabal sdist --output-directory=../ghc-mod.sdist - touch ChangeLog
- rm -f cabal.sandbox.config && cabal sandbox init - cabal update
- cp cabal.sandbox.config ../ghc-mod.sdist - cabal sdist --output-directory=../ghc-mod.sdist-$CI_PIPELINE_ID
- cd ../ghc-mod.sdist - cd ../ghc-mod.sdist-$CI_PIPELINE_ID
after_script: 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: script:
- echo $PWD - echo $PWD
- ghc-pkg list - ghc-pkg list
@ -23,24 +25,50 @@ after_script:
- cabal --version - cabal --version
- cabal configure --enable-tests - cabal configure --enable-tests
- cabal build -j2 - cabal build -j2
- ghc-pkg list
- which cabal - which cabal
- cabal --version - cabal --version
- ./dist/build/spec/spec - ./dist/build/spec/spec
- ./dist/build/doctest/doctest - ./dist/build/doctest/doctest
- cabal haddock - cabal haddock
job-ghc801: .artifacts_template: &common_artifacts
image: haskell:8.0.1 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 stage: build
<<: *common_before_script
<<: *common_script <<: *common_script
<<: *common_artifacts
job-ghc710: job-ghc710:
image: haskell:7.10.3 image: registry.gitlab.com/dxld/ghc-mod:ghc7.10.3-cabal-install1.22.8.0
stage: build stage: build
<<: *common_before_script
<<: *common_script <<: *common_script
<<: *common_artifacts
job-ghc708: job-ghc708:
image: haskell:7.8.4 image: registry.gitlab.com/dxld/ghc-mod:ghc7.8.4-cabal-install1.18.1.0
stage: build stage: build
<<: *common_before_script
<<: *common_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

80
scripts/docker.sh Executable file
View File

@ -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 <<EOF
deb http://archive.debian.org/debian-archive/debian/ squeeze main
deb http://archive.debian.org/debian-archive/debian/ squeeze-lts main
#deb http://snapshot.debian.org/archive/debian-security/20160216T165545Z/ squeeze/updates main
EOF
cat > "$tmpdir"/10-no-check-valid-until <<EOF
Acquire::Check-Valid-Until "0";
EOF
fi
cat > "$tmpdir"/Dockerfile <<EOF
FROM $image
ARG GHC_VER
ARG GHC_URL
ARG CABAL_INSTALL_URL
## ensure locale is set during build
ENV LANG C.UTF-8
WORKDIR /root
$ADDITIONAL_COMMANDS
RUN apt-get update && apt-get upgrade && \
apt-get install -y --no-install-recommends \
wget xz-utils gpgv ca-certificates build-essential libgmp3-dev zlib1g-dev $ADDITIONAL_PACKAGES && \
apt-get clean
RUN wget -nv $WGET_OPTIONS "\$GHC_URL" && $GHC_VERIFY_COMMANDS \
tar -xf ghc-*.tar.* && \
cd ghc-* && ./configure --prefix=/usr/local && make install && cd .. && \
rm -r ghc-*
RUN wget -nv $WGET_OPTIONS "\$CABAL_INSTALL_URL" && $CABAL_VERIFY_COMMANDS \
tar -xf cabal-install-*.tar.* && \
cd cabal-install-* && ./bootstrap.sh --global && cd .. && \
rm -r cabal-*
EOF
docker build \
--build-arg GHC_URL="$ghc_url" \
--build-arg CABAL_INSTALL_URL="$cabal_install_url" \
-t "${namespace}:ghc${ghc}-cabal-install${cabal}" \
"$tmpdir"
done <<EOF
8.0.2 x86_64-deb8-linux xz 1.24.0.2 debian:jessie
7.10.3 x86_64-deb8-linux xz 1.22.8.0 debian:jessie
7.8.4 x86_64-unknown-linux-deb7 xz 1.18.1.0 debian:jessie
7.6.3 x86_64-unknown-linux bz2 1.18.1.0 debian:squeeze 398dd5fa6ed479c075ef9f638ef4fc2cc0fbf994e1b59b54d77c26a8e1e73ca0 d6abb6fef8204780a41aff2e93dfa297883673507cec557348aebf6b37843ae4
EOF