Skip to content

Commit fa63258

Browse files
committed
Add ids workflow (Ubuntu runner)
1 parent 21b531e commit fa63258

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

.github/workflows/ids-check.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: ids-check
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- synchronize
7+
- reopened
8+
- closed
9+
push:
10+
branches:
11+
- 'main'
12+
- 'release/**'
13+
14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
if: github.repository_owner == 'llvm'
24+
name: ids-check
25+
runs-on: ubuntu-24.04
26+
27+
steps:
28+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
repository: compnerd/ids
31+
path: ${{ github.workspace }}/ids
32+
fetch-depth: 0
33+
34+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
with:
36+
path: ${{ github.workspace }}/llvm-project
37+
fetch-depth: 2
38+
39+
- name: install dependencies
40+
run: |
41+
sudo apt install -y clang-19 ninja-build libclang-19-dev
42+
pip install lit
43+
44+
- name: Configure and build minimal LLVM for use by ids
45+
run: |
46+
cmake -B ${{ github.workspace }}/llvm-project/build/ \
47+
-D CMAKE_BUILD_TYPE=Release \
48+
-S ${{ github.workspace }}/llvm-project/llvm/ \
49+
-D LLVM_ENABLE_PROJECTS=clang \
50+
-D LLVM_TARGETS_TO_BUILD="host" \
51+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
52+
-G Ninja
53+
cd ${{ github.workspace }}/llvm-project/build/
54+
ninja -t targets all | grep "CommonTableGen: phony$" | grep -v "/" | sed 's/:.*//'
55+
56+
- name: Configure ids
57+
run: |
58+
cmake -B ${{ github.workspace }}/ids/build/ \
59+
-S ${{ github.workspace }}/ids/ \
60+
-D CMAKE_BUILD_TYPE=Release \
61+
-D CMAKE_C_COMPILER=clang \
62+
-D CMAKE_CXX_COMPILER=clang++ \
63+
-D CMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld \
64+
-D LLVM_DIR=/usr/lib/llvm-19/lib/cmake/llvm/ \
65+
-D Clang_DIR=/usr/lib/llvm-19/lib/cmake/clang/ \
66+
-D FILECHECK_EXECUTABLE=$(which FileCheck-19) \
67+
-D LIT_EXECUTABLE=$(which lit)
68+
69+
- name: Build ids
70+
run: |
71+
cmake --build ${{ github.workspace }}/ids/build \
72+
--config Release \
73+
--parallel $(nproc --all)
74+
75+
- name: Run ids over compilation database
76+
run: |
77+
cd ${{ github.workspace }}/llvm-project
78+
export H_OR_CPP_FILES_CHANGED_LAST_COMMIT=$(git diff --name-only HEAD~1 HEAD -- 'llvm/include/llvm/**/*.h' ':!llvm/include/llvm/Debuginfod/' ':!llvm/include/llvm/Demangle/' )
79+
if [ ! -z "${H_OR_CPP_FILES_CHANGED_LAST_COMMIT}" ]; then
80+
for file in $H_OR_CPP_FILES_CHANGED_LAST_COMMIT; do
81+
${{ github.workspace }}/ids/build/bin/idt -p ${{ github.workspace }}/llvm-project/build/compile_commands.json --export-macro=LLVM_ABI --include-header="llvm/Support/Compiler.h" --extra-arg="-DLLVM_ABI=__attribute__((visibility(\"default\")))" --extra-arg="-Wno-macro-redefined" $file
82+
done
83+
fi
84+
export H_OR_CPP_FILES_CHANGED_LAST_COMMIT=$(git diff --name-only HEAD~1 HEAD -- 'llvm/include/llvm-c/**/*.h' )
85+
if [ ! -z "${H_OR_CPP_FILES_CHANGED_LAST_COMMIT}" ]; then
86+
for file in $H_OR_CPP_FILES_CHANGED_LAST_COMMIT; do
87+
${{ github.workspace }}/ids/build/bin/idt -p ${{ github.workspace }}/llvm-project/build/compile_commands.json --export-macro=LLVM_C_ABI --include-header="llvm-c/Visibility.h" --extra-arg="-DLLVM_C_ABI=__attribute__((visibility(\"default\")))" --extra-arg="-Wno-macro-redefined" $file
88+
done
89+
fi
90+
export H_OR_CPP_FILES_CHANGED_LAST_COMMIT=$(git diff --name-only HEAD~1 HEAD -- 'llvm/include/llvm/Demangle/**/*.h' )
91+
if [ ! -z "${H_OR_CPP_FILES_CHANGED_LAST_COMMIT}" ]; then
92+
for file in $H_OR_CPP_FILES_CHANGED_LAST_COMMIT; do
93+
${{ github.workspace }}/ids/build/bin/idt -p ${{ github.workspace }}/llvm-project/build/compile_commands.json --export-macro=DEMANGLE_ABI --include-header="llvm/Demangle/Visibility.h" --extra-arg="-DEMANGLE_ABI=__attribute__((visibility(\"default\")))" --extra-arg="-Wno-macro-redefined" $file
94+
done
95+
fi

0 commit comments

Comments
 (0)