|
| 1 | +name: ids-check |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: [main] |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + name: ${{ matrix.name }} |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - name: ids-check |
| 21 | + os: ubuntu-24.04 |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + repository: compnerd/ids |
| 27 | + path: ${{ github.workspace }}/ids |
| 28 | + fetch-depth: 0 |
| 29 | + |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + path: ${{ github.workspace }}/llvm-project |
| 33 | + fetch-depth: 2 |
| 34 | + |
| 35 | + - name: install dependencies |
| 36 | + run: | |
| 37 | + sudo apt install -y clang-18 ninja-build libclang-18-dev |
| 38 | + pip install lit |
| 39 | +
|
| 40 | + - name: Configure and build minimal LLVM for use by ids |
| 41 | + run: | |
| 42 | + cmake -B ${{ github.workspace }}/llvm-project/build/ \ |
| 43 | + -D CMAKE_BUILD_TYPE=Release \ |
| 44 | + -S ${{ github.workspace }}/llvm-project/llvm/ \ |
| 45 | + -D LLVM_ENABLE_PROJECTS=clang \ |
| 46 | + -D LLVM_TARGETS_TO_BUILD="host" \ |
| 47 | + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ |
| 48 | + -G Ninja |
| 49 | + cd ${{ github.workspace }}/llvm-project/build/ |
| 50 | + ninja -t targets all | grep "CommonTableGen: phony$" | grep -v "/" | sed 's/:.*//' |
| 51 | +
|
| 52 | + - name: Configure ids |
| 53 | + run: | |
| 54 | + cmake -B ${{ github.workspace }}/ids/build/ \ |
| 55 | + -S ${{ github.workspace }}/ids/ \ |
| 56 | + -D CMAKE_BUILD_TYPE=Release \ |
| 57 | + -D CMAKE_C_COMPILER=clang \ |
| 58 | + -D CMAKE_CXX_COMPILER=clang++ \ |
| 59 | + -D CMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld \ |
| 60 | + -D LLVM_DIR=/usr/lib/llvm-18/lib/cmake/llvm/ \ |
| 61 | + -D Clang_DIR=/usr/lib/llvm-18/lib/cmake/clang/ \ |
| 62 | + -D FILECHECK_EXECUTABLE=$(which FileCheck-18) \ |
| 63 | + -D LIT_EXECUTABLE=$(which lit) |
| 64 | +
|
| 65 | + - name: Build ids |
| 66 | + run: | |
| 67 | + cmake --build ${{ github.workspace }}/ids/build \ |
| 68 | + --config Release \ |
| 69 | + --parallel $(nproc --all) |
| 70 | +
|
| 71 | + - name: Run ids over compilation database |
| 72 | + run: | |
| 73 | + cd ${{ github.workspace }}/llvm-project |
| 74 | + export H_OR_CPP_FILES_CHANGED_LAST_COMMIT=$(git diff --name-only HEAD~1 HEAD -- '*.cpp' '*.h') |
| 75 | + if [ ! -z "${H_OR_CPP_FILES_CHANGED_LAST_COMMIT}" ]; then |
| 76 | + ${{ github.workspace }}/ids/build/bin/idt -p ${{ github.workspace }}/llvm-project/build/compile_commands.json --export-macro=LLVM_ABI $(git diff --name-only HEAD~1 HEAD -- '*.cpp' '*.h') |
| 77 | + fi |
0 commit comments