Skip to content

Commit

Permalink
Merge pull request haskell#9865 from chreekat/b/new-ci-images
Browse files Browse the repository at this point in the history
GitLab CI: Shake up available platforms
  • Loading branch information
mergify[bot] authored Apr 16, 2024
2 parents 00ce024 + 1f60a97 commit ff7bf03
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 81 deletions.
89 changes: 39 additions & 50 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ stages:

variables:
# Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: "572353e0644044fe3a5465bba4342a9a0b0eb60e"
DOCKER_REV: "a9297a370025101b479cfd4977f8f910814e03ab"

GHC_VERSION: 9.2.3
CABAL_INSTALL_VERSION: 3.6.2.0
GHC_VERSION: 9.6.4
CABAL_INSTALL_VERSION: 3.10.2.0

workflow:
rules:
Expand All @@ -26,30 +26,36 @@ workflow:
paths:
- out/*

build-linux:
linux:
extends: .build
parallel:
matrix:
- ARCH: i386
TAG: x86_64-linux
OS:
- deb9
- deb10
- ARCH: x86_64
TAG: x86_64-linux
OS:
- centos7
- deb9
- deb10
- deb11
- deb12
- fedora33
- fedora36
- fedora38
- rocky8
- ubuntu18_04
- ubuntu20_04
- deb10
- deb11
- ubuntu22_04
- ARCH: aarch64
TAG: aarch64-linux
OS:
- deb10
- deb11
- deb12
tags:
- $TAG
image: "registry.gitlab.haskell.org/ghc/ci-images/$PLATFORM:$DOCKER_REV"
Expand All @@ -59,17 +65,22 @@ build-linux:
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections"

build-linux-alpine:
alpine-linux:
extends: .build
parallel:
matrix:
- ARCH: i386
OS: [alpine3_12]
GHC_VERSION: 9.0.2
- ARCH: [i386, x86_64]
OS: [alpine3_12, alpine3_15, alpine3_17]
TAG: x86_64-linux
# Was 3_18 for i386 intentionally left off?
- ARCH: x86_64
OS: [alpine3_12]
OS: alpine3_18
TAG: x86_64-linux
- ARCH: [aarch64]
OS: [alpine3_18]
TAG: aarch64-linux
tags:
- x86_64-linux
- $TAG
before_script:
# for cabal build
- sudo apk add --no-cache zlib zlib-dev zlib-static
Expand All @@ -80,50 +91,28 @@ build-linux-alpine:
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: "--enable-split-sections --enable-executable-static"

build-x86_64-darwin:
darwin:
extends: .build
parallel:
matrix:
# Help me with names pls
- ARCH: x86_64
ARCHARCH: x86_64
- ARCH: aarch64
ARCHARCH: arm64
tags:
- x86_64-darwin
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-darwin
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: ""

build-aarch64-darwin:
stage: build
tags:
- aarch64-darwin-m1
before_script:
- export HOMEBREW_CHANGE_ARCH_TO_ARM=1
- arch -arm64 /bin/bash ./.gitlab/brew.sh llvm autoconf automake coreutils make tree
# C_INCLUDE_PATH: https://gitlab.haskell.org/ghc/ghc/-/issues/20592
script: |
export PATH="$CI_PROJECT_DIR/.brew/opt/llvm/bin:$CI_PROJECT_DIR/.brew/bin:$CI_PROJECT_DIR/.brew/sbin:$PATH"
export CC=$CI_PROJECT_DIR/.brew/opt/llvm/bin/clang
export CXX=$CI_PROJECT_DIR/.brew/opt/llvm/bin/clang++
export LD=ld
export AR=$CI_PROJECT_DIR/.brew/opt/llvm/bin/llvm-ar
export RANLIB=$CI_PROJECT_DIR/.brew/opt/llvm/bin/llvm-ranlib
export C_INCLUDE_PATH="`xcrun --show-sdk-path`/usr/include/ffi"
arch -arm64 /bin/bash ./.gitlab/ci.sh
after_script:
- rm -Rf /private/tmp/.brew_tmp
- ${ARCH}-darwin-m1
variables:
MACOSX_DEPLOYMENT_TARGET: "10.7"
TARBALL_ARCHIVE_SUFFIX: aarch64-darwin
# Using 9.8.2 to work around
# https://gitlab.haskell.org/ghc/ghc/-/issues/24050
GHC_VERSION: 9.8.2
TARBALL_ARCHIVE_SUFFIX: ${ARCH}-darwin
TARBALL_EXT: tar.xz
ADD_CABAL_ARGS: ""
# Update periodically.
BREW_VERSION: 4.0.5
artifacts:
expire_in: 2 week
paths:
- out/*
cache:
paths:
- .brew
script:
- arch -${ARCHARCH} /bin/bash .gitlab/ci.sh

build-x86_64-windows:
x86_64-windows:
extends: .build
script:
- $env:CHERE_INVOKING = "yes"
Expand Down
38 changes: 7 additions & 31 deletions .gitlab/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,26 @@ set -Eeuo pipefail

source "$CI_PROJECT_DIR/.gitlab/common.sh"

export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR/toolchain"
if [[ "$(uname)" == "Linux" ]]; then
export PATH="/opt/ghc/${GHC_VERSION}/bin:${PATH}"
# Not all runners use ci-images, so ghcup is used.
else
. "$CI_PROJECT_DIR/.gitlab/ghcup.sh"
fi

export CABAL_DIR="$CI_PROJECT_DIR/cabal"

case "$(uname)" in
MSYS_*|MINGW*)
export CABAL_DIR="$(cygpath -w "$CABAL_DIR")"
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin"
EXE_EXT=".exe"
;;
*)
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin"
EXE_EXT=""
;;
esac

mkdir -p "$CABAL_DIR"
mkdir -p "$GHCUP_BINDIR"
export PATH="$GHCUP_BINDIR:$PATH"

export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
export BOOTSTRAP_HASKELL_GHC_VERSION=$GHC_VERSION
export BOOTSTRAP_HASKELL_CABAL_VERSION=$CABAL_INSTALL_VERSION
export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes
# We don't use stack, and it isn't available on i386-deb9
export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes

# for some reason the subshell doesn't pick up the arm64 environment on darwin
# and starts installing x86_64 GHC
case "$(uname -s)" in
"Darwin"|"darwin")
case "$(/usr/bin/arch)" in
aarch64|arm64|armv8l)
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -arm64 /bin/bash
;;
*)
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
;;
esac
;;
*)
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
;;
esac

# https://github.com/haskell/cabal/issues/7313#issuecomment-811851884
# and
Expand Down Expand Up @@ -74,7 +51,6 @@ case "$(uname)" in
esac

args=(
-w "ghc-$GHC_VERSION"
--disable-profiling
--enable-executable-stripping
--project-file=cabal.project.release
Expand Down
38 changes: 38 additions & 0 deletions .gitlab/ghcup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR/toolchain"

case "$(uname)" in
MSYS_*|MINGW*)
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin"
;;
*)
GHCUP_BINDIR="${GHCUP_INSTALL_BASE_PREFIX}/.ghcup/bin"
;;
esac

mkdir -p "$GHCUP_BINDIR"
export PATH="$GHCUP_BINDIR:$PATH"

export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
export BOOTSTRAP_HASKELL_GHC_VERSION=$GHC_VERSION
export BOOTSTRAP_HASKELL_CABAL_VERSION=$CABAL_INSTALL_VERSION
export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=yes
# We don't use stack, and it isn't available on i386-deb9
export BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes

# for some reason the subshell doesn't pick up the arm64 environment on darwin
# and starts installing x86_64 GHC
case "$(uname -s)" in
"Darwin"|"darwin")
case "$(/usr/bin/arch)" in
aarch64|arm64|armv8l)
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | arch -arm64 /bin/bash
;;
*)
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
;;
esac
;;
*)
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
;;
esac

0 comments on commit ff7bf03

Please sign in to comment.