blob: 1fa2f02ee42252960ce458d417e5c1ecfc2caf9c [file] [log] [blame]
Alexander Afanasyev21034bf2014-09-02 18:31:53 -07001#!/usr/bin/env bash
Davide Pesavento423553e2022-08-19 20:46:06 -04002set -eo pipefail
Alexander Afanasyev21034bf2014-09-02 18:31:53 -07003
Davide Pesavento423553e2022-08-19 20:46:06 -04004case $(uname) in
5 Linux)
6 if [[ -e /etc/os-release ]]; then
7 source /etc/os-release
8 else
9 source /usr/lib/os-release
10 fi
11 export ID VERSION_ID
12 export ID_LIKE="${ID} ${ID_LIKE} linux"
Davide Pesavento679c42a2025-03-25 20:50:03 -040013 if [[ -z $GITHUB_ACTIONS ]]; then
14 export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
15 fi
Davide Pesavento423553e2022-08-19 20:46:06 -040016 ;;
17 Darwin)
18 # Emulate a subset of os-release(5)
19 export ID=macos
20 export VERSION_ID=$(sw_vers -productVersion)
Davide Pesavento679c42a2025-03-25 20:50:03 -040021 if [[ -z $GITHUB_ACTIONS ]]; then
22 export PATH="/usr/local/bin${PATH:+:}${PATH}"
23 fi
Davide Pesavento423553e2022-08-19 20:46:06 -040024 if [[ -x /opt/homebrew/bin/brew ]]; then
25 eval "$(/opt/homebrew/bin/brew shellenv)"
26 elif [[ -x /usr/local/bin/brew ]]; then
27 eval "$(/usr/local/bin/brew shellenv)"
28 fi
29 ;;
30esac
31
Davide Pesaventofee7ee32020-04-15 02:45:07 -040032export CACHE_DIR=${CACHE_DIR:-/tmp}
Davide Pesavento53795892022-12-12 15:14:04 -050033
Davide Pesavento679c42a2025-03-25 20:50:03 -040034if [[ $JOB_NAME == *code-coverage ]]; then
35 export DISABLE_ASAN=1
36 export DISABLE_HEADERS_CHECK=1
Davide Pesavento53795892022-12-12 15:14:04 -050037fi
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070038
Davide Pesavento67272972023-03-16 17:20:22 -040039# https://reproducible-builds.org/docs/source-date-epoch/
40export SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)
41
Davide Pesaventofee7ee32020-04-15 02:45:07 -040042for file in .jenkins.d/*; do
Alexander Afanasyev984ca9d2016-12-19 13:09:14 -080043 [[ -f $file && -x $file ]] || continue
Davide Pesaventofee7ee32020-04-15 02:45:07 -040044
Davide Pesavento90a632b2021-10-04 01:05:24 -040045 if [[ -n $GITHUB_ACTIONS ]]; then
Davide Pesaventofee7ee32020-04-15 02:45:07 -040046 label=$(basename "$file" | sed -E 's/[[:digit:]]+-(.*)\..*/\1/')
Davide Pesavento90a632b2021-10-04 01:05:24 -040047 echo "::group::${label}"
Davide Pesaventofee7ee32020-04-15 02:45:07 -040048 fi
49
50 echo "\$ $file"
Alexander Afanasyev984ca9d2016-12-19 13:09:14 -080051 "$file"
Davide Pesaventofee7ee32020-04-15 02:45:07 -040052
Davide Pesavento90a632b2021-10-04 01:05:24 -040053 if [[ -n $GITHUB_ACTIONS ]]; then
54 echo "::endgroup::"
Davide Pesaventofee7ee32020-04-15 02:45:07 -040055 fi
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070056done