Skip to content

Commit

Permalink
Add codeql and using new build script
Browse files Browse the repository at this point in the history
  • Loading branch information
linxie47 committed Dec 13, 2024
1 parent 8b7320c commit 8009c71
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 2 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
schedule:
- cron: '19 6 * * 0'

permissions:
contents: read

jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ${{ matrix.runner-os }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
runner-os: [ 'ubuntu-22.04' ]
language: [c-cpp]
build-mode: [manual]
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages

defaults:
run:
shell: bash

steps:
- name: 'Harden Runner'
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- name: Checkout repository
#uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2

- name: Check disk space
run: df -h

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
#uses: github/codeql-action/init@v3
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
languages: ${{ matrix.language }}
# 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: Git config
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
- name: Build
run: |
chmod a+x ./build.sh
./build.sh --ov_version 2024.5
echo 'build ivsr completed!'
- name: Perform CodeQL Analysis
#uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
category: "/language:${{matrix.language}}"
7 changes: 5 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ prepare_dependencies() {
apt-utils gpg-agent software-properties-common wget python3-dev libpython3-dev python3-pip
}

install_openvino_from_source() {
config_git_users() {
if [ -z "$(git config --global user.name)" ]; then
git config --global user.name "no name"
fi

if [ -z "$(git config --global user.email)" ]; then
git config --global user.email "noname@example.com"
fi
}

install_openvino_from_source() {
echo "Start building OpenVINO"

ov_repo=https://github.com/openvinotoolkit/openvino.git
Expand Down Expand Up @@ -101,7 +103,7 @@ build_install_ivsr_sdk() {

build_ffmpeg() {
echo "Building FFMPEG with specific libraries support..."
sudo apt-get update && \
sudo -E apt-get update && \
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends \
ca-certificates tar g++ wget pkg-config nasm yasm libglib2.0-dev flex bison gobject-introspection libgirepository1.0-dev \
python3-dev libx11-dev libxv-dev libxt-dev libasound2-dev libpango1.0-dev libtheora-dev libvisual-0.4-dev libgl1-mesa-dev \
Expand Down Expand Up @@ -162,6 +164,7 @@ main() {
done

prepare_dependencies
config_git_users
if [ "$ov_version" = "2022.3" ]; then
install_openvino_from_source
else
Expand Down

0 comments on commit 8009c71

Please sign in to comment.