ci: Upgrade to cabal new-build

This commit is contained in:
Daniel Gröber 2018-02-10 15:11:05 +01:00
parent 2e50c7b648
commit 8a36de9e19
2 changed files with 46 additions and 45 deletions

View File

@ -4,17 +4,14 @@ stages:
.before_script_template: &common_before_script .before_script_template: &common_before_script
before_script: before_script:
- ls -l .. - ls -l ..
- apt-get update && apt-get install alex happy
- ghc-pkg list
- cabal update && cabal install --only-dependencies -j2 --enable-tests --enable-documentation
- mkdir -p ../ghc-mod.sdist-$CI_PIPELINE_ID - mkdir -p ../ghc-mod.sdist-$CI_PIPELINE_ID
- touch ChangeLog - cabal update
- cabal sdist --output-directory=../ghc-mod.sdist-$CI_PIPELINE_ID - cabal install cabal-doctest
- cd ../ghc-mod.sdist-$CI_PIPELINE_ID - cabal act-as-setup -- sdist --output-directory=../ghc-mod.sdist-$CI_PIPELINE_ID
- cd core && cabal act-as-setup -- sdist --output-directory=../../ghc-mod.sdist-$CI_PIPELINE_ID/core
- cd ../../ghc-mod.sdist-$CI_PIPELINE_ID
after_script: after_script:
- cd "$CI_PROJECT_DIR"
- ghc-pkg list | tee packages.list
- rm -rf "$CI_PROJECT_DIR"/../ghc-mod.sdist-$CI_PIPELINE_ID - rm -rf "$CI_PROJECT_DIR"/../ghc-mod.sdist-$CI_PIPELINE_ID
.script_template: &common_script .script_template: &common_script
@ -22,44 +19,40 @@ after_script:
- echo $PWD - echo $PWD
- which cabal - which cabal
- cabal --version - cabal --version
- cabal configure --enable-tests - cabal new-configure --enable-tests --only-dependencies
- cabal build -j2 - cabal new-build
- which cabal - cabal new-test
- cabal --version - cabal new-haddock
- ./dist/build/spec/spec
- ./dist/build/doctest/doctest
- cabal haddock
.artifacts_template: &common_artifacts .artifacts_template: &common_artifacts
artifacts: artifacts:
paths: paths:
- packages.list
- ~/.cabal/logs - ~/.cabal/logs
when: always when: always
job-ghc802: job-ghc802:
image: registry.gitlab.com/dxld/ghc-mod:ghc8.2.2-cabal-install2.0.0.0 image: registry.gitlab.com/dxld/ghc-mod:ghc8.2.2-cabal-install2.0.0.1
stage: build stage: build
<<: *common_before_script <<: *common_before_script
<<: *common_script <<: *common_script
<<: *common_artifacts <<: *common_artifacts
job-ghc800: job-ghc800:
image: registry.gitlab.com/dxld/ghc-mod:ghc8.0.2-cabal-install1.24.0.2 image: registry.gitlab.com/dxld/ghc-mod:ghc8.0.2-cabal-install2.0.0.1
stage: build stage: build
<<: *common_before_script <<: *common_before_script
<<: *common_script <<: *common_script
<<: *common_artifacts <<: *common_artifacts
job-ghc710: job-ghc710:
image: registry.gitlab.com/dxld/ghc-mod:ghc7.10.3-cabal-install1.22.8.0 image: registry.gitlab.com/dxld/ghc-mod:ghc7.10.3-cabal-install2.0.0.1
stage: build stage: build
<<: *common_before_script <<: *common_before_script
<<: *common_script <<: *common_script
<<: *common_artifacts <<: *common_artifacts
job-ghc708: job-ghc708:
image: registry.gitlab.com/dxld/ghc-mod:ghc7.8.4-cabal-install1.18.2.0 image: registry.gitlab.com/dxld/ghc-mod:ghc7.8.4-cabal-install2.0.0.1
stage: build stage: build
<<: *common_before_script <<: *common_before_script
<<: *common_script <<: *common_script

View File

@ -15,19 +15,24 @@ while read -r ghc_rel ghc ghc_arch ghc_ext cabal cabal_rev image; do
[ -n "$target" ] && [ x"$ghc_rel" != x"$target" ] && continue [ -n "$target" ] && [ x"$ghc_rel" != x"$target" ] && continue
ghc_url="https://downloads.haskell.org/~ghc/${ghc_rel}/ghc-${ghc}-${ghc_arch}.tar.${ghc_ext}" ghc_url="https://downloads.haskell.org/~ghc/${ghc_rel}/ghc-${ghc}-${ghc_arch}.tar.${ghc_ext}"
cabal_url="https://hackage.haskell.org/package/cabal-install-${cabal}/cabal-install-${cabal}.tar.gz" cabal_url="https://www.haskell.org/cabal/release/cabal-install-${cabal}/cabal-install-${cabal}-x86_64-unknown-linux.tar.gz"
## To build cabal from source:
#cabal_url="https://hackage.haskell.org/package/cabal-install-${cabal}/cabal-install-${cabal}.tar.gz"
# https://www.haskell.org/cabal/release/cabal-install-${cabal}/cabal-install-${cabal}.tar.gz # https://www.haskell.org/cabal/release/cabal-install-${cabal}/cabal-install-${cabal}.tar.gz
cabal_meta_url="https://hackage.haskell.org/package/cabal-install-${cabal}/revision/${cabal_rev}.cabal" #cabal_meta_url="https://hackage.haskell.org/package/cabal-install-${cabal}/revision/${cabal_rev}.cabal"
ghc_file="$(basename "$ghc_url")" ghc_file="$(basename "$ghc_url")"
cabal_exe_file="cabal"
cabal_file="$(basename "$cabal_url")" cabal_file="$(basename "$cabal_url")"
cabal_meta_file=cabal-install-"${cabal}"-"${cabal_rev}".cabal # cabal_meta_file=cabal-install-"${cabal}"-"${cabal_rev}".cabal
ADDITIONAL_COMMANDS="" ADDITIONAL_COMMANDS=""
ADDITIONAL_BOOTSTRAP_SETUP="true" ADDITIONAL_BOOTSTRAP_SETUP="true"
if [ x"$image" = x"debian:squeeze" ]; then if [ x"$image" = x"debian:squeeze" ]; then
ADDITIONAL_PACKAGES=" libncursesw5 realpath" ADDITIONAL_PACKAGES="realpath"
ADDITIONAL_COMMANDS="${ADDITIONAL_COMMANDS}COPY sources.list /etc/apt/ ADDITIONAL_COMMANDS="${ADDITIONAL_COMMANDS}COPY sources.list /etc/apt/
COPY 10-no-check-valid-until /etc/apt/apt.conf.d/ COPY 10-no-check-valid-until /etc/apt/apt.conf.d/
" "
@ -41,20 +46,25 @@ EOF
cat > "$tmpdir"/10-no-check-valid-until <<EOF cat > "$tmpdir"/10-no-check-valid-until <<EOF
Acquire::Check-Valid-Until "0"; Acquire::Check-Valid-Until "0";
EOF EOF
elif [ x"$image" = x"debian:jessie" ]; then
:
fi fi
mkdir -p "$dldir" mkdir -p "$dldir"
d="$(pwd)"; cd "$dldir" || exit 1 d="$(pwd)"; cd "$dldir" || exit 1
wget -nv -nc -c "$ghc_url" && cp -l "$ghc_file" "$tmpdir" wget -nv -nc -c "$ghc_url" && cp -l "$ghc_file" "$tmpdir"
wget -nv -nc -c "$cabal_url" && cp -l "$cabal_file" "$tmpdir" wget -nv -nc -c "$cabal_url" && tar -xzOf "$cabal_file" cabal \
if [ ! -e "$dldir"/"${cabal_meta_file}" ]; then > "$tmpdir/$cabal_exe_file"
wget -nv "$cabal_meta_url" -O "$dldir"/"${cabal_meta_file}"
fi && cp -l "$dldir"/"${cabal_meta_file}" "$tmpdir" #wget -nv -nc -c "$cabal_url" && cp -l "$cabal_file" "$tmpdir"
# if [ ! -e "$dldir"/"${cabal_meta_file}" ]; then
# wget -nv "$cabal_meta_url" -O "$dldir"/"${cabal_meta_file}"
# fi && cp -l "$dldir"/"${cabal_meta_file}" "$tmpdir"
ls -l "$tmpdir" ls -l "$tmpdir"
cd "$d" || exit 1 cd "$d" || exit 1
ADDITIONAL_COMMANDS="${ADDITIONAL_COMMANDS}COPY $ghc_file $cabal_file $cabal_meta_file /root/ ADDITIONAL_COMMANDS="${ADDITIONAL_COMMANDS}COPY $ghc_file $cabal_exe_file /root/
" "
cat > "$tmpdir"/Dockerfile <<EOF cat > "$tmpdir"/Dockerfile <<EOF
@ -69,31 +79,29 @@ $ADDITIONAL_COMMANDS
RUN apt-get update && apt-get upgrade -y && \ RUN apt-get update && apt-get upgrade -y && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
alex happy wget git xz-utils gpgv ca-certificates build-essential libgmp3-dev libtinfo-dev zlib1g-dev $ADDITIONAL_PACKAGES && \ alex happy wget git xz-utils gpgv ca-certificates build-essential libgmp3-dev zlib1g-dev libncurses5-dev libncursesw5-dev $ADDITIONAL_PACKAGES && \
apt-get clean apt-get clean
RUN tar -xf ghc-*.tar.* && \ RUN tar -xf ghc-*.tar.* && \
cd ghc-* && ./configure --prefix=/usr/local && make install && cd .. && \ cd ghc-* && ./configure --prefix=/usr/local && make install && cd .. && \
rm -r ghc-* rm -r ghc-*
RUN tar -xf cabal-install-*.tar.* && \ RUN chmod +x cabal; mv cabal /usr/local/bin
cd cabal-install-* && \
cp /root/$cabal_meta_file cabal-install.cabal && \
${ADDITIONAL_BOOTSTRAP_SETUP} && \
./bootstrap.sh --no-doc --global && \
cd .. && \
rm -r cabal-*
EOF EOF
docker build -t "${namespace}:ghc${ghc}-cabal-install${cabal}" "$tmpdir" docker build -t "${namespace}:ghc${ghc}-cabal-install${cabal}" "$tmpdir"
docker run "${namespace}:ghc${ghc}-cabal-install${cabal}" sh -c 'cabal update; git clone -bghc802 https://github.com/DanielG/ghc-mod.git; cd ghc-mod; cabal new-build'
done <<EOF done <<EOF
8.2.2 8.2.2 x86_64-deb8-linux xz 2.0.0.0 0 debian:jessie 8.2.2 8.2.2 x86_64-deb8-linux xz 2.0.0.1 0 debian:jessie
8.2.1 8.2.1 x86_64-deb8-linux xz 2.0.0.0 0 debian:jessie 8.0.2 8.0.2 x86_64-deb8-linux xz 2.0.0.1 0 debian:jessie
8.0.2 8.0.2 x86_64-deb8-linux xz 1.24.0.2 0 debian:jessie 7.10.3 7.10.3 x86_64-deb8-linux xz 2.0.0.1 0 debian:jessie
7.10.3 7.10.3 x86_64-deb8-linux xz 1.24.0.2 0 debian:jessie 7.8.4 7.8.4 x86_64-unknown-linux-deb7 xz 2.0.0.1 0 debian:jessie
7.8.4 7.8.4 x86_64-unknown-linux-deb7 xz 1.24.0.2 0 debian:jessie
7.6.3 7.6.3 x86_64-unknown-linux bz2 1.24.0.2 0 debian:squeeze
7.4.2 7.4.2 x86_64-unknown-linux bz2 1.24.0.2 0 debian:squeeze
EOF EOF
# 7.6.3 7.6.3 x86_64-unknown-linux bz2 1.24.0.2 0 debian:squeeze
# 7.4.2 7.4.2 x86_64-unknown-linux bz2 1.24.0.2 0 debian:squeeze
# 7.2.2 7.2.2 x86_64-unknown-linux bz2 1.24.0.2 0 debian:squeeze # 7.2.2 7.2.2 x86_64-unknown-linux bz2 1.24.0.2 0 debian:squeeze
# 7.0.4 7.0.4 x86_64-unknown-linux bz2 1.24.0.2 0 debian:squeeze # 7.0.4 7.0.4 x86_64-unknown-linux bz2 1.24.0.2 0 debian:squeeze