Skip to content

Commit

Permalink
Add CodeQL analysis workflow for main and development branches
Browse files Browse the repository at this point in the history
Set up CodeQL analysis to run on push and pull request events for both main and development branches.
Include static analysis for C language using CodeQL.

Signed-off-by: Tharun Kumar Merugu <quic_mtharu@quicinc.com>
  • Loading branch information
quic-mtharu authored and quic-bkumar committed Nov 13, 2024
1 parent bdb0bfe commit 880c627
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "CodeQL Advanced"

on:
push:
branches: [ "main", "development" ]
pull_request:
branches: [ "main", "development" ]

jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest

permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
# Analyzes C and C++ code using the commands in `Build C and C++ code`
- language: c-cpp
build-mode: manual

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install auto tools
run: |
sudo apt-get install automake
- name: Download Linaro tools and untar
run: |
wget -c https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu.tar.xz
tar xf gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu.tar.xz
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- if: ${{ matrix.build-mode == 'manual' }}
shell: bash
name: Set Up Build Environment and compile code for LE platform
run: |
# Set Up Build Environment
export PATH="$PWD/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu/bin/:$PATH"
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
export AS=aarch64-linux-gnu-as
export LD=aarch64-linux-gnu-ld
export RANLIB=aarch64-linux-gnu-ranlib
export STRIP=aarch64-linux-gnu-strip
# Compile the source code
chmod 777 gitcompile
./gitcompile --host=aarch64-linux-gnu
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

0 comments on commit 880c627

Please sign in to comment.