diff --git a/.ci/monolithic-macos.sh b/.ci/monolithic-macos.sh new file mode 100755 index 000000000000..3656fa331193 --- /dev/null +++ b/.ci/monolithic-macos.sh @@ -0,0 +1,50 @@ +#!/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 a monolithic build of the monorepo and runs the tests of +# most projects on macOS. +# + +source .ci/utils.sh + +projects="${1}" +targets="${2}" +runtimes="${3}" +runtime_targets="${4}" + +start-group "CMake" + +xcrun cmake -G Ninja \ + -B "${BUILD_DIR}" \ + -S "${MONOREPO_ROOT}"/llvm \ + -D LLVM_ENABLE_PROJECTS="${projects}" \ + -D LLVM_ENABLE_RUNTIMES="${runtimes}" \ + -D LLVM_DISABLE_ASSEMBLY_FILES=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -D LLDB_INCLUDE_TESTS=OFF \ + -D LLVM_ENABLE_ASSERTIONS=ON \ + -D Python3_EXECUTABLE="${RUNNER_TEMP}/venv/bin/python3" \ + -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests --succinct" \ + -D CMAKE_C_COMPILER_LAUNCHER=sccache \ + -D CMAKE_CXX_COMPILER_LAUNCHER=sccache + +start-group "ninja" + +if [[ -n "${targets}" ]]; then + ninja -C "${BUILD_DIR}" ${targets} 2>&1 | tee ninja.log + cp ${BUILD_DIR}/.ninja_log ninja.ninja_log +fi + +if [[ -n "${runtime_targets}" ]]; then + start-group "ninja Runtimes" + + ninja -C "${BUILD_DIR}" ${runtime_targets} 2>&1 | tee ninja_runtimes.log + cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log +fi diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml index 9d1329eea434..8c8d63fb5bec 100644 --- a/.github/workflows/premerge.yaml +++ b/.github/workflows/premerge.yaml @@ -286,6 +286,10 @@ jobs: run: | brew install ninja cmake command -v sccache >/dev/null || brew install sccache + - name: Set up Python venv + run: | + "$(brew --prefix python@3.14)/bin/python3.14" -m venv "${RUNNER_TEMP}/venv" + echo "${RUNNER_TEMP}/venv/bin" >> "$GITHUB_PATH" - name: Build and Test timeout-minutes: 240 env: @@ -296,34 +300,14 @@ jobs: RUNTIMES: ${{ needs.premerge-compute-macos.outputs.macos-runtimes }} RUNTIMES_CHECK_TARGETS: ${{ needs.premerge-compute-macos.outputs.macos-runtimes-check-targets }} CLANG_TOOLCHAIN_PROGRAM_TIMEOUT: 120 + GITHUB_TOKEN: ${{ github.token }} + GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} run: | export SCCACHE_IDLE_TIMEOUT=0 mkdir -p artifacts SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server - xcrun cmake -G Ninja \ - -B build \ - -S llvm \ - -DLLVM_ENABLE_PROJECTS="${PROJECTS}" \ - -DLLVM_ENABLE_RUNTIMES="${RUNTIMES}" \ - -DLLVM_DISABLE_ASSEMBLY_FILES=ON \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLDB_INCLUDE_TESTS=OFF \ - -DLLVM_ENABLE_ASSERTIONS=ON \ - -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache - - ninja -C build ${CHECK_TARGETS} - - if [[ -n "${RUNTIMES_CHECK_TARGETS}" ]]; then - ninja -C build ${RUNTIMES_CHECK_TARGETS} - fi - - name: Show sccache stats - if: always() - run: | - mkdir -p artifacts - sccache --show-stats - sccache --show-stats >> artifacts/sccache_stats.txt + ./.ci/monolithic-macos.sh "${PROJECTS}" "${CHECK_TARGETS}" "${RUNTIMES}" "${RUNTIMES_CHECK_TARGETS}" - name: Upload Artifacts # In some cases, Github will fail to upload the artifact. We want to # continue anyways as a failed artifact upload is an infra failure, not