From 3792f65855457499319e6b08fd11884977b35eb3 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Fri, 5 Apr 2024 13:45:57 +0300 Subject: [PATCH 1/4] Simplify job names --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4fdf3ed5204..28810cfbe11 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,7 +26,7 @@ workflow: paths: - out/* -build-linux: +linux: extends: .build parallel: matrix: @@ -59,7 +59,7 @@ build-linux: TARBALL_EXT: tar.xz ADD_CABAL_ARGS: "--enable-split-sections" -build-linux-alpine: +alpine-linux: extends: .build parallel: matrix: @@ -123,7 +123,7 @@ build-aarch64-darwin: paths: - .brew -build-x86_64-windows: +x86_64-windows: extends: .build script: - $env:CHERE_INVOKING = "yes" From 6b6c6842a2301834a547968825cce53fbce29909 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Fri, 5 Apr 2024 13:47:15 +0300 Subject: [PATCH 2/4] Only use ghcup where needed --- .gitlab/ci.sh | 38 +++++++------------------------------- .gitlab/ghcup.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 .gitlab/ghcup.sh diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh index 973c6775d46..9966bb86f66 100755 --- a/.gitlab/ci.sh +++ b/.gitlab/ci.sh @@ -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 @@ -74,7 +51,6 @@ case "$(uname)" in esac args=( - -w "ghc-$GHC_VERSION" --disable-profiling --enable-executable-stripping --project-file=cabal.project.release diff --git a/.gitlab/ghcup.sh b/.gitlab/ghcup.sh new file mode 100644 index 00000000000..98a8b433b79 --- /dev/null +++ b/.gitlab/ghcup.sh @@ -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 From 50c0c0f82c4d85f1c3b868c6affb30ed53fbdcb5 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Fri, 5 Apr 2024 13:48:19 +0300 Subject: [PATCH 3/4] Update ci-images pin and bootstrap versions --- .gitlab-ci.yml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 28810cfbe11..3a1ec0f1e8f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: @@ -34,22 +34,28 @@ linux: 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" @@ -63,13 +69,18 @@ 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 From 1f60a97753dcdf840599f7eb19fe1c7ce9bc0995 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Fri, 5 Apr 2024 13:48:37 +0300 Subject: [PATCH 4/4] Rework Darwin jobs * Use `arch` explicitly in both jobs. I don't know why x86_64 is the default, and I don't like it. * Stop using brew. This means a toolchain needs to already be installed where CI is run. This is the case today, although it's a bit fragile and I'll probably revisit it. * Use a matrix build to clean up the yml. * Use GHC 9.8.2 to work around GHC#24050 --- .gitlab-ci.yml | 52 +++++++++++++++----------------------------------- 1 file changed, 15 insertions(+), 37 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a1ec0f1e8f..31066604616 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -91,48 +91,26 @@ alpine-linux: 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 x86_64-windows: extends: .build