[clang] 2a3322b - [clang] Create a buildkite-pipeline.yml file for clang

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 12 05:33:41 PDT 2023


Author: Nikolas Klauser
Date: 2023-07-12T08:33:22-04:00
New Revision: 2a3322bab069166dd0da8474534d0b8dad25b949

URL: https://github.com/llvm/llvm-project/commit/2a3322bab069166dd0da8474534d0b8dad25b949
DIFF: https://github.com/llvm/llvm-project/commit/2a3322bab069166dd0da8474534d0b8dad25b949.diff

LOG: [clang] Create a buildkite-pipeline.yml file for clang

This moves the formatting job to a shell script, which should also fix
the clang pre-commit CI.

Differential Revision: https://reviews.llvm.org/D153920

Added: 
    clang/utils/ci/buildkite-pipeline.yml
    clang/utils/ci/run-buildbot

Modified: 
    clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
    libcxx/utils/ci/generate-buildkite-pipeline

Removed: 
    libcxx/utils/ci/buildkite-pipeline-clang.yml


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
index b0c1014e3c975e..531115efa64f94 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
@@ -114,7 +114,7 @@ Atom DataflowAnalysisContext::forkFlowCondition(Atom Token) {
   return ForkToken;
 }
 
-Atom 
+Atom
 DataflowAnalysisContext::joinFlowConditions(Atom FirstToken,
                                             Atom SecondToken) {
   Atom Token = arena().makeFlowConditionToken();

diff  --git a/libcxx/utils/ci/buildkite-pipeline-clang.yml b/clang/utils/ci/buildkite-pipeline.yml
similarity index 61%
rename from libcxx/utils/ci/buildkite-pipeline-clang.yml
rename to clang/utils/ci/buildkite-pipeline.yml
index 58cea64b0d2581..3bc4f23f8763cd 100644
--- a/libcxx/utils/ci/buildkite-pipeline-clang.yml
+++ b/clang/utils/ci/buildkite-pipeline.yml
@@ -19,7 +19,7 @@ env:
 steps:
   - label: "Format"
     commands:
-      - "! grep -rnI '[[:blank:]]$' clang/lib clang/include clang/docs || false"
+      - "clang/utils/ci/run-buildbot check-format"
 
     agents:
       queue: "libcxx-builders"
@@ -34,15 +34,7 @@ steps:
 
   - label: "Building clang"
     commands:
-      - "mkdir install"
-      # We use Release here to avoid including debug information. Otherwise, the clang binary is very large, which
-      # is problematic because we need to upload the artifacts for other jobs to use. This may seem like nothing,
-      # but with the number of jobs we run daily, this can result in thousands of GB of network I/O.
-      - "cmake -S llvm -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=\"ccache\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DLLVM_ENABLE_PROJECTS=\"clang;compiler-rt\""
-      - "ninja -C build install-clang install-clang-resource-headers"
-      - "ccache -s"
-      - "tar -cJvf install.tar.xz install/"
-      - "buildkite-agent artifact upload --debug install.tar.xz"
+      - "clang/utils/ci/run-buildbot build-clang"
     env:
         CC: "clang-${LLVM_HEAD_VERSION}"
         CXX: "clang++-${LLVM_HEAD_VERSION}"
@@ -59,12 +51,7 @@ steps:
 
   - label: "C++03"
     commands:
-      - "buildkite-agent artifact download install.tar.xz ."
-      - "tar -xvf install.tar.xz"
-      - "export CC=$(pwd)/install/bin/clang"
-      - "export CXX=$(pwd)/install/bin/clang++"
-      - "chmod +x install/bin/clang install/bin/clang++"
-      - "libcxx/utils/ci/run-buildbot generic-cxx03"
+      - "clang/utils/ci/run-buildbot generic-cxx03"
     artifact_paths:
       - "**/test-results.xml"
       - "**/crash_diagnostics/*"
@@ -82,12 +69,7 @@ steps:
 
   - label: "C++26"
     commands:
-      - "buildkite-agent artifact download install.tar.xz ."
-      - "tar -xvf install.tar.xz"
-      - "export CC=$(pwd)/install/bin/clang"
-      - "export CXX=$(pwd)/install/bin/clang++"
-      - "chmod +x install/bin/clang install/bin/clang++"
-      - "libcxx/utils/ci/run-buildbot generic-cxx26"
+      - "clang/utils/ci/run-buildbot generic-cxx26"
     artifact_paths:
       - "**/test-results.xml"
       - "**/crash_diagnostics/*"
@@ -105,12 +87,7 @@ steps:
 
   - label: "Modules"
     commands:
-      - "buildkite-agent artifact download install.tar.xz ."
-      - "tar -xvf install.tar.xz"
-      - "export CC=$(pwd)/install/bin/clang"
-      - "export CXX=$(pwd)/install/bin/clang++"
-      - "chmod +x install/bin/clang install/bin/clang++"
-      - "libcxx/utils/ci/run-buildbot generic-modules"
+      - "clang/utils/ci/run-buildbot generic-modules"
     artifact_paths:
       - "**/test-results.xml"
       - "**/crash_diagnostics/*"

diff  --git a/clang/utils/ci/run-buildbot b/clang/utils/ci/run-buildbot
new file mode 100755
index 00000000000000..ef3909a5babc9d
--- /dev/null
+++ b/clang/utils/ci/run-buildbot
@@ -0,0 +1,128 @@
+#!/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
+#
+#===----------------------------------------------------------------------===##
+
+set -ex
+set -o pipefail
+unset LANG
+unset LC_ALL
+unset LC_COLLATE
+
+PROGNAME="$(basename "${0}")"
+
+function usage() {
+cat <<EOF
+Usage:
+${PROGNAME} [options] <BUILDER>
+
+[-h|--help]         Display this help and exit.
+
+--llvm-root <DIR>   Path to the root of the LLVM monorepo. By default, we try
+                    to figure it out based on the current working directory.
+
+--build-dir <DIR>   The directory to use for building the library. By default,
+                    this is '<llvm-root>/build/<builder>'.
+EOF
+}
+
+if [[ $# == 0 ]]; then
+   usage
+   exit 0
+fi
+
+while [[ $# -gt 0 ]]; do
+    case ${1} in
+        -h|--help)
+            usage
+            exit 0
+            ;;
+        --llvm-root)
+            MONOREPO_ROOT="${2}"
+            shift; shift
+            ;;
+        --build-dir)
+            BUILD_DIR="${2}"
+            shift; shift
+            ;;
+        *)
+            BUILDER="${1}"
+            shift
+            ;;
+    esac
+done
+
+MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
+BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
+INSTALL_DIR="${BUILD_DIR}/install"
+
+# Print the version of a few tools to aid diagnostics in some cases
+cmake --version
+ninja --version
+
+case "${BUILDER}" in
+check-format)
+    ! grep -rnI '[[:blank:]]$' clang/lib clang/include clang/docs
+;;
+build-clang)
+    mkdir install
+    # We use Release here to avoid including debug information. Otherwise, the
+    # clang binary is very large, which is problematic because we need to upload
+    # the artifacts for other jobs to use. This may seem like nothing, but with
+    # the number of jobs we run daily, this can result in thousands of GB of
+    # network I/O.
+    cmake                                                                      \
+        -S llvm                                                                \
+        -B build                                                               \
+        -G Ninja                                                               \
+        -DCMAKE_CXX_COMPILER_LAUNCHER="ccache"                                 \
+        -DCMAKE_BUILD_TYPE=Release                                             \
+        -DCMAKE_INSTALL_PREFIX=install                                         \
+        -DLLVM_ENABLE_PROJECTS="clang;compiler-rt"                             \
+
+    ninja -C build install-clang install-clang-resource-headers
+    ccache -s
+    tar -cJvf install.tar.xz install/
+    buildkite-agent artifact upload --debug install.tar.xz
+;;
+generic-cxx03)
+    buildkite-agent artifact download install.tar.xz .
+    tar -xvf install.tar.xz
+    export CC=$(pwd)/install/bin/clang
+    export CXX=$(pwd)/install/bin/clang++
+    chmod +x install/bin/clang install/bin/clang++
+    libcxx/utils/ci/run-buildbot generic-cxx03
+;;
+generic-cxx26)
+    buildkite-agent artifact download install.tar.xz .
+    tar -xvf install.tar.xz
+    export CC=$(pwd)/install/bin/clang
+    export CXX=$(pwd)/install/bin/clang++
+    chmod +x install/bin/clang install/bin/clang++
+    libcxx/utils/ci/run-buildbot generic-cxx26
+;;
+generic-modules)
+    buildkite-agent artifact download install.tar.xz .
+    tar -xvf install.tar.xz
+    export CC=$(pwd)/install/bin/clang
+    export CXX=$(pwd)/install/bin/clang++
+    chmod +x install/bin/clang install/bin/clang++
+    libcxx/utils/ci/run-buildbot generic-modules
+;;
+#################################################################
+# Insert vendor-specific internal configurations below.
+#
+# This allows vendors to extend this file with their own internal
+# configurations without running into merge conflicts with upstream.
+#################################################################
+
+#################################################################
+*)
+    echo "${BUILDER} is not a known configuration"
+    exit 1
+;;
+esac

diff  --git a/libcxx/utils/ci/generate-buildkite-pipeline b/libcxx/utils/ci/generate-buildkite-pipeline
index a10309ceabacfc..6955e145d51cfa 100755
--- a/libcxx/utils/ci/generate-buildkite-pipeline
+++ b/libcxx/utils/ci/generate-buildkite-pipeline
@@ -20,7 +20,7 @@ if git 
diff  --name-only HEAD~1 | grep -q -E "^clang/"; then
 fi
 
 if [[ "${CLANG_CHANGED}" == "true" && "${LIBCXX_CHANGED}" != "true" ]]; then
-  cat libcxx/utils/ci/buildkite-pipeline-clang.yml
+  cat clang/utils/ci/buildkite-pipeline.yml
 else
   cat libcxx/utils/ci/buildkite-pipeline.yml
 fi


        


More information about the cfe-commits mailing list