[CI] Refactor monolithic-* scripts to use common utils.sh
This patch refactors big chunks of the common functionality shared between monolithic-linux.sh and monolithic-windows.sh to a separate script, utils.sh, that is then sourced in both of the files. This makes it a bit easier to maintain the scripts. Platform differences should not be a large deal for the setup here as we are using bash as the shell on both Linux and Windows. Reviewers: lnihlen, gburgessiv, Keenuts, DavidSpickett, dschuff, cmtice, Endilll Reviewed By: DavidSpickett, cmtice Pull Request: https://github.com/llvm/llvm-project/pull/152199
This commit is contained in:
parent
281e6d2cc4
commit
d54aa36146
@ -13,50 +13,15 @@
|
||||
# run only the relevant tests.
|
||||
#
|
||||
|
||||
set -ex
|
||||
set -o pipefail
|
||||
source .ci/utils.sh
|
||||
|
||||
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
|
||||
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
|
||||
INSTALL_DIR="${BUILD_DIR}/install"
|
||||
rm -rf "${BUILD_DIR}"
|
||||
|
||||
sccache --zero-stats
|
||||
|
||||
mkdir -p artifacts/reproducers
|
||||
|
||||
# Make sure any clang reproducers will end up as artifacts.
|
||||
# Make sure any clang reproducers will end up as artifacts
|
||||
export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`
|
||||
|
||||
function at-exit {
|
||||
retcode=$?
|
||||
|
||||
sccache --show-stats > artifacts/sccache_stats.txt
|
||||
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
|
||||
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
|
||||
|
||||
# If building fails there will be no results files.
|
||||
shopt -s nullglob
|
||||
|
||||
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
|
||||
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
|
||||
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
}
|
||||
trap at-exit EXIT
|
||||
|
||||
function start-group {
|
||||
groupname=$1
|
||||
if [[ "$GITHUB_ACTIONS" != "" ]]; then
|
||||
echo "::endgroup"
|
||||
echo "::group::$groupname"
|
||||
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
|
||||
echo "@@@$STEP@@@"
|
||||
else
|
||||
echo "Starting $groupname"
|
||||
fi
|
||||
}
|
||||
|
||||
projects="${1}"
|
||||
targets="${2}"
|
||||
runtimes="${3}"
|
||||
|
@ -13,44 +13,7 @@
|
||||
# run only the relevant tests.
|
||||
#
|
||||
|
||||
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 >> artifacts/sccache_stats.txt
|
||||
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
|
||||
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
|
||||
|
||||
# If building fails there will be no results files.
|
||||
shopt -s nullglob
|
||||
|
||||
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
|
||||
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
|
||||
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
}
|
||||
trap at-exit EXIT
|
||||
|
||||
function start-group {
|
||||
groupname=$1
|
||||
if [[ "$GITHUB_ACTIONS" != "" ]]; then
|
||||
echo "::endgroup"
|
||||
echo "::group::$groupname"
|
||||
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
|
||||
echo "@@@$STEP@@@"
|
||||
else
|
||||
echo "Starting $groupname"
|
||||
fi
|
||||
}
|
||||
source .ci/utils.sh
|
||||
|
||||
projects="${1}"
|
||||
targets="${2}"
|
||||
|
51
.ci/utils.sh
Normal file
51
.ci/utils.sh
Normal file
@ -0,0 +1,51 @@
|
||||
#!/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 >> artifacts/sccache_stats.txt
|
||||
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
|
||||
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
|
||||
|
||||
# If building fails there will be no results files.
|
||||
shopt -s nullglob
|
||||
|
||||
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
|
||||
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
|
||||
$retcode "${BUILD_DIR}"/test-results.*.xml >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
}
|
||||
trap at-exit EXIT
|
||||
|
||||
function start-group {
|
||||
groupname=$1
|
||||
if [[ "$GITHUB_ACTIONS" != "" ]]; then
|
||||
echo "::endgroup"
|
||||
echo "::group::$groupname"
|
||||
elif [[ "$POSTCOMMIT_CI" != "" ]]; then
|
||||
echo "@@@$STEP@@@"
|
||||
else
|
||||
echo "Starting $groupname"
|
||||
fi
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user