Skip to content

Commit 05ebb36

Browse files
authored
[libc++] Re-add a script to trigger the libc++ Buildkite pipeline (#146730)
This was removed in 99cdc26 when the LLVM monorepo Buildkite setup was removed. Libc++ previously relied on the LLVM monorepo pipeline to trigger its own pipeline when needed. Since there is no LLVM monorepo pipeline anymore, we must trigger the libc++ Buildkite pipeline on every pull request and use this script to determine which jobs to actually start based on the files that are touched by the PR.
1 parent 7d52b09 commit 05ebb36

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ===----------------------------------------------------------------------===##
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
# ===----------------------------------------------------------------------===##
8+
9+
#
10+
# This script determines whether the libc++ Buildkite pipeline should be triggered
11+
# on a change. This is required because Buildkite gets notified for every PR in the
12+
# LLVM monorepo, and we make it a no-op unless the libc++ pipeline needs to be triggered.
13+
#
14+
15+
# Set by buildkite
16+
: ${BUILDKITE_PULL_REQUEST_BASE_BRANCH:=}
17+
18+
# Fetch origin to have an up to date merge base for the diff.
19+
git fetch origin
20+
# List of files affected by this commit
21+
: ${MODIFIED_FILES:=$(git diff --name-only origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)}
22+
23+
echo "Files modified:" >&2
24+
echo "$MODIFIED_FILES" >&2
25+
modified_dirs=$(echo "$MODIFIED_FILES" | cut -d'/' -f1 | sort -u)
26+
echo "Directories modified:" >&2
27+
echo "$modified_dirs" >&2
28+
29+
# If libc++ or one of the runtimes directories changed, trigger the libc++ Buildkite pipeline.
30+
if echo "$modified_dirs" | grep -q -E "^(libcxx|libcxxabi|libunwind|runtimes|cmake)$"; then
31+
buildkite-agent pipeline upload libcxx/utils/ci/buildkite-pipeline.yml
32+
else
33+
echo "No Buildkite jobs to trigger"
34+
fi

0 commit comments

Comments
 (0)