[llvm] [libcxx] Add libc++ github actions workflow to replace buildkite (PR #71836)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 23:55:14 PST 2023


https://github.com/EricWF updated https://github.com/llvm/llvm-project/pull/71836

>From dc5fc0e6d2b48b973e55a6ea1a996c3717544b4d Mon Sep 17 00:00:00 2001
From: eric <eric at efcs.ca>
Date: Thu, 16 Nov 2023 19:44:55 -0500
Subject: [PATCH 1/2] Add libc++ github actionns workflow to replace buildkite.

This adds a github actions replacement for most of the buildkite
pipeline. There are  a lot of benefits to using actions over buildkite,
so I'll spare the reader reciting them all. The primary reasons are:

 * More flexability
 * Easier for other contributors to maintain.
 * Easier to scale
---
 .github/workflows/libcxx-build-and-test.yaml | 180 ++++++++++++
 libcxx/utils/ci/buildkite-pipeline.yml       | 278 -------------------
 2 files changed, 180 insertions(+), 278 deletions(-)
 create mode 100644 .github/workflows/libcxx-build-and-test.yaml

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
new file mode 100644
index 000000000000000..d93675de4c894a0
--- /dev/null
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -0,0 +1,180 @@
+# This file defines pre-commit CI for libc++ [bla bla bla].
+#
+# We split the configurations in multiple stages with the intent of saving compute time
+# when a job fails early in the pipeline. This is why the jobs are marked as `continue-on-error: false`.
+# We try to run the CI configurations with the most signal in the first stage.
+#
+# Stages 1 & 2 are meant to be "smoke tests", and are meant to catch most build/test failures quickly and without using
+# too many resources.
+# Stage 3 is "everything else", and is meant to catch breakages on more niche or unique configurations.
+#
+# Therefore, we "fail-fast" for any failures during stages 1 & 2, meaning any job failing cancels all other running jobs,
+# under the assumption that if the "smoke tests" fail, then the other configurations will likely fail in the same way.
+# However, stage 3 does not fail fast, as it's more likely that any one job failing is a flake or a configuration-specific
+#
+name: Build and Test libc++
+on:
+  pull_request:
+    paths:
+      - 'libcxx/**'
+      - 'libcxxabi/**'
+      - 'libunwind/**'
+      - 'runtimes/**'
+      - 'cmake/**'
+      - '.github/workflows/libcxx-build-and-test.yaml'
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+  cancel-in-progress: true
+
+
+env:
+  CMAKE: "/opt/bin/cmake"
+  # LLVM POST-BRANCH bump version
+  # LLVM POST-BRANCH add compiler test for ToT - 1, e.g. "Clang 17"
+  # LLVM RELEASE bump remove compiler ToT - 3, e.g. "Clang 15"
+  LLVM_HEAD_VERSION: "18"   # Used compiler, update POST-BRANCH.
+  LLVM_PREVIOUS_VERSION: "17"
+  LLVM_OLDEST_VERSION: "16"
+  GCC_STABLE_VERSION: "13"
+  LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-18"
+  CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
+
+
+# Job breakdown:
+#   The jobs run in three stages to save resources while providing actionalable feedback as soon as possible.
+#   The stages are broken down as follows:
+#   - stage1:
+#     Stage1 contains the bots that most often fail.
+jobs:
+  stage1:
+    runs-on: libcxx-runners-16
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      matrix:
+        config: [ 'generic-cxx26', 'generic-cxx03', 'generic-modules' ]
+        cc: [  clang-18 ]
+        cxx: [ clang++-18 ]
+        clang_tidy: [ 'ON' ]
+        include:
+          - config: 'generic-gcc'
+            cc: 'gcc-13'
+            cxx: 'g++-13'
+            clang_tidy: 'OFF'
+    steps:
+      - uses: actions/checkout at v4
+      - name: ${{ matrix.config }}.${{ matrix.cxx }}
+        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        env:
+          CC: ${{ matrix.cc }}
+          CXX: ${{ matrix.cxx }}
+          ENABLE_CLANG_TIDY: ${{ matrix.clang_tidy }}
+      - uses: actions/upload-artifact at v3
+        if: always()
+        with:
+          name: ${{ matrix.config }}-${{ matrix.cxx }}-results
+          path: |
+            **/test-results.xml
+            **/*.abilist
+            **/CMakeError.log
+            **/CMakeOutput.log
+            **/crash_diagnostics/*
+  stage2:
+    runs-on: libcxx-runners-8
+    needs: [ stage1 ]
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      matrix:
+        config: [ 'generic-cxx11', 'generic-cxx14', 'generic-cxx17',
+                  'generic-cxx20', 'generic-cxx23' ]
+        cc: [ 'clang-18' ]
+        cxx: [ 'clang++-18' ]
+        clang_tidy: [ 'ON' ]
+        include:
+          - config: 'generic-gcc-cxx11'
+            cc: 'gcc-13'
+            cxx: 'g++-13'
+            clang_tidy: 'OFF'
+          - config: 'generic-cxx23'
+            cc: 'clang-16'
+            cxx: 'clang++-16'
+            clang_tidy: 'OFF'
+          - config: 'generic-cxx23'
+            cc: 'clang-17'
+            cxx: 'clang++-17'
+            clang_tidy: 'OFF'
+    steps:
+      - uses: actions/checkout at v4
+      - name: ${{ matrix.config }}
+        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        env:
+          CC: ${{ matrix.cc }}
+          CXX: ${{ matrix.cxx }}
+          ENABLE_CLANG_TIDY: ${{ matrix.clang_tidy }}
+      - uses: actions/upload-artifact at v3
+        if: always()  # Upload artifacts even if the build or test suite fails
+        with:
+          name: ${{ matrix.config }}-results
+          path: |
+            **/test-results.xml
+            **/*.abilist
+            **/CMakeError.log
+            **/CMakeOutput.log
+            **/crash_diagnostics/*
+  stage3:
+    needs: [ stage1, stage2 ]
+    continue-on-error: false
+    strategy:
+      fail-fast: false
+      max-parallel: 8
+      matrix:
+        config: [ 'generic-no-threads', 'generic-no-filesystem', 'generic-no-random_device',
+          'generic-no-localization', 'generic-no-unicode', 'generic-no-wide-characters',
+          'generic-no-experimental', 'generic-no-exceptions', 'generic-abi-unstable',
+          'generic-hardening-mode-fast',
+          'generic-hardening-mode-fast-with-abi-breaks',
+          'generic-hardening-mode-extensive',
+          'generic-hardening-mode-debug', 'generic-with_llvm_unwinder', 'generic-static', 'generic-merged',
+          'generic-modules-lsv', 'generic-no-tzdb' ]
+        machine: [ 'libcxx-runners-8' ]
+        std_modules: [ 'OFF' ]
+        include:
+        - config: 'generic-cxx26'
+          machine: libcxx-runners-8
+          std_modules: 'ON'
+        - config: 'generic-asan'
+          machine: libcxx-runners-16
+          std_modules: 'OFF'
+        - config: 'generic-tsan'
+          machine: libcxx-runners-16
+          std_modules: 'OFF'
+        - config: 'generic-ubsan'
+          machine: libcxx-runners-8
+          std_modules: 'OFF'
+        # Use a larger machine for MSAN to avoid timeout and memory allocation issues.
+        - config: 'generic-msan'
+          machine: libcxx-runners-30
+          std_modules: 'OFF'
+    runs-on: ${{ matrix.machine }}
+    steps:
+      - uses: actions/checkout at v4
+      - name: ${{ matrix.config }}
+        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        env:
+          CC: clang-18
+          CXX: clang++-18
+          ENABLE_CLANG_TIDY: "OFF"
+          ENABLE_STD_MODULES: ${{ matrix.std_modules }}
+      - uses: actions/upload-artifact at v3
+        if: always()
+        with:
+          name: ${{ matrix.config }}-results
+          path: |
+            **/test-results.xml
+            **/*.abilist
+            **/CMakeError.log
+            **/CMakeOutput.log
+            **/crash_diagnostics/*
+  
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 7482938f65dc816..39db2bfc473813a 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -101,147 +101,6 @@ environment_definitions:
 
 
 steps:
-  #
-  # General testing with the default configuration, under all the supported
-  # Standard modes, with Clang and GCC. This catches most issues upfront.
-  # The goal of this step is to catch most issues while being very fast.
-  #
-- label: GCC ${GCC_STABLE_VERSION} / C++latest
-  command: libcxx/utils/ci/run-buildbot generic-gcc
-  env:
-    <<: *common_env
-    CC: gcc-${GCC_STABLE_VERSION}
-    CXX: g++-${GCC_STABLE_VERSION}
-  <<: *common
-  <<: *linux_agent
-  
-
-
-- label: C++26
-  command: libcxx/utils/ci/run-buildbot generic-cxx26
-  env:
-    <<: *common_env
-    <<: *absolute_path_clang
-  <<: *linux_agent
-  <<: *common
-
-- label: Modular build
-  command: libcxx/utils/ci/run-buildbot generic-modules
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: C++11
-  command: libcxx/utils/ci/run-buildbot generic-cxx11
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: C++03
-  command: libcxx/utils/ci/run-buildbot generic-cxx03
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-  #
-  # All other supported configurations of libc++.
-  #
-- wait
-
-- label: C++23
-  command: libcxx/utils/ci/run-buildbot generic-cxx23
-  env:
-    <<: *common_env
-    <<: *absolute_path_clang
-    ENABLE_STD_MODULES: 'On'
-  <<: *linux_agent
-  <<: *common
-
-- label: C++20
-  command: libcxx/utils/ci/run-buildbot generic-cxx20
-  env:
-    <<: *common_env
-    <<: *absolute_path_clang
-    ENABLE_STD_MODULES: 'On'
-  <<: *linux_agent
-  <<: *common
-
-- label: C++17
-  command: libcxx/utils/ci/run-buildbot generic-cxx17
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: C++14
-  command: libcxx/utils/ci/run-buildbot generic-cxx14
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: GCC ${GCC_STABLE_VERSION} / C++11
-  command: libcxx/utils/ci/run-buildbot generic-gcc-cxx11
-  env:
-    <<: *common_env
-    CC: gcc-${GCC_STABLE_VERSION}
-    CXX: g++-${GCC_STABLE_VERSION}
-  <<: *linux_agent
-  <<: *common
-
-- label: Clang 16
-  command: libcxx/utils/ci/run-buildbot generic-cxx23
-  env:
-    <<: *common_env
-    CC: clang-16
-    CXX: clang++-16
-    ENABLE_STD_MODULES: 'Off'
-  <<: *linux_agent
-  <<: *common
-
-- label: Clang 17
-  command: libcxx/utils/ci/run-buildbot generic-cxx23
-  env:
-    <<: *common_env
-    CC: /usr/lib/llvm-17/bin/clang
-    CXX: /usr/lib/llvm-17/bin/clang++
-  <<: *linux_agent
-  <<: *common
-
-- group: Sanitizers
-  steps:
-  - label: ASAN
-    command: libcxx/utils/ci/run-buildbot generic-asan
-    env:
-      <<: *common_env
-    <<: *linux_agent
-    <<: *common
-
-  - label: TSAN
-    command: libcxx/utils/ci/run-buildbot generic-tsan
-    env:
-      <<: *common_env
-    <<: *linux_agent
-    <<: *common
-
-  - label: UBSAN
-    command: libcxx/utils/ci/run-buildbot generic-ubsan
-    env:
-      <<: *common_env
-    <<: *linux_agent
-    <<: *common
-
-  - label: MSAN
-    command: libcxx/utils/ci/run-buildbot generic-msan
-    env:
-      <<: *common_env
-    <<: *linux_agent
-    <<: *common
-
-
 - label: Bootstrapping build
   command: libcxx/utils/ci/run-buildbot bootstrapping-build
   env:
@@ -249,143 +108,6 @@ steps:
   <<: *linux_agent
   <<: *common
 
-- label: Static libraries
-  command: libcxx/utils/ci/run-buildbot generic-static
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: Shared library with merged ABI and unwinder libraries
-  command: libcxx/utils/ci/run-buildbot generic-merged
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: Fast hardening mode
-  command: libcxx/utils/ci/run-buildbot generic-hardening-mode-fast
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: Fast hardening mode with ABI breaks
-  command: libcxx/utils/ci/run-buildbot generic-hardening-mode-fast-with-abi-breaks
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: Extensive hardening mode
-  command: libcxx/utils/ci/run-buildbot generic-hardening-mode-extensive
-  env:
-    <<: *common_env
-    <<: *absolute_path_clang
-  <<: *linux_agent
-  <<: *common
-
-- label: Debug hardening mode
-  command: libcxx/utils/ci/run-buildbot generic-hardening-mode-debug
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: With LLVM's libunwind
-  command: libcxx/utils/ci/run-buildbot generic-with_llvm_unwinder
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- label: Modular build with Local Submodule Visibility
-  command: libcxx/utils/ci/run-buildbot generic-modules-lsv
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
-- group: Parts disabled
-  steps:
-  - label: No threads
-    command: libcxx/utils/ci/run-buildbot generic-no-threads
-    env:
-      <<: *common_env
-      <<: *absolute_path_clang
-    <<: *linux_agent
-    <<: *common
-
-
-  - label: No filesystem
-    command: libcxx/utils/ci/run-buildbot generic-no-filesystem
-    env:
-      <<: *common_env
-      <<: *absolute_path_clang
-    <<: *linux_agent
-    <<: *common
-
-  - label: No random device
-    command: libcxx/utils/ci/run-buildbot generic-no-random_device
-    env:
-      <<: *common_env
-      <<: *absolute_path_clang
-    <<: *linux_agent
-    <<: *common
-
-  - label: No locale
-    command: libcxx/utils/ci/run-buildbot generic-no-localization
-    env:
-      <<: *common_env
-      <<: *absolute_path_clang
-    <<: *linux_agent
-    <<: *common
-
-  - label: No Unicode
-    command: libcxx/utils/ci/run-buildbot generic-no-unicode
-    env:
-      <<: *common_env
-      <<: *absolute_path_clang
-    <<: *linux_agent
-    <<: *common
-
-  - label: No wide characters
-    command: libcxx/utils/ci/run-buildbot generic-no-wide-characters
-    env:
-      <<: *common_env
-      <<: *absolute_path_clang
-    <<: *linux_agent
-    <<: *common
-
-  - label: No time zone database
-    command: libcxx/utils/ci/run-buildbot generic-no-tzdb
-    env:
-      <<: *common_env
-    <<: *linux_agent
-    <<: *common
-
-  - label: No experimental features
-    command: libcxx/utils/ci/run-buildbot generic-no-experimental
-    env:
-      <<: *common_env
-      <<: *absolute_path_clang
-    <<: *linux_agent
-    <<: *common
-  - label: No exceptions
-    command: libcxx/utils/ci/run-buildbot generic-no-exceptions
-    env:
-      <<: *common_env
-      <<: *absolute_path_clang
-    <<: *linux_agent
-    <<: *common
-
-- label: Unstable ABI
-  command: libcxx/utils/ci/run-buildbot generic-abi-unstable
-  env:
-    <<: *common_env
-  <<: *linux_agent
-  <<: *common
-
 - label: Benchmarks
   command: libcxx/utils/ci/run-buildbot benchmarks
   env:

>From e254db88c8c7ce5980564d963104195af06be581 Mon Sep 17 00:00:00 2001
From: eric <eric at efcs.ca>
Date: Fri, 17 Nov 2023 02:54:47 -0500
Subject: [PATCH 2/2] Address final review comments

---
 .github/workflows/libcxx-build-and-test.yaml | 50 +++++++++++++-------
 1 file changed, 33 insertions(+), 17 deletions(-)

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index d93675de4c894a0..a649993c65dc42f 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -1,4 +1,4 @@
-# This file defines pre-commit CI for libc++ [bla bla bla].
+# This file defines pre-commit CI for libc++, libc++abi, and libunwind (on Github).
 #
 # We split the configurations in multiple stages with the intent of saving compute time
 # when a job fails early in the pipeline. This is why the jobs are marked as `continue-on-error: false`.
@@ -41,11 +41,6 @@ env:
   CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
 
 
-# Job breakdown:
-#   The jobs run in three stages to save resources while providing actionalable feedback as soon as possible.
-#   The stages are broken down as follows:
-#   - stage1:
-#     Stage1 contains the bots that most often fail.
 jobs:
   stage1:
     runs-on: libcxx-runners-16
@@ -53,9 +48,13 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        config: [ 'generic-cxx26', 'generic-cxx03', 'generic-modules' ]
-        cc: [  clang-18 ]
-        cxx: [ clang++-18 ]
+        config: [
+          'generic-cxx03',
+          'generic-cxx26',
+          'generic-modules'
+        ]
+        cc: [  'clang-18' ]
+        cxx: [ 'clang++-18' ]
         clang_tidy: [ 'ON' ]
         include:
           - config: 'generic-gcc'
@@ -87,8 +86,13 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        config: [ 'generic-cxx11', 'generic-cxx14', 'generic-cxx17',
-                  'generic-cxx20', 'generic-cxx23' ]
+        config: [
+          'generic-cxx11',
+          'generic-cxx14',
+          'generic-cxx17',
+          'generic-cxx20',
+          'generic-cxx23'
+        ]
         cc: [ 'clang-18' ]
         cxx: [ 'clang++-18' ]
         clang_tidy: [ 'ON' ]
@@ -130,14 +134,26 @@ jobs:
       fail-fast: false
       max-parallel: 8
       matrix:
-        config: [ 'generic-no-threads', 'generic-no-filesystem', 'generic-no-random_device',
-          'generic-no-localization', 'generic-no-unicode', 'generic-no-wide-characters',
-          'generic-no-experimental', 'generic-no-exceptions', 'generic-abi-unstable',
+        config: [
+          'generic-abi-unstable',
+          'generic-hardening-mode-debug',
+          'generic-hardening-mode-extensive',
           'generic-hardening-mode-fast',
           'generic-hardening-mode-fast-with-abi-breaks',
-          'generic-hardening-mode-extensive',
-          'generic-hardening-mode-debug', 'generic-with_llvm_unwinder', 'generic-static', 'generic-merged',
-          'generic-modules-lsv', 'generic-no-tzdb' ]
+          'generic-merged',
+          'generic-modules-lsv',
+          'generic-no-exceptions',
+          'generic-no-experimental',
+          'generic-no-filesystem',
+          'generic-no-localization',
+          'generic-no-random_device',
+          'generic-no-threads',
+          'generic-no-tzdb',
+          'generic-no-unicode',
+          'generic-no-wide-characters',
+          'generic-static',
+          'generic-with_llvm_unwinder'
+        ]
         machine: [ 'libcxx-runners-8' ]
         std_modules: [ 'OFF' ]
         include:



More information about the llvm-commits mailing list