forked from OpenXRay/xray-16
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub Actions: Add CodeQL code scanning
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "dev" ] | ||
pull_request: | ||
branches: [ "dev" ] | ||
schedule: | ||
- cron: '0 3 * * 1' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
# Runner size impacts CodeQL analysis time. To learn more, please see: | ||
# - https://gh.io/recommended-hardware-resources-for-running-codeql | ||
# - https://gh.io/supported-runners-and-hardware-resources | ||
# - https://gh.io/using-larger-runners | ||
# Consider using larger runners for possible analysis time improvements. | ||
runs-on: 'ubuntu-latest' | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Deinit Crypto++ | ||
run: git submodule deinit Externals/cryptopp | ||
|
||
- name: Install packages | ||
run: | | ||
sudo apt-get update -qq | ||
sudo apt-get install -qq -y libsdl2-dev libglew-dev liblzo2-dev libjpeg-dev && | ||
sudo apt-get install -qq -y libopenal-dev libogg-dev libtheora-dev libvorbis-dev | ||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: 'c-cpp' | ||
# 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. | ||
|
||
# For more 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: Run CMake | ||
run: cmake -B build -DCMAKE_C_FLAGS="-w" -DCMAKE_CXX_FLAGS="-w" -DCMAKE_UNITY_BUILD=ON -DUSE_LTO=OFF | ||
|
||
- name: Run CMake Build | ||
run: cmake --build build --parallel $(nproc || echo 4) | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
upload: false | ||
output: sarif-results | ||
|
||
- name: filter-sarif | ||
uses: advanced-security/filter-sarif@v1 | ||
with: | ||
patterns: | | ||
-**/Externals/** | ||
input: sarif-results/cpp.sarif | ||
output: sarif-results/cpp.sarif | ||
|
||
- name: Upload SARIF | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: sarif-results/cpp.sarif |