-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
29 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 |
---|---|---|
@@ -1,51 +1,42 @@ | ||
name: "CodeQL Analysis for Anvilock in Fedora" | ||
|
||
name: CodeQL Analysis for Anvilock in Fedora | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
codeql: | ||
runs-on: ubuntu-latest # GitHub Actions runner (Ubuntu, but we will use Fedora inside Docker) | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ "c" ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
|
||
- name: CodeQL Analysis in Fedora (Docker) | ||
run: | | ||
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace fedora:latest bash -c " | ||
# Update and install necessary dependencies | ||
dnf update -y && | ||
dnf install -y gcc make cmake wget curl git && | ||
# Install CodeQL CLI inside the container | ||
wget https://github.com/github/codeql-action/releases/download/v2.6.0/codeql-linux64.tar.gz && | ||
tar -xzf codeql-linux64.tar.gz && | ||
export PATH=\$PWD/codeql-linux64/codeql:\$PATH && | ||
# Run the build script | ||
cd .github/workflows/ && | ||
chmod +x build-fedora.sh && | ||
./build-fedora.sh && | ||
# Initialize and run CodeQL analysis | ||
codeql database init --language=c --db-dir=codeql-database && | ||
codeql database analyze --db-dir=codeql-database --format=sarif-latest --output=codeql-results.sarif" | ||
- name: Upload CodeQL results | ||
uses: github/codeql-action/upload-results@v2 | ||
dnf update -y && | ||
dnf install -y gcc make cmake codeql && | ||
cd .github/workflows/ && | ||
chmod +x build-fedora.sh && | ||
./build-fedora.sh && | ||
cd /workspace && | ||
codeql database create cpp-db --language=cpp && | ||
codeql database analyze cpp-db --format=sarif-latest --output=cpp-analysis.sarif" | ||
- name: Upload SARIF file | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
results-file: codeql-results.sarif | ||
|
||
sarif_file: cpp-analysis.sarif |