-
Notifications
You must be signed in to change notification settings - Fork 17k
Expand file tree
/
Copy pathutils.sh
More file actions
87 lines (73 loc) · 2.67 KB
/
utils.sh
File metadata and controls
87 lines (73 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
#===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===##
# This script performs some setup and contains some utilities used for in the
# monolithic-linux.sh and monolithic-windows.sh scripts.
set -ex
set -o pipefail
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
rm -rf "${BUILD_DIR}"
sccache --zero-stats
function at-exit {
retcode=$?
mkdir -p artifacts
sccache --show-stats
sccache --show-stats >> artifacts/sccache_stats.txt
cp "${MONOREPO_ROOT}"/*.ninja_log artifacts/ || :
cp "${MONOREPO_ROOT}"/*.log artifacts/ || :
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
# If building fails there will be no results files.
shopt -s nullglob
if [[ -n "$GITHUB_ACTIONS" ]]; then
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
>> $GITHUB_STEP_SUMMARY
if [[ -n "$GITHUB_PR_NUMBER" ]]; then
(python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
$(git rev-parse HEAD~1) $retcode "${GITHUB_TOKEN}" \
$GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \
"${MONOREPO_ROOT}"/ninja*.log)
advisor_retcode=$?
else
advisor_retcode=$retcode
fi
fi
if [[ "$retcode" != "0" ]]; then
if [[ -n "$GITHUB_ACTIONS" ]]; then
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
else
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
$(git rev-parse HEAD) $BUILDBOT_BUILDNUMBER \
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
fi
fi
if [[ -n "$GITHUB_ACTIONS" ]]; then
exit $advisor_retcode
fi
}
trap at-exit EXIT
function start-group {
groupname=$1
if [[ -n "$GITHUB_ACTIONS" ]]; then
echo "::endgroup"
echo "::group::$groupname"
elif [[ -n "$POSTCOMMIT_CI" ]]; then
echo "@@@$STEP@@@"
else
echo "Starting $groupname"
fi
}
export PIP_BREAK_SYSTEM_PACKAGES=1
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
# The ARM64 builders run on AWS and don't have access to the GCS cache.
if [[ -n "$GITHUB_ACTIONS" ]] && [[ "$RUNNER_ARCH" != "ARM64" ]]; then
python .ci/cache_lit_timing_files.py download
fi