[llvm] [libc] add multi-platform pre-commit github actions (PR #119104)

Schrodinger ZHU Yifan via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 7 17:27:38 PST 2024


https://github.com/SchrodingerZhu updated https://github.com/llvm/llvm-project/pull/119104

>From e6e227af2c9ab4141a8ca562b9423f3f19ac2f9a Mon Sep 17 00:00:00 2001
From: schrodingerzhu <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:20:35 -0500
Subject: [PATCH 1/5] [libc] add multi-platform pre-commit github actions

---
 .github/workflows/libc-fullbuild-tests.yml |  0
 .github/workflows/libc-gpu-build.yml       |  0
 .github/workflows/libc-overlay-tests.yml   | 66 ++++++++++++++++++++++
 3 files changed, 66 insertions(+)
 create mode 100644 .github/workflows/libc-fullbuild-tests.yml
 create mode 100644 .github/workflows/libc-gpu-build.yml
 create mode 100644 .github/workflows/libc-overlay-tests.yml

diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/.github/workflows/libc-gpu-build.yml b/.github/workflows/libc-gpu-build.yml
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
new file mode 100644
index 00000000000000..63732a37277886
--- /dev/null
+++ b/.github/workflows/libc-overlay-tests.yml
@@ -0,0 +1,66 @@
+# This workflow is for pre-commit testing of the LLVM-libc project.
+name: LLVM-libc Pre-commit Overlay Tests
+
+on:
+  pull_request:
+    branches: [ "main" ]
+    paths:
+      - 'libc/**'
+      - '.github/workflows/libc-overlay-tests.yml'
+
+jobs:
+  build:
+    env:
+      SCCACHE_GHA_ENABLED: "true"
+    runs-on: ${{ matrix.os }}
+    strategy:
+      # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
+      fail-fast: false
+      matrix:
+        os: [ubuntu-latest, windows-latest, macos-latest]
+        build_type: [Release, Debug]
+        compiler: [
+          { c_compiler: gcc, cpp_compiler: g++ },
+          { c_compiler: clang, cpp_compiler: clang++ },
+          { c_compiler: clang-cl, cpp_compiler: clang-cl }
+        ]
+        exclude:
+          - os: windows-latest
+            compiler: { c_compiler: gcc, cpp_compiler: g++ }
+          - os: ubuntu-latest
+            compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl }
+          - os: macos-latest
+            compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl }
+          - os: macos-latest
+            compiler: { c_compiler: gcc, cpp_compiler: g++ }
+
+    steps:
+    - uses: actions/checkout at v4
+
+    - name: Run sccache-cache
+      uses: mozilla-actions/sccache-action at v0.0.6
+
+    - name: Set reusable strings
+      id: strings
+      shell: bash
+      run: |
+        echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
+
+    - name: Configure CMake
+      run: >
+        cmake -B ${{ steps.strings.outputs.build-output-dir }}
+        -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}
+        -DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}
+        -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
+        -DCMAKE_C_COMPILER_LAUNCHER=sccache
+        -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
+        -DLLVM_ENABLE_RUNTIMES=libc
+        -G Ninja
+        -S ${{ github.workspace }}/runtimes
+
+    - name: Build
+      run: cmake --build ${{ steps.strings.outputs.build-output-dir }}
+
+    - name: Test
+      working-directory: ${{ steps.strings.outputs.build-output-dir }}
+      run: ninja check-libc

>From 49ca7bcb8dbc1ddc29e1fa5eed83ab1dea7488bb Mon Sep 17 00:00:00 2001
From: schrodingerzhu <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:22:57 -0500
Subject: [PATCH 2/5] [libc] add multi-platform pre-commit github actions

---
 .github/workflows/libc-gpu-build.yml     | 0
 .github/workflows/libc-overlay-tests.yml | 3 +--
 2 files changed, 1 insertion(+), 2 deletions(-)
 delete mode 100644 .github/workflows/libc-gpu-build.yml

diff --git a/.github/workflows/libc-gpu-build.yml b/.github/workflows/libc-gpu-build.yml
deleted file mode 100644
index e69de29bb2d1d6..00000000000000
diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
index 63732a37277886..e2e0fa0beadd96 100644
--- a/.github/workflows/libc-overlay-tests.yml
+++ b/.github/workflows/libc-overlay-tests.yml
@@ -55,11 +55,10 @@ jobs:
         -DCMAKE_C_COMPILER_LAUNCHER=sccache
         -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
         -DLLVM_ENABLE_RUNTIMES=libc
-        -G Ninja
         -S ${{ github.workspace }}/runtimes
 
     - name: Build
-      run: cmake --build ${{ steps.strings.outputs.build-output-dir }}
+      run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel
 
     - name: Test
       working-directory: ${{ steps.strings.outputs.build-output-dir }}

>From a16c16ead303a0ebaca4244ff371b0282defcfb4 Mon Sep 17 00:00:00 2001
From: schrodingerzhu <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:23:49 -0500
Subject: [PATCH 3/5] [libc] add multi-platform pre-commit github actions

---
 .github/workflows/libc-overlay-tests.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
index e2e0fa0beadd96..689a9d077eed65 100644
--- a/.github/workflows/libc-overlay-tests.yml
+++ b/.github/workflows/libc-overlay-tests.yml
@@ -51,14 +51,14 @@ jobs:
         cmake -B ${{ steps.strings.outputs.build-output-dir }}
         -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}
         -DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}
-        -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
+        -DCMAKE_BUILD_TYPE=RelWithDebInfo
         -DCMAKE_C_COMPILER_LAUNCHER=sccache
         -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
         -DLLVM_ENABLE_RUNTIMES=libc
         -S ${{ github.workspace }}/runtimes
 
     - name: Build
-      run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel
+      run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel --config RelWithDebInfo
 
     - name: Test
       working-directory: ${{ steps.strings.outputs.build-output-dir }}

>From feb3428f837c2bc20d79c2cb86502ff383168ee2 Mon Sep 17 00:00:00 2001
From: schrodingerzhu <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:26:37 -0500
Subject: [PATCH 4/5] [libc] add multi-platform pre-commit github actions

---
 .github/workflows/libc-overlay-tests.yml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
index 689a9d077eed65..daee174db34702 100644
--- a/.github/workflows/libc-overlay-tests.yml
+++ b/.github/workflows/libc-overlay-tests.yml
@@ -61,5 +61,4 @@ jobs:
       run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --parallel --config RelWithDebInfo
 
     - name: Test
-      working-directory: ${{ steps.strings.outputs.build-output-dir }}
-      run: ninja check-libc
+      run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target check-libc

>From d1af585efe6de04f90f8cd85aaeaa02713f308fa Mon Sep 17 00:00:00 2001
From: schrodingerzhu <i at zhuyi.fan>
Date: Sat, 7 Dec 2024 20:27:24 -0500
Subject: [PATCH 5/5] [libc] add multi-platform pre-commit github actions

---
 .github/workflows/libc-overlay-tests.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/libc-overlay-tests.yml b/.github/workflows/libc-overlay-tests.yml
index daee174db34702..878ea4e9216473 100644
--- a/.github/workflows/libc-overlay-tests.yml
+++ b/.github/workflows/libc-overlay-tests.yml
@@ -27,6 +27,8 @@ jobs:
         exclude:
           - os: windows-latest
             compiler: { c_compiler: gcc, cpp_compiler: g++ }
+          - os: windows-latest
+            compiler: { c_compiler: clang, cpp_compiler: clang++ }
           - os: ubuntu-latest
             compiler: { c_compiler: clang-cl, cpp_compiler: clang-cl }
           - os: macos-latest



More information about the llvm-commits mailing list