Skip to content

Commit 6c95f3f

Browse files
authored
Merge pull request #8837 from haskell/mergify/bp/3.10/pr-8836
Stabilize use of brew in GitLab CI (backport #8836)
2 parents 3699fa5 + 4e7f673 commit 6c95f3f

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.gitlab-ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,15 @@ build-aarch64-darwin:
9494
TARBALL_ARCHIVE_SUFFIX: aarch64-darwin
9595
TARBALL_EXT: tar.xz
9696
ADD_CABAL_ARGS: ""
97+
# Update periodically.
98+
BREW_VERSION: 4.0.5
9799
artifacts:
98100
expire_in: 2 week
99101
paths:
100102
- out/*
103+
cache:
104+
paths:
105+
- .brew
101106

102107
build-x86_64-windows:
103108
extends: .build

.gitlab/brew.sh

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
#!/usr/bin/env bash
22

3-
set -Eeuxo pipefail
3+
set -Eeuo pipefail
44

55
# Install brew locally in the project dir. Packages will also be installed here.
6-
[ -e "$CI_PROJECT_DIR/.brew" ] || git clone --depth=1 https://github.com/Homebrew/brew $CI_PROJECT_DIR/.brew
7-
export PATH="$CI_PROJECT_DIR/.brew/bin:$CI_PROJECT_DIR/.brew/sbin:$PATH"
6+
# FIXME: Use brew in supported way. See
7+
# https://docs.brew.sh/Installation#untar-anywhere-unsupported
8+
brew_dir="${CI_PROJECT_DIR}/.brew"
9+
10+
if [ ! -e "${brew_dir}" ]; then
11+
mkdir -p "${brew_dir}"
12+
curl -L "https://github.com/Homebrew/brew/archive/refs/tags/${BREW_VERSION}.tar.gz" | tar xz --strip 1 -C "${brew_dir}"
13+
fi
14+
15+
export PATH="${brew_dir}/bin:${brew_dir}/sbin:$PATH"
816

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

0 commit comments

Comments
 (0)