CodeQL #132
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CodeQL workflow | |
name: CodeQL | |
on: | |
schedule: | |
- cron: '0 6 * * 6' # Every saturday at 06:00 | |
workflow_dispatch: | |
jobs: | |
analyze-cpp: | |
name: Analyze C++ Code | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 11 | |
- name: Setup latest GCC and build dependencies | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa | |
sudo apt update | |
sudo apt install gcc-13 g++-13 | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 110 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-13 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-13 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-13 | |
- name: Setup Ninja | |
run: sudo apt-get install ninja-build | |
- name: Setup Mold | |
uses: rui314/setup-mold@v1 | |
- name: Setup CCache | |
uses: hendrikmuhs/ccache-action@v1 | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: cpp | |
- name: Cache LLVM | |
id: cache-llvm | |
uses: actions/cache@v3 | |
with: | |
path: /home/runner/work/spice/llvm | |
key: llvm-17.0.5 | |
- name: Setup LLVM | |
if: steps.cache-llvm.outputs.cache-hit != 'true' | |
run: | | |
echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH | |
cd .. | |
git clone --depth 1 --branch llvmorg-17.0.5 https://github.com/llvm/llvm-project llvm | |
mkdir ./llvm/build | |
cd ./llvm/build | |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_FLAGS_RELEASE="-O2" -DLLVM_ENABLE_RTTI=ON -GNinja ../llvm | |
cmake --build . -j$(nproc) | |
- name: Download Libs | |
run: | | |
chmod +x setup-libs.sh | |
./setup-libs.sh | |
- name: Build Test target | |
env: | |
LLVM_DIR: /home/runner/work/spice/llvm/build/lib/cmake/llvm | |
run: | | |
echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH | |
mkdir ./bin | |
cd ./bin | |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSPICE_BUILT_BY="ghactions" -DSPICE_LINK_STATIC=OFF -DSPICE_DEV_COMPILE=ON -GNinja -Wattributes .. | |
cmake --build . --target spicetest -j$(nproc) | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 |