Update README.md #15
This file contains 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: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 1 * * *' # Schedule daily at 1am UTC | |
jobs: | |
analyze: | |
name: Analyze | |
runs-on: ${{ matrix.platform }} | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
language: [ 'cpp' ] | |
platform: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 # Updated to latest checkout action | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: ${{ matrix.language }} | |
- name: Install dependencies for Linux | |
if: matrix.platform == 'ubuntu-latest' | |
run: sudo apt-get install -y cmake build-essential | |
- name: Install dependencies for Windows | |
if: matrix.platform == 'windows-latest' | |
run: choco install cmake | |
- name: Install dependencies for macOS | |
if: matrix.platform == 'macos-latest' | |
run: brew install cmake | |
- name: Build the code | |
run: | | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release | |
cmake --build build --config Release | |
- name: Create CodeQL Database | |
run: | | |
codeql database create /home/runner/work/_temp/codeql_databases/cpp --language=cpp --command="cmake --build build" | |
- name: Perform CodeQL Analysis | |
run: | | |
codeql database analyze /home/runner/work/_temp/codeql_databases/cpp --format=sarifv2 --output=codeql-results.sarif | |
- name: Upload SARIF results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: codeql-sarif | |
path: codeql-results.sarif | |
- name: Upload SARIF results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: codeql-results.sarif |