[llvm] [Github] Add initial version of precommit checks (PR #80951)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 22:38:10 PST 2024


https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/80951

>From 3b3addd0fcd808d15172f55e567ae93581dea882 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Sat, 20 Jan 2024 10:10:10 +0000
Subject: [PATCH 1/2] [Github] Add initial version of precommit checks

This patch adds an initial version of the LLVM precommit checks. These
checks should be reasonably performant (full test cycle in ~30 minutes
with a fully warm cache, ~80 minutes with a completely cold cache) and
should catch regressions within LLVM.

This is mainly intended to test the scalability of the current design
and to start eliminating issues before we begin to scale to other
subprojects.
---
 .github/workflows/precommit.yaml | 47 ++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 .github/workflows/precommit.yaml

diff --git a/.github/workflows/precommit.yaml b/.github/workflows/precommit.yaml
new file mode 100644
index 00000000000000..8285a19b684f3a
--- /dev/null
+++ b/.github/workflows/precommit.yaml
@@ -0,0 +1,47 @@
+name: "Precommit tests"
+
+permissions:
+  contents: read
+
+on:
+  pull_request:
+    branches:
+      - main
+    paths:
+      - '.github/workflows/precommit.yaml'
+      - 'llvm/**'
+
+jobs:
+  build-llvm:
+    name: "Build and test LLVM"
+    runs-on: ubuntu-latest
+    container:
+      image: ghcr.io/llvm/ci-ubuntu-22.04:latest
+    steps:
+      - name: Fetch LLVM sources
+        uses: actions/checkout at v4
+        with:
+          fetch-depth: 1
+      - name: Setup ccache
+        uses: hendrikmuhs/ccache-action at v1
+        with:
+          max-size: 500M
+          variant: sccache
+          key: precommit-linux
+      - name: Configure LLVM
+        run: |
+          cmake -B llvm-build -GNinja \
+            -DCMAKE_BUILD_TYPE=Release \
+            -DCMAKE_C_COMPILER_LAUNCHER=sccache \
+            -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
+            -DLLVM_ENABLE_ASSERTIONS=ON \
+            -DCMAKE_C_COMPILER=clang \
+            -DCMAKE_CXX_COMPILER=clang++ \
+            -DLLVM_LIT_ARGS="-v --no-progress-bar" \
+            ./llvm
+      - name: Build LLVM
+        run: |
+          ninja -C llvm-build llvm-test-depends
+      - name: Check LLVM
+        run: |
+          ninja -C llvm-build check-llvm

>From dff96e618001aac284ec395b5aec7eb9c3e1103c Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Thu, 8 Feb 2024 06:38:00 +0000
Subject: [PATCH 2/2] Address reviewer feedback

---
 .../{precommit.yaml => precommit-linux.yaml}       | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
 rename .github/workflows/{precommit.yaml => precommit-linux.yaml} (76%)

diff --git a/.github/workflows/precommit.yaml b/.github/workflows/precommit-linux.yaml
similarity index 76%
rename from .github/workflows/precommit.yaml
rename to .github/workflows/precommit-linux.yaml
index 8285a19b684f3a..f563994ffc781e 100644
--- a/.github/workflows/precommit.yaml
+++ b/.github/workflows/precommit-linux.yaml
@@ -1,4 +1,4 @@
-name: "Precommit tests"
+name: "Linux Precommit Tests"
 
 permissions:
   contents: read
@@ -11,9 +11,15 @@ on:
       - '.github/workflows/precommit.yaml'
       - 'llvm/**'
 
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
 jobs:
-  build-llvm:
-    name: "Build and test LLVM"
+  build-llvm-linux:
+    name: "Build and test LLVM (Linux)"
     runs-on: ubuntu-latest
     container:
       image: ghcr.io/llvm/ci-ubuntu-22.04:latest
@@ -38,7 +44,7 @@ jobs:
             -DCMAKE_C_COMPILER=clang \
             -DCMAKE_CXX_COMPILER=clang++ \
             -DLLVM_LIT_ARGS="-v --no-progress-bar" \
-            ./llvm
+            -S ./llvm
       - name: Build LLVM
         run: |
           ninja -C llvm-build llvm-test-depends



More information about the llvm-commits mailing list