diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..2fab649 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,49 @@ +# This workflow replaces the repository-settings-generated CodeQL setup. +# Running the job in a container avoids workspace permission issues on +# self-hosted runners and keeps the build environment fully isolated. +name: CodeQL + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: '0 6 * * 1' + +jobs: + analyze: + name: Analyze (cpp) + runs-on: self-hosted + + container: + image: buildpack-deps:jammy + + defaults: + run: + shell: bash + + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: Configure Git safe directory + run: git config --global --add safe.directory '*' + + - name: Checkout + uses: actions/checkout@v6 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: cpp + + - name: Build + run: | + make clean || true # tolerate missing or no-op clean target + make -j"$(nproc)" + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4