Skip to content

Commit 298f207

Browse files
committed
[ci] Make libc++ and Clang CI scripts independent
This simply moves existing CI-related scripts for Clang outside of libc++ to make the two projects independent with respect to CI. The reason for making this change is that libc++'s CI pipeline history was full of Clang runs, making it a lot harder to figure out information about libc++'s own jobs. I created a pipeline for Clang and this patch will run pre-commit CI for Clang inside that pipeline instead. Differential Revision: https://reviews.llvm.org/D155078
1 parent f206607 commit 298f207

5 files changed

+88
-54
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
#===----------------------------------------------------------------------===##
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-exception
7+
#
8+
#===----------------------------------------------------------------------===##
9+
10+
#
11+
# This file generates a Buildkite pipeline that triggers the various CI jobs for
12+
# the LLVM project during pre-commit CI (each time a Phabricator diff is uploaded).
13+
#
14+
# See https://buildkite.com/docs/agent/v3/cli-pipeline#pipeline-format.
15+
#
16+
17+
if ! git diff --name-only HEAD~1 | grep -q -E "^libcxx/|^libcxxabi/|^libunwind/|^runtimes/|^cmake/|^clang/"; then
18+
# libcxx/, libcxxabi/, libunwind/, runtimes/, cmake/ or clang/ are not affected
19+
exit 0
20+
fi
21+
22+
reviewID="$(git log --format=%B -n 1 | sed -nE 's/^Review-ID:[[:space:]]*(.+)$/\1/p')"
23+
if [[ "${reviewID}" != "" ]]; then
24+
buildMessage="https://llvm.org/${reviewID}"
25+
else
26+
buildMessage="Push to branch ${BUILDKITE_BRANCH}"
27+
fi
28+
29+
cat <<EOF
30+
steps:
31+
EOF
32+
33+
# If libc++ or one of the runtimes directories changed
34+
if git diff --name-only HEAD~1 | grep -q -E "^libcxx/|^libcxxabi/|^libunwind/|^runtimes/|^cmake/"; then
35+
cat <<EOF
36+
- trigger: "libcxx-ci"
37+
build:
38+
message: "${buildMessage}"
39+
commit: "${BUILDKITE_COMMIT}"
40+
branch: "${BUILDKITE_BRANCH}"
41+
EOF
42+
fi
43+
44+
# If clang changed
45+
if git diff --name-only HEAD~1 | grep -q -E "^clang/"; then
46+
cat <<EOF
47+
- trigger: "clang-ci"
48+
build:
49+
message: "${buildMessage}"
50+
commit: "${BUILDKITE_COMMIT}"
51+
branch: "${BUILDKITE_BRANCH}"
52+
EOF
53+
fi
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
#===----------------------------------------------------------------------===##
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-exception
7+
#
8+
#===----------------------------------------------------------------------===##
9+
10+
#
11+
# This file generates a Buildkite pipeline that triggers the various CI jobs for
12+
# the LLVM project on scheduled builds.
13+
#
14+
# See https://buildkite.com/docs/agent/v3/cli-pipeline#pipeline-format.
15+
#
16+
17+
cat <<EOF
18+
steps:
19+
- trigger: "libcxx-ci"
20+
build:
21+
message: "${BUILDKITE_MESSAGE}"
22+
commit: "${BUILDKITE_COMMIT}"
23+
branch: "${BUILDKITE_BRANCH}"
24+
25+
- trigger: "clang-ci"
26+
build:
27+
message: "${BUILDKITE_MESSAGE}"
28+
commit: "${BUILDKITE_COMMIT}"
29+
branch: "${BUILDKITE_BRANCH}"
30+
EOF

libcxx/utils/ci/buildkite-pipeline-premerge.sh

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,5 @@
77
#
88
#===----------------------------------------------------------------------===##
99

10-
#
11-
# This file generates a Buildkite pipeline that triggers the libc++ CI
12-
# job(s) if needed.
13-
# See https://buildkite.com/docs/agent/v3/cli-pipeline#pipeline-format.
14-
#
15-
# Invoked by CI on pre-merge check for a commit.
16-
#
17-
18-
if ! git diff --name-only HEAD~1 | grep -q -E "^libcxx/|^libcxxabi/|^libunwind/|^runtimes/|^cmake/|^clang/"; then
19-
# libcxx/, libcxxabi/, libunwind/, runtimes/, cmake/ or clang/ are not affected
20-
exit 0
21-
fi
22-
23-
reviewID="$(git log --format=%B -n 1 | sed -nE 's/^Review-ID:[[:space:]]*(.+)$/\1/p')"
24-
if [[ "${reviewID}" != "" ]]; then
25-
buildMessage="https://llvm.org/${reviewID}"
26-
else
27-
buildMessage="Push to branch ${BUILDKITE_BRANCH}"
28-
fi
29-
30-
31-
cat <<EOF
32-
steps:
33-
- trigger: "libcxx-ci"
34-
build:
35-
message: "${buildMessage}"
36-
commit: "${BUILDKITE_COMMIT}"
37-
branch: "${BUILDKITE_BRANCH}"
38-
EOF
10+
# TODO: Remove this once the premerge checks invoke the script below directly.
11+
./.ci/generate-buildkite-pipeline-premerge

libcxx/utils/ci/buildkite-pipeline-snapshot.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,5 @@
77
#
88
#===----------------------------------------------------------------------===##
99

10-
#
11-
# This file generates a Buildkite pipeline that triggers the libc++ CI jobs.
12-
# See https://buildkite.com/docs/agent/v3/cli-pipeline#pipeline-format.
13-
#
14-
# Invoked by CI on full builds.
15-
#
16-
17-
cat <<EOF
18-
steps:
19-
- trigger: "libcxx-ci"
20-
build:
21-
message: "${BUILDKITE_MESSAGE}"
22-
commit: "${BUILDKITE_COMMIT}"
23-
branch: "${BUILDKITE_BRANCH}"
24-
EOF
10+
# TODO: Remove this once the premerge checks invoke the script below directly.
11+
./.ci/generate-buildkite-pipeline-scheduled

libcxx/utils/ci/generate-buildkite-pipeline

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,9 @@
99

1010
#
1111
# This script generates the appropriate libc++ CI pipeline based on which project(s) were changed.
12+
# TODO: Remove this once the libcxx CI pipeline uploads the buildkite-pipeline.yml file directly.
1213
#
1314

1415
if git diff --name-only HEAD~1 | grep -q -E "^libcxx/|^libcxxabi/|^libunwind/|^runtimes/|^cmake/"; then
15-
LIBCXX_CHANGED=true
16-
fi
17-
18-
if git diff --name-only HEAD~1 | grep -q -E "^clang/"; then
19-
CLANG_CHANGED=true
20-
fi
21-
22-
if [[ "${CLANG_CHANGED}" == "true" && "${LIBCXX_CHANGED}" != "true" ]]; then
23-
cat clang/utils/ci/buildkite-pipeline.yml
24-
else
2516
cat libcxx/utils/ci/buildkite-pipeline.yml
2617
fi

0 commit comments

Comments
 (0)