name: CodeQL on: schedule: - cron: '23 3 * * 1' workflow_dispatch: permissions: contents: read jobs: analyze: name: Analyze C++ runs-on: ubuntu-24.04 permissions: actions: read contents: read security-events: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: submodules: true - name: ccache uses: hendrikmuhs/ccache-action@f09c25b45002a07be2955cbe52e8cee55643f89d # v1.2.24 with: key: ${{ github.job }} - name: Install dependencies run: sudo apt-get update && sudo apt-get -y install libxrandr-dev libxinerama-dev libxcomposite-dev libxdamage-dev libxcursor-dev libxi-dev libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxxf86vm-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv2 libpulse-dev libpulse0 libfftw3-dev libfreetype-dev libdbus-1-dev libnode-dev wayland-scanner++ wayland-protocols libwayland-dev - name: Initialize CodeQL uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4 with: languages: c-cpp build-mode: manual queries: security-extended - name: Build run: | cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=1 -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build build --target linux-wallpaperengine -j"$(nproc)" - name: Perform CodeQL analysis uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4 with: category: /language:c-cpp upload: never output: sarif-results # paths-ignore does not apply to a manual C++ build, so third-party results are dropped from the SARIF here - name: Drop third-party results run: | python3 - <<'EOF' import glob, json skipped = ("src/External/", "build/") for name in glob.glob("sarif-results/*.sarif"): with open(name) as f: sarif = json.load(f) for run in sarif["runs"]: run["results"] = [ r for r in run.get("results", []) if not any( l["physicalLocation"]["artifactLocation"]["uri"].startswith(skipped) for l in r.get("locations", []) ) ] with open(name, "w") as f: json.dump(sarif, f) EOF - name: Upload results uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4 with: sarif_file: sarif-results category: /language:c-cpp