CI: cleanup the cache key
[cabal.git] / .gitlab / brew.sh
bloba7bc602412481343d0dde4516059184725428bfc
1 #!/usr/bin/env bash
3 set -Eeuo pipefail
5 # Install brew locally in the project dir. Packages will also be installed here.
6 # FIXME: Use brew in supported way. See
7 # https://docs.brew.sh/Installation#untar-anywhere-unsupported
8 brew_dir="${CI_PROJECT_DIR}/.brew"
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}"
15 export PATH="${brew_dir}/bin:${brew_dir}/sbin:$PATH"
17 # make sure to not pollute the machine with temp files etc
18 mkdir -p $CI_PROJECT_DIR/.brew_cache
19 export HOMEBREW_CACHE=$CI_PROJECT_DIR/.brew_cache
20 mkdir -p $CI_PROJECT_DIR/.brew_logs
21 export HOMEBREW_LOGS=$CI_PROJECT_DIR/.brew_logs
22 mkdir -p /private/tmp/.brew_tmp
23 export HOMEBREW_TEMP=/private/tmp/.brew_tmp
25 # update and install packages
26 brew update
27 brew install ${1+"$@"}