Skip to content

CodeQL

CodeQL #1144

# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
name: "CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '41 10 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
language: [ 'cpp' ]
cmake-preset: [ 'linux' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install devscripts equivs -y # install mk-build-depends
sudo mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control
- name: Cache CMake build/dl folder
uses: actions/cache@v3
with:
path: ./build/dl
key: codeql-analysis-${{ hashFiles( 'lib/*' ) }}
# Sometimes the cache step just freezes forever
# so put a limit on it so that we can restart it earlier on failure
timeout-minutes: 10
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- name: Configure
run: |
cmake -B build/ --preset "${{ matrix.cmake-preset }}" \
-DBUILD_MNL_LIB=OFF -DBUILD_HOSTAPD=OFF -DBUILD_PCAP_LIB=OFF -DBUILD_SQLITE_LIB=OFF
- name: Build
run: |
# can't use --preset "${{ matrix.cmake-preset }}" since we want to specify a custom build dir
cmake --build build/ --parallel "$(($(nproc) + 1))"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2