brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 713a07b Raw
79 lines · bash
1#!/usr/bin/env bash2#===----------------------------------------------------------------------===##3#4# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5# See https://llvm.org/LICENSE.txt for license information.6# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7#8#===----------------------------------------------------------------------===##9 10# This script performs some setup and contains some utilities used for in the11# monolithic-linux.sh and monolithic-windows.sh scripts.12 13set -ex14set -o pipefail15 16MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"17BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"18 19rm -rf "${BUILD_DIR}"20 21sccache --zero-stats22 23function at-exit {24  retcode=$?25 26  mkdir -p artifacts27  sccache --show-stats28  sccache --show-stats >> artifacts/sccache_stats.txt29  cp "${MONOREPO_ROOT}"/*.ninja_log artifacts/ || :30  cp "${MONOREPO_ROOT}"/*.log artifacts/ || :31  cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :32 33  # If building fails there will be no results files.34  shopt -s nullglob35 36  if [[ -n "$GITHUB_ACTIONS" ]]; then37    python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \38      $retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \39      >> $GITHUB_STEP_SUMMARY40    python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \41      $(git rev-parse HEAD~1) $retcode "${GITHUB_TOKEN}" \42      $GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \43      "${MONOREPO_ROOT}"/ninja*.log44  fi45 46  if [[ "$retcode" != "0" ]]; then47    if [[ -n "$GITHUB_ACTIONS" ]]; then48      python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \49        $(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \50        "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log51    else52      python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \53        $(git rev-parse HEAD) $BUILDBOT_BUILDNUMBER \54        "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log55    fi56  fi57}58trap at-exit EXIT59 60function start-group {61  groupname=$162  if [[ -n "$GITHUB_ACTIONS" ]]; then63    echo "::endgroup"64    echo "::group::$groupname"65  elif [[ -n "$POSTCOMMIT_CI" ]]; then66    echo "@@@$STEP@@@"67  else68    echo "Starting $groupname"69  fi70}71 72export PIP_BREAK_SYSTEM_PACKAGES=173pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt74 75# The ARM64 builders run on AWS and don't have access to the GCS cache.76if [[ -n "$GITHUB_ACTIONS" ]] && [[ "$RUNNER_ARCH" != "ARM64" ]]; then77  python .ci/cache_lit_timing_files.py download78fi79