From eb0b028c83329b66cbbd6e6450d7e68c2ff04acf Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Thu, 9 Mar 2023 11:37:20 +0200 Subject: [PATCH 1/2] Stabilize use of brew Use a specific release instead of HEAD. (cherry picked from commit 6db1410b123d97e9544e03600ee391c6ce493c13) --- .gitlab-ci.yml | 2 ++ .gitlab/brew.sh | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 752e918417b..0dc0a46726d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,6 +94,8 @@ build-aarch64-darwin: TARBALL_ARCHIVE_SUFFIX: aarch64-darwin TARBALL_EXT: tar.xz ADD_CABAL_ARGS: "" + # Update periodically. + BREW_VERSION: 4.0.5 artifacts: expire_in: 2 week paths: diff --git a/.gitlab/brew.sh b/.gitlab/brew.sh index de769632e6f..405a4ed4979 100644 --- a/.gitlab/brew.sh +++ b/.gitlab/brew.sh @@ -1,10 +1,17 @@ #!/usr/bin/env bash -set -Eeuxo pipefail +set -Eeuo pipefail # Install brew locally in the project dir. Packages will also be installed here. -[ -e "$CI_PROJECT_DIR/.brew" ] || git clone --depth=1 https://github.com/Homebrew/brew $CI_PROJECT_DIR/.brew -export PATH="$CI_PROJECT_DIR/.brew/bin:$CI_PROJECT_DIR/.brew/sbin:$PATH" +# FIXME: Use brew in supported way. See +# https://docs.brew.sh/Installation#untar-anywhere-unsupported +brew_dir="${CI_PROJECT_DIR}/.brew" +# Temporarily? ensure there's no caching accidentally happening. +rm -fr "${brew_dir}" +mkdir -p "${brew_dir}" +curl -L "https://github.com/Homebrew/brew/archive/refs/tags/${BREW_VERSION}.tar.gz" | tar xz --strip 1 -C "${brew_dir}" + +export PATH="${brew_dir}/bin:${brew_dir}/sbin:$PATH" # make sure to not pollute the machine with temp files etc mkdir -p $CI_PROJECT_DIR/.brew_cache From 4e7f673805f9f3d727e550eab3857c7b063d1b65 Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Thu, 9 Mar 2023 13:01:08 +0200 Subject: [PATCH 2/2] Cache brew and the things it installs (cherry picked from commit 85253ddcc345bea729308bf30bbc8ce79b179caa) --- .gitlab-ci.yml | 3 +++ .gitlab/brew.sh | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0dc0a46726d..3df905884ae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -100,6 +100,9 @@ build-aarch64-darwin: expire_in: 2 week paths: - out/* + cache: + paths: + - .brew build-x86_64-windows: extends: .build diff --git a/.gitlab/brew.sh b/.gitlab/brew.sh index 405a4ed4979..a7bc6024124 100644 --- a/.gitlab/brew.sh +++ b/.gitlab/brew.sh @@ -6,10 +6,11 @@ set -Eeuo pipefail # FIXME: Use brew in supported way. See # https://docs.brew.sh/Installation#untar-anywhere-unsupported brew_dir="${CI_PROJECT_DIR}/.brew" -# Temporarily? ensure there's no caching accidentally happening. -rm -fr "${brew_dir}" -mkdir -p "${brew_dir}" -curl -L "https://github.com/Homebrew/brew/archive/refs/tags/${BREW_VERSION}.tar.gz" | tar xz --strip 1 -C "${brew_dir}" + +if [ ! -e "${brew_dir}" ]; then + mkdir -p "${brew_dir}" + curl -L "https://github.com/Homebrew/brew/archive/refs/tags/${BREW_VERSION}.tar.gz" | tar xz --strip 1 -C "${brew_dir}" +fi export PATH="${brew_dir}/bin:${brew_dir}/sbin:$PATH"