llvm-capstone/.ci/monolithic-windows.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.7 KiB
Bash
Raw Normal View History

Implement the monolithic CI pipeline in the monorepo This basically inlines the logic that was previously located in https://github.com/google/llvm-premerge-checks so it is part of the monorepo. This has the benefit of making it extremely easy for individual projects to understand and modify this logic for their own needs, unlike the current model where this logic lives in a separate non-LLVM repository. It also allows testing changes to the CI configuration using a simple Phabricator review, since the code that defines the CI pipeline is taken from the patch under review. This (or something equivalent) is necessary if we want to retain the current monolithic pre-commit CI throughout the GitHub PR transition. Since triggering the monolithic CI is currently attached to the system we use for triggering CI pipelines from Phabricator, we will lose that part of the CI when we move to GitHub PRs if we don't do anything. I've decided to rewrite the code as a shell script because the logic was fairly simple and it seemed a lot easier than figuring out how to pull only the relevant parts of llvm-premerge-checks into the monorepo. Furthermore, I think we should strive to move away from the monolithic CI altogether since sub-projects should understand, own and maintain the tests that are relevant for them to run in the CI (with LLVM providing the infrastructure). Hence, this is somewhat of a temporary solution until monolithic CI is removed entirely. Differential Revision: https://reviews.llvm.org/D158863
2023-06-12 21:45:48 +00:00
#!/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 Windows. This should be replaced by per-project scripts that
# 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}"
Implement the monolithic CI pipeline in the monorepo This basically inlines the logic that was previously located in https://github.com/google/llvm-premerge-checks so it is part of the monorepo. This has the benefit of making it extremely easy for individual projects to understand and modify this logic for their own needs, unlike the current model where this logic lives in a separate non-LLVM repository. It also allows testing changes to the CI configuration using a simple Phabricator review, since the code that defines the CI pipeline is taken from the patch under review. This (or something equivalent) is necessary if we want to retain the current monolithic pre-commit CI throughout the GitHub PR transition. Since triggering the monolithic CI is currently attached to the system we use for triggering CI pipelines from Phabricator, we will lose that part of the CI when we move to GitHub PRs if we don't do anything. I've decided to rewrite the code as a shell script because the logic was fairly simple and it seemed a lot easier than figuring out how to pull only the relevant parts of llvm-premerge-checks into the monorepo. Furthermore, I think we should strive to move away from the monolithic CI altogether since sub-projects should understand, own and maintain the tests that are relevant for them to run in the CI (with LLVM providing the infrastructure). Hence, this is somewhat of a temporary solution until monolithic CI is removed entirely. Differential Revision: https://reviews.llvm.org/D158863
2023-06-12 21:45:48 +00:00
rm -rf ${BUILD_DIR}
if [[ -n "${CLEAR_CACHE:-}" ]]; then
echo "clearing sccache"
rm -rf "$SCCACHE_DIR"
fi
Implement the monolithic CI pipeline in the monorepo This basically inlines the logic that was previously located in https://github.com/google/llvm-premerge-checks so it is part of the monorepo. This has the benefit of making it extremely easy for individual projects to understand and modify this logic for their own needs, unlike the current model where this logic lives in a separate non-LLVM repository. It also allows testing changes to the CI configuration using a simple Phabricator review, since the code that defines the CI pipeline is taken from the patch under review. This (or something equivalent) is necessary if we want to retain the current monolithic pre-commit CI throughout the GitHub PR transition. Since triggering the monolithic CI is currently attached to the system we use for triggering CI pipelines from Phabricator, we will lose that part of the CI when we move to GitHub PRs if we don't do anything. I've decided to rewrite the code as a shell script because the logic was fairly simple and it seemed a lot easier than figuring out how to pull only the relevant parts of llvm-premerge-checks into the monorepo. Furthermore, I think we should strive to move away from the monolithic CI altogether since sub-projects should understand, own and maintain the tests that are relevant for them to run in the CI (with LLVM providing the infrastructure). Hence, this is somewhat of a temporary solution until monolithic CI is removed entirely. Differential Revision: https://reviews.llvm.org/D158863
2023-06-12 21:45:48 +00:00
sccache --zero-stats
function show-stats {
mkdir -p artifacts
sccache --show-stats >> artifacts/sccache_stats.txt
Implement the monolithic CI pipeline in the monorepo This basically inlines the logic that was previously located in https://github.com/google/llvm-premerge-checks so it is part of the monorepo. This has the benefit of making it extremely easy for individual projects to understand and modify this logic for their own needs, unlike the current model where this logic lives in a separate non-LLVM repository. It also allows testing changes to the CI configuration using a simple Phabricator review, since the code that defines the CI pipeline is taken from the patch under review. This (or something equivalent) is necessary if we want to retain the current monolithic pre-commit CI throughout the GitHub PR transition. Since triggering the monolithic CI is currently attached to the system we use for triggering CI pipelines from Phabricator, we will lose that part of the CI when we move to GitHub PRs if we don't do anything. I've decided to rewrite the code as a shell script because the logic was fairly simple and it seemed a lot easier than figuring out how to pull only the relevant parts of llvm-premerge-checks into the monorepo. Furthermore, I think we should strive to move away from the monolithic CI altogether since sub-projects should understand, own and maintain the tests that are relevant for them to run in the CI (with LLVM providing the infrastructure). Hence, this is somewhat of a temporary solution until monolithic CI is removed entirely. Differential Revision: https://reviews.llvm.org/D158863
2023-06-12 21:45:48 +00:00
}
trap show-stats EXIT
projects="${1}"
targets="${2}"
echo "--- cmake"
pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
-D LLVM_ENABLE_PROJECTS="${projects}" \
-G Ninja \
-D CMAKE_BUILD_TYPE=Release \
-D LLVM_ENABLE_ASSERTIONS=ON \
-D LLVM_BUILD_EXAMPLES=ON \
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \
-D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \
Implement the monolithic CI pipeline in the monorepo This basically inlines the logic that was previously located in https://github.com/google/llvm-premerge-checks so it is part of the monorepo. This has the benefit of making it extremely easy for individual projects to understand and modify this logic for their own needs, unlike the current model where this logic lives in a separate non-LLVM repository. It also allows testing changes to the CI configuration using a simple Phabricator review, since the code that defines the CI pipeline is taken from the patch under review. This (or something equivalent) is necessary if we want to retain the current monolithic pre-commit CI throughout the GitHub PR transition. Since triggering the monolithic CI is currently attached to the system we use for triggering CI pipelines from Phabricator, we will lose that part of the CI when we move to GitHub PRs if we don't do anything. I've decided to rewrite the code as a shell script because the logic was fairly simple and it seemed a lot easier than figuring out how to pull only the relevant parts of llvm-premerge-checks into the monorepo. Furthermore, I think we should strive to move away from the monolithic CI altogether since sub-projects should understand, own and maintain the tests that are relevant for them to run in the CI (with LLVM providing the infrastructure). Hence, this is somewhat of a temporary solution until monolithic CI is removed entirely. Differential Revision: https://reviews.llvm.org/D158863
2023-06-12 21:45:48 +00:00
-D COMPILER_RT_BUILD_ORC=OFF \
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
-D MLIR_ENABLE_BINDINGS_PYTHON=ON
Implement the monolithic CI pipeline in the monorepo This basically inlines the logic that was previously located in https://github.com/google/llvm-premerge-checks so it is part of the monorepo. This has the benefit of making it extremely easy for individual projects to understand and modify this logic for their own needs, unlike the current model where this logic lives in a separate non-LLVM repository. It also allows testing changes to the CI configuration using a simple Phabricator review, since the code that defines the CI pipeline is taken from the patch under review. This (or something equivalent) is necessary if we want to retain the current monolithic pre-commit CI throughout the GitHub PR transition. Since triggering the monolithic CI is currently attached to the system we use for triggering CI pipelines from Phabricator, we will lose that part of the CI when we move to GitHub PRs if we don't do anything. I've decided to rewrite the code as a shell script because the logic was fairly simple and it seemed a lot easier than figuring out how to pull only the relevant parts of llvm-premerge-checks into the monorepo. Furthermore, I think we should strive to move away from the monolithic CI altogether since sub-projects should understand, own and maintain the tests that are relevant for them to run in the CI (with LLVM providing the infrastructure). Hence, this is somewhat of a temporary solution until monolithic CI is removed entirely. Differential Revision: https://reviews.llvm.org/D158863
2023-06-12 21:45:48 +00:00
echo "--- ninja"
# Targets are not escaped as they are passed as separate arguments.
ninja -C "${BUILD_DIR}" ${targets}