Skip to content

Commit

Permalink
Enabled CodeQL scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
dutor committed Aug 14, 2024
1 parent 40ee8ac commit cdeab59
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: "CodeQL"

on:
pull_request:
types: [synchronize, reopened, labeled]
branches:
- master
- 'release-**'
schedule:
- cron: '45 22 * * 5'

concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
analyze:
name: CodeQL Scan (${{ matrix.language }})
# 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 (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: [self-hosted, nebula]
timeout-minutes: 60
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:
os:
- ubuntu2004
compiler:
- gcc-9.3
include:
- language: c-cpp
build-mode: "manual"
env:
CCACHE_DIR: /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
CCACHE_MAXSIZE: 8G
container:
image: vesoft/nebula-dev:${{ matrix.os }}
volumes:
- /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
options: --cap-add=SYS_PTRACE
steps:
- uses: webiny/action-post-run@3.0.0
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- name: Prepare environment
id: prepare
run: |
[ -d build/ ] && rm -rf build/* || mkdir -p build
make init -C tests
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
working-directory: build/
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# 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: CMake
id: cmake
run: |
cmake \
-DCMAKE_CXX_COMPILER=$TOOLSET_GCC_DIR/bin/g++ \
-DCMAKE_C_COMPILER=$TOOLSET_GCC_DIR/bin/gcc \
-DNEBULA_USE_LINKER=gold \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_TESTING=on \
-GNinja \
-B build
- name: Make
run: |
ccache -z
ninja -j $(nproc)
ccache -s
working-directory: build/

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
working-directory: build/

0 comments on commit cdeab59

Please sign in to comment.