Build project explicitly in codeql job #573
This file contains hidden or 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
name: codeql | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 5 * * 3' | |
jobs: | |
codeql: | |
runs-on: ubuntu-latest | |
name: "CodeQL" | |
env: | |
CC: gcc | |
CXX: g++ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: CodeQL Initialization | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: cpp | |
queries: +security-and-quality | |
- name: Install doctest | |
shell: bash | |
run: | | |
cd "${{ github.workspace }}" | |
git clone --depth=1 --branch=v2.4.11 https://github.com/doctest/doctest | |
cd doctest && mkdir -p build && cd build | |
cmake .. -DDOCTEST_WITH_TESTS=OFF -DDOCTEST_WITH_MAIN_IN_STATIC_LIB=OFF -DCMAKE_INSTALL_PREFIX="$HOME/.local" | |
make -j "$(nproc)" install | |
- name: Configure Project (for CodeQL) | |
shell: bash | |
run: cmake -S . -B codeql_build -D CMAKE_BUILD_TYPE=Release -D CMAKE_PREFIX_PATH="$HOME/.local" | |
- name: Build Project (for CodeQL) | |
shell: bash | |
run: cmake --build codeql_build -j "$(nproc)" | |
- name: CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 |