Skip to content

Commit

Permalink
More gitlab CI work (#7735)
Browse files Browse the repository at this point in the history
* Use cabal-install version 3.6.2.0

* Remove M1 workaround

* Drop network constraint

* Fix building static executables

* Add FreeBSD12 release builds (#7733)

* Fix linux build

* Create properly named tarballs

* Only pass --enable-executable-static on alpine

* Fix windows build

* Use cabal.project.release

* Run split-sections selectively, fixing arm/aarch builds

* Add retries for windows and armv7

* Fix 32bit arches

See #7313 (comment)

* Adjust paths
  • Loading branch information
hasufell authored Oct 9, 2021
1 parent 472977e commit 69f6228
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 16 deletions.
76 changes: 70 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variables:
DOCKER_REV: "853f348f9caf38b08740b280296fbd34e09abb3a"

GHC_VERSION: 8.10.7
CABAL_INSTALL_VERSION: 3.4.0.0
CABAL_INSTALL_VERSION: 3.6.2.0

workflow:
rules:
Expand All @@ -19,31 +19,53 @@ workflow:
artifacts:
expire_in: 2 week
paths:
- out
- out/*

build-aarch64-linux-deb10:
extends: .build
tags:
- aarch64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb10:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: aarch64-linux-deb10
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: ""

build-armv7-linux-deb10:
extends: .build
tags:
- armv7-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/armv7-linux-deb10:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: armv7-linux-deb1
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: ""
# temp, because 3.6.2.0 is broken
CABAL_INSTALL_VERSION: 3.4.0.0
retry: 2

build-x86_64-linux:
extends: .build
tags:
- x86_64-linux
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-linux-deb10
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections"

build-x86_64-linux-alpine:
extends: .build
tags:
- x86_64-linux
before_script:
# for cabal build
- sudo apk add --no-cache zlib zlib-dev zlib-static
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV"
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-linux-alpine
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"

build-i386-linux-alpine:
extends: .build
Expand All @@ -55,16 +77,39 @@ build-i386-linux-alpine:
- apk add --no-cache bash curl gcc g++ binutils binutils-gold bsd-compat-headers gmp-dev ncurses-dev libffi-dev make xz tar perl
# for cabal build
- apk add --no-cache zlib zlib-dev zlib-static
variables:
TARBALL_ARCHIVE_SUFFIX: i386-linux-alpine
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"
# temp, because 3.6.2.0 is broken
CABAL_INSTALL_VERSION: 3.4.0.0

build-x86_64-freebsd:
build-x86_64-freebsd13:
extends: .build
tags:
- x86_64-freebsd13
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-freebsd13
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections"

build-x86_64-freebsd12:
extends: .build
tags:
- x86_64-freebsd12
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-freebsd12
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections"

build-x86_64-darwin:
extends: .build
tags:
- x86_64-darwin
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-darwin
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: ""

build-aarch64-darwin:
tags:
Expand All @@ -80,18 +125,37 @@ build-aarch64-darwin:
--keep MACOSX_DEPLOYMENT_TARGET \
--keep GHC_VERSION \
--keep CABAL_INSTALL_VERSION \
--keep TARBALL_ARCHIVE_SUFFIX \
--keep TARBALL_EXT \
--keep ADD_CABAL_ARGS \
--run "$1" 2>&1
}
runInNixShell "cabal update && mkdir vendored && cd vendored && cabal unpack network-3.1.2.1 && cd network-3.1.2.1 && autoreconf -fi" 2>&1
runInNixShell "./.gitlab/ci.sh" 2>&1
variables:
MACOSX_DEPLOYMENT_TARGET: "10.7"
TARBALL_ARCHIVE_SUFFIX: aarch64-darwin
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: ""
artifacts:
expire_in: 2 week
paths:
- out
- out/*

build-x86_64-windows:
extends: .build
script:
- Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false, $true, $true, $false, $false, $false, $false, "$CI_PROJECT_DIR"
- ./ghcup/msys64/usr/bin/bash '-lc' 'pacman --noconfirm -S zip'
- $env:CHERE_INVOKING = "yes"
- ./ghcup/msys64/usr/bin/bash '-lc' "TARBALL_ARCHIVE_SUFFIX=$env:TARBALL_ARCHIVE_SUFFIX TARBALL_EXT=$env:TARBALL_EXT ADD_CABAL_ARGS=$env:ADD_CABAL_ARGS GHC_VERSION=$env:GHC_VERSION CABAL_INSTALL_VERSION=$CABAL_INSTALL_VERSION .gitlab/ci.sh"
after_script:
- "[Environment]::SetEnvironmentVariable('GHCUP_INSTALL_BASE_PREFIX', $null, [System.EnvironmentVariableTarget]::User)"
- "[Environment]::SetEnvironmentVariable('GHCUP_MSYS2', $null, [System.EnvironmentVariableTarget]::User)"
- "[Environment]::SetEnvironmentVariable('CABAL_DIR', $null, [System.EnvironmentVariableTarget]::User)"
tags:
- new-x86_64-windows
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-windows
TARBALL_EXT: zip
ADD_CABAL_ARGS: ""
retry: 2
40 changes: 32 additions & 8 deletions .gitlab/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,38 @@ export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

run cabal v2-install cabal-install \
-w "ghc-$GHC_VERSION" \
--installdir="$CI_PROJECT_DIR/out" \
--install-method=copy \
--overwrite-policy=always \
--enable-executable-static \
--disable-profiling \
--enable-split-sections \
# https://github.com/haskell/cabal/issues/7313#issuecomment-811851884
if [ "$(getconf LONG_BIT)" == "32" ] ; then
echo 'constraints: lukko -ofd-locking' >> cabal.project.release.local
fi

args=(
-w "ghc-$GHC_VERSION"
--disable-profiling
--enable-executable-stripping
--project-file=cabal.project.release
${ADD_CABAL_ARGS}
)

run cabal v2-build ${args[@]} cabal-install

mkdir "$CI_PROJECT_DIR/out"
cp "$(cabal list-bin ${args[@]} cabal-install:exe:cabal)" "$CI_PROJECT_DIR/out/cabal"
cp dist-newstyle/cache/plan.json "$CI_PROJECT_DIR/out/plan.json"
cd "$CI_PROJECT_DIR/out/"

# create tarball/zip
TARBALL_PREFIX="cabal-install-$("$CI_PROJECT_DIR/out/cabal" --numeric-version)"
case "${TARBALL_EXT}" in
zip)
zip "${TARBALL_PREFIX}-${TARBALL_ARCHIVE_SUFFIX}.${TARBALL_EXT}" cabal plan.json
;;
tar.xz)
tar caf "${TARBALL_PREFIX}-${TARBALL_ARCHIVE_SUFFIX}.${TARBALL_EXT}" cabal plan.json
;;
*)
fail "Unknown TARBALL_EXT: ${TARBALL_EXT}"
;;
esac

rm cabal plan.json
2 changes: 0 additions & 2 deletions cabal.project.release
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ packages: cabal-install/
tests: False
benchmarks: False
optimization: True

constraints: network < 3.1.2.3

0 comments on commit 69f6228

Please sign in to comment.