name: code-analysis

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  CodeQL-Build:
    runs-on: ubuntu-latest

    permissions:
      security-events: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        
      - name: Configure
        uses: ./.github/actions/configure-linux

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: cpp
          queries: security-and-quality

      - name: Build
        run: make -j $(nproc)

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3