1 name: Post-Commit Static Analyzer
13 - '.github/workflows/ci-post-commit-analyzer.yml'
21 - '.github/workflows/ci-post-commit-analyzer.yml'
22 - '.github/workflows/ci-post-commit-analyzer-run.py'
28 llvm-project-${{ github.workflow }}-${{ github.event_name == 'pull_request' &&
29 ( github.event.pull_request.number || github.ref) }}
30 cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
35 github.repository_owner == 'llvm' &&
36 github.event.action != 'closed'
39 image: 'ghcr.io/llvm/ci-ubuntu-22.04:latest'
43 - name: Checkout Source
44 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
47 uses: hendrikmuhs/ccache-action@v1
49 # A full build of llvm, clang, lld, and lldb takes about 250MB
50 # of ccache space. There's not much reason to have more than this,
51 # because we usually won't need to save cache entries from older
52 # builds. Also, there is an overall 10GB cache limit, and each
53 # run creates a new cache entry so we want to ensure that we have
54 # enough cache space for all the tests to run at once and still
55 # fit under the 10 GB limit.
56 # Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174
58 key: post-commit-analyzer
63 cmake -B build -S llvm -G Ninja \
64 -DLLVM_ENABLE_ASSERTIONS=ON \
65 -DLLVM_ENABLE_PROJECTS=clang \
66 -DLLVM_BUILD_LLVM_DYLIB=ON \
67 -DLLVM_LINK_LLVM_DYLIB=ON \
68 -DCMAKE_CXX_COMPILER=clang++ \
69 -DCMAKE_C_COMPILER=clang \
70 -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
71 -DCMAKE_C_COMPILER_LAUNCHER=sccache \
72 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
73 -DLLVM_INCLUDE_TESTS=OFF \
74 -DCLANG_INCLUDE_TESTS=OFF \
75 -DCMAKE_BUILD_TYPE=Release
79 # FIXME: We need to build all the generated header files in order to be able to run
80 # the analyzer on every file. Building libLLVM and libclang is probably overkill for
81 # this, but it's better than building every target.
82 ninja -v -C build libLLVM.so libclang.so
85 python3 .github/workflows/ci-post-commit-analyzer-run.py build/compile_commands.json
87 scan-build --generate-index-only build/analyzer-results
89 - name: Upload Results
90 uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
93 name: analyzer-results
94 path: 'build/analyzer-results/*'