Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize use of brew in GitLab CI (backport #8836) #8837

Merged
merged 2 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,15 @@ 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:
- out/*
cache:
paths:
- .brew

build-x86_64-windows:
extends: .build
Expand Down
14 changes: 11 additions & 3 deletions .gitlab/brew.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/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"

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"

# make sure to not pollute the machine with temp files etc
mkdir -p $CI_PROJECT_DIR/.brew_cache
Expand Down