[llvm] [ci] Add ids workflow for checking llvm apis have been annotated with LLVM_ABI (PR #128370)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 23 06:02:25 PST 2025


https://github.com/mcbarton updated https://github.com/llvm/llvm-project/pull/128370

>From faec30cfc2f64e1d3850c6ddaa87629ccae357d5 Mon Sep 17 00:00:00 2001
From: mcbarton <150042563+mcbarton at users.noreply.github.com>
Date: Tue, 7 Jan 2025 09:06:17 +0000
Subject: [PATCH 1/3] Add ids workflow

---
 .github/workflows/ids-check.yml | 73 +++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 .github/workflows/ids-check.yml

diff --git a/.github/workflows/ids-check.yml b/.github/workflows/ids-check.yml
new file mode 100644
index 0000000000000..d96be8df6e5c5
--- /dev/null
+++ b/.github/workflows/ids-check.yml
@@ -0,0 +1,73 @@
+name: ids-check
+on:
+  pull_request:
+    branches: [main]
+  push:
+    branches: [main]
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+  cancel-in-progress: true
+
+jobs:
+  build:
+    name: ${{ matrix.name }}
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - name: ids-check
+            os: macos-15
+
+    steps:
+    - uses: actions/checkout at v4
+      with:
+        repository: compnerd/ids
+        path: ${{ github.workspace }}/ids
+        fetch-depth: 0
+
+    - uses: actions/checkout at v4
+      with:
+        path: ${{ github.workspace }}/llvm-project
+        fetch-depth: 0
+
+    - name: install dependencies
+      run: |
+        brew install llvm at 18
+        brew install lit
+        brew install ninja
+
+    - name: Configure and build minimal LLVM for use by ids
+      run: |
+        cmake -B ${{ github.workspace }}/llvm-project/build/ \
+              -D CMAKE_BUILD_TYPE=Release \
+              -S ${{ github.workspace }}/llvm-project/llvm/ \
+              -D LLVM_ENABLE_PROJECTS=clang \
+              -D LLVM_TARGETS_TO_BUILD="host" \
+              -G Ninja
+        cd ${{ github.workspace }}/llvm-project/build/
+        ninja -t targets all | grep "CommonTableGen: phony$" | grep -v "/" | sed 's/:.*//'
+
+    - name: Configure ids
+      run: |
+        cmake -B ${{ github.workspace }}/ids/build/ \
+              -S ${{ github.workspace }}/ids/ \
+               -D CMAKE_BUILD_TYPE=Release \
+               -D CMAKE_C_COMPILER=$(brew --prefix llvm at 18)/bin/clang \
+               -D CMAKE_CXX_COMPILER=$(brew --prefix llvm at 18)/bin/clang++ \
+               -D CMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld \
+               -D LLVM_DIR=$(brew --prefix llvm at 18)/lib/cmake/llvm \
+               -D Clang_DIR=$(brew --prefix llvm at 18)/lib/cmake/clang \
+               -D FILECHECK_EXECUTABLE=$(brew --prefix llvm at 18)/bin/FileCheck \
+               -D LIT_EXECUTABLE=$(brew --prefix lit)/bin/lit
+
+    - name: Build ids
+      run: |
+        cmake --build ${{ github.workspace }}/ids/build \
+              --config Release \
+              --parallel $(sysctl -n hw.ncpu)
+
+    - name: Run ids over compilation database
+      run: |
+        ${{ github.workspace }}/ids/build/bin/idt -p ${{ github.workspace }}/llvm-project/build/compile_commands.json --export-macro LLVM_ABI

>From 0e9ecda504e67d75276eaa4d13e93ccf1d8c95d8 Mon Sep 17 00:00:00 2001
From: mcbarton <matthew.c.barton at hotmail.co.uk>
Date: Sun, 23 Feb 2025 13:52:36 +0000
Subject: [PATCH 2/3] Debug

---
 .github/workflows/ids-check.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ids-check.yml b/.github/workflows/ids-check.yml
index d96be8df6e5c5..084b318e00f99 100644
--- a/.github/workflows/ids-check.yml
+++ b/.github/workflows/ids-check.yml
@@ -45,6 +45,7 @@ jobs:
               -S ${{ github.workspace }}/llvm-project/llvm/ \
               -D LLVM_ENABLE_PROJECTS=clang \
               -D LLVM_TARGETS_TO_BUILD="host" \
+              -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
               -G Ninja
         cd ${{ github.workspace }}/llvm-project/build/
         ninja -t targets all | grep "CommonTableGen: phony$" | grep -v "/" | sed 's/:.*//'
@@ -70,4 +71,5 @@ jobs:
 
     - name: Run ids over compilation database
       run: |
-        ${{ github.workspace }}/ids/build/bin/idt -p ${{ github.workspace }}/llvm-project/build/compile_commands.json --export-macro LLVM_ABI
+        ${{ github.workspace }}/ids/build/bin/idt -p ${{ github.workspace }}/llvm-project/build --export-macro LLVM_ABI || true
+        ${{ github.workspace }}/ids/build/bin/idt --help

>From 6766315728df28fcc410cd454c9bf9bc0248f756 Mon Sep 17 00:00:00 2001
From: mcbarton <matthew.c.barton at hotmail.co.uk>
Date: Sun, 23 Feb 2025 14:02:17 +0000
Subject: [PATCH 3/3] Update ids-check.yml

---
 .github/workflows/ids-check.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/ids-check.yml b/.github/workflows/ids-check.yml
index 084b318e00f99..37e638bd7c008 100644
--- a/.github/workflows/ids-check.yml
+++ b/.github/workflows/ids-check.yml
@@ -71,5 +71,5 @@ jobs:
 
     - name: Run ids over compilation database
       run: |
-        ${{ github.workspace }}/ids/build/bin/idt -p ${{ github.workspace }}/llvm-project/build --export-macro LLVM_ABI || true
-        ${{ github.workspace }}/ids/build/bin/idt --help
+        LLVM_BUILD_PATH="${{ github.workspace }}/llvm-project/build/"
+        ${{ github.workspace }}/ids/build/bin/idt -p $LLVM_BUILD_PATH --export-macro=LLVM_ABI



More information about the llvm-commits mailing list