[llvm] Attempt to use composite action for libc++ builders. (PR #74489)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 08:17:59 PST 2023


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

>From c31f3b7291c954414c1a6f031c658cf9a604ab9f Mon Sep 17 00:00:00 2001
From: eric <eric at efcs.ca>
Date: Tue, 5 Dec 2023 11:02:40 -0500
Subject: [PATCH 1/4] Attempt to use composite action for libc++ builders.

This will allow us to refactor the single composite action rather
than every usage of it in the workflow when we want to make changes.

For the moment, the patch references an out-of-org action, this is
only temporary to demonstrate that it works.
---
 .../actions/libcxx/run-buildbot/action.yaml   | 45 ++++++++++++
 .github/workflows/libcxx-build-and-test.yaml  | 68 +++++--------------
 2 files changed, 63 insertions(+), 50 deletions(-)
 create mode 100644 .github/actions/libcxx/run-buildbot/action.yaml

diff --git a/.github/actions/libcxx/run-buildbot/action.yaml b/.github/actions/libcxx/run-buildbot/action.yaml
new file mode 100644
index 0000000000000..b4259db2f57bd
--- /dev/null
+++ b/.github/actions/libcxx/run-buildbot/action.yaml
@@ -0,0 +1,45 @@
+name: 'Configure the runtimes build'
+description: 'Match strings against paths in diff for origin/main and current SHA'
+
+inputs:
+  configuration:
+    description: 'the configuration to build'
+    required: true
+  cxx:
+    description: 'C++ compiler'
+    required: true
+  cc:
+    description: 'C compiler'
+    required: true
+  enable_clang_tidy:
+    description: 'enable clang-tidy'
+    required: false
+    default: 'OFF'
+  std_modules:
+    description: 'enable std modules'
+    required: false
+    default: 'OFF'
+
+
+runs:
+  using: "composite"
+
+  steps:
+    - uses: actions/checkout at v4
+    - name: ${{ inputs.config }}.${{ inputs.cxx }}
+      run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+      env:
+        CC: ${{ inputs.cc }}
+        CXX: ${{ inputs.cxx }}
+        ENABLE_CLANG_TIDY: ${{ inputs.clang_tidy }}
+        ENABLE_STD_MODULES: ${{ inputs.std_modules }}
+    - uses: actions/upload-artifact at v3
+      if: always()
+      with:
+        name: ${{ inputs.config }}-${{ matrix.cxx }}-results
+        path: |
+          **/test-results.xml
+          **/*.abilist
+          **/CMakeError.log
+          **/CMakeOutput.log
+          **/crash_diagnostics/*
diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index 83786052a5391..8d7485e9852c2 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -69,23 +69,13 @@ jobs:
             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()
+      # FIXME: Change to ./.github/actions/libcxx/run-buildbot
+      - uses: libcxx/actions/run-buildbot at main
         with:
-          name: ${{ matrix.config }}-${{ matrix.cxx }}-results
-          path: |
-            **/test-results.xml
-            **/*.abilist
-            **/CMakeError.log
-            **/CMakeOutput.log
-            **/crash_diagnostics/*
+          config: ${{ matrix.config }}
+          cc: ${{ matrix.cc }}
+          cxx: ${{ matrix.cxx }}
+          clang_tidy: ${{ matrix.clang_tidy }}
   stage2:
     if: github.repository_owner == 'llvm'
     runs-on: libcxx-runners-8-set
@@ -118,23 +108,13 @@ jobs:
             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
+      - uses: ./.github/actions/libcxx/run-buildbot
         with:
-          name: ${{ matrix.config }}-results
-          path: |
-            **/test-results.xml
-            **/*.abilist
-            **/CMakeError.log
-            **/CMakeOutput.log
-            **/crash_diagnostics/*
+          config: ${{ matrix.config }}
+          cc: ${{ matrix.cc }}
+          cxx: ${{ matrix.cxx }}
+          clang_tidy: ${{ matrix.clang_tidy }}
+
   stage3:
     if: github.repository_owner == 'llvm'
     needs: [ stage1, stage2 ]
@@ -188,22 +168,10 @@ jobs:
           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()
+      - uses: libcxx/actions/run-buildbot at main
         with:
-          name: ${{ matrix.config }}-results
-          path: |
-            **/test-results.xml
-            **/*.abilist
-            **/CMakeError.log
-            **/CMakeOutput.log
-            **/crash_diagnostics/*
-  
+          config: ${{ matrix.config }}
+          cc: clang-18
+          cxx: clang++-18
+          clang_tidy: "OFF"
+          std_modules: ${{ matrix.std_modules }}

>From 1ba53322ac592cbc2cb1d1be46ceb48535d19636 Mon Sep 17 00:00:00 2001
From: eric <eric at efcs.ca>
Date: Tue, 5 Dec 2023 11:14:53 -0500
Subject: [PATCH 2/4] fix configuration issues

---
 .../actions/libcxx/run-buildbot/action.yaml    | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/.github/actions/libcxx/run-buildbot/action.yaml b/.github/actions/libcxx/run-buildbot/action.yaml
index b4259db2f57bd..7dbe036981185 100644
--- a/.github/actions/libcxx/run-buildbot/action.yaml
+++ b/.github/actions/libcxx/run-buildbot/action.yaml
@@ -1,5 +1,5 @@
-name: 'Configure the runtimes build'
-description: 'Match strings against paths in diff for origin/main and current SHA'
+name: 'Run Buildbot for libc++'
+description: 'Invoke the run-buildbot script with the specified parameters'
 
 inputs:
   configuration:
@@ -15,7 +15,7 @@ inputs:
     description: 'enable clang-tidy'
     required: false
     default: 'OFF'
-  std_modules:
+  enable_std_modules:
     description: 'enable std modules'
     required: false
     default: 'OFF'
@@ -23,20 +23,20 @@ inputs:
 
 runs:
   using: "composite"
-
   steps:
     - uses: actions/checkout at v4
-    - name: ${{ inputs.config }}.${{ inputs.cxx }}
-      run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+    - name: ${{ inputs.configuration }}.${{ inputs.cxx }}
+      run: libcxx/utils/ci/run-buildbot ${{ inputs.configuration }}
+      shell: bash
       env:
         CC: ${{ inputs.cc }}
         CXX: ${{ inputs.cxx }}
-        ENABLE_CLANG_TIDY: ${{ inputs.clang_tidy }}
-        ENABLE_STD_MODULES: ${{ inputs.std_modules }}
+        ENABLE_CLANG_TIDY: ${{ inputs.enable_clang_tidy }}
+        ENABLE_STD_MODULES: ${{ inputs.enable_std_modules }}
     - uses: actions/upload-artifact at v3
       if: always()
       with:
-        name: ${{ inputs.config }}-${{ matrix.cxx }}-results
+        name: ${{ inputs.configuration }}-${{ inputs.cxx }}-results
         path: |
           **/test-results.xml
           **/*.abilist

>From dd479df107bc2fd37995ef389f6b5768cd7cde9d Mon Sep 17 00:00:00 2001
From: eric <eric at efcs.ca>
Date: Tue, 5 Dec 2023 11:17:18 -0500
Subject: [PATCH 3/4] reapply changes, not sure why they keep getting dropped

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

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index 8d7485e9852c2..0f48d93e08cb6 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -72,10 +72,10 @@ jobs:
       # FIXME: Change to ./.github/actions/libcxx/run-buildbot
       - uses: libcxx/actions/run-buildbot at main
         with:
-          config: ${{ matrix.config }}
+          configuration: ${{ matrix.config }}
           cc: ${{ matrix.cc }}
           cxx: ${{ matrix.cxx }}
-          clang_tidy: ${{ matrix.clang_tidy }}
+          enable_clang_tidy: ${{ matrix.clang_tidy }}
   stage2:
     if: github.repository_owner == 'llvm'
     runs-on: libcxx-runners-8-set
@@ -108,12 +108,12 @@ jobs:
             cxx: 'clang++-17'
             clang_tidy: 'OFF'
     steps:
-      - uses: ./.github/actions/libcxx/run-buildbot
+      - uses: libcxx/actions/run-buildbot at main
         with:
-          config: ${{ matrix.config }}
+          configuration: ${{ matrix.config }}
           cc: ${{ matrix.cc }}
           cxx: ${{ matrix.cxx }}
-          clang_tidy: ${{ matrix.clang_tidy }}
+          enable_clang_tidy: ${{ matrix.clang_tidy }}
 
   stage3:
     if: github.repository_owner == 'llvm'
@@ -170,8 +170,8 @@ jobs:
     steps:
       - uses: libcxx/actions/run-buildbot at main
         with:
-          config: ${{ matrix.config }}
+          configuration: ${{ matrix.config }}
           cc: clang-18
           cxx: clang++-18
-          clang_tidy: "OFF"
-          std_modules: ${{ matrix.std_modules }}
+          enable_clang_tidy: "OFF"
+          enable_std_modules: ${{ matrix.std_modules }}

>From 1759233d224670626211d54bef72fc2bbff8441c Mon Sep 17 00:00:00 2001
From: eric <eric at efcs.ca>
Date: Tue, 5 Dec 2023 11:17:47 -0500
Subject: [PATCH 4/4] add manual workflow

---
 .../libcxx-build-and-test-manual.yaml         | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 .github/workflows/libcxx-build-and-test-manual.yaml

diff --git a/.github/workflows/libcxx-build-and-test-manual.yaml b/.github/workflows/libcxx-build-and-test-manual.yaml
new file mode 100644
index 0000000000000..2fdb9f210a5bc
--- /dev/null
+++ b/.github/workflows/libcxx-build-and-test-manual.yaml
@@ -0,0 +1,65 @@
+# This file defines a one-off single configuration CI job which can be manually triggered with the various
+# knobs and switches that are available in the pre-commit CI.
+#
+# The purpose of this workflow it to make reproducing non-tested configuration issues easier, and to allow
+# for testing of new configurations.
+name: Build and Test libc++
+on:
+  workflow_dispatch:
+    inputs:
+      configuration:
+        description: 'the configuration to build'
+        required: true
+      cxx:
+        description: 'C++ compiler'
+        required: true
+      cc:
+        description: 'C compiler'
+        required: true
+      enable_clang_tidy:
+        description: 'enable clang-tidy'
+        required: false
+        default: 'OFF'
+      std_modules:
+        description: 'enable std modules'
+        required: false
+        default: 'OFF'
+      runner:
+        description: 'runner to use'
+        required: false
+        default: 'libcxx-runners-8-set'
+
+permissions:
+  contents: read # Default everything to read-only
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.actor }}
+  cancel-in-progress: false
+
+
+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"
+
+
+jobs:
+  build-libcxx:
+    if: github.repository_owner == 'llvm'
+    runs-on: ${{ inputs.runner }}
+    steps:
+      # FIXME: Change to ./.github/actions/libcxx/run-buildbot
+      - uses: libcxx/actions/run-buildbot at main
+        with:
+          configuration: ${{ matrix.config }}
+          cc: ${{ inputs.cc }}
+          cxx: ${{ inputs.cxx }}
+          enable_clang_tidy: ${{ inputs.clang_tidy }}
+          enable_std_modules: ${{ inputs.std_modules }}



More information about the llvm-commits mailing list