Skip to content

Commit 5f888d5

Browse files
committed
Enabled CodeQL scanning
1 parent 40ee8ac commit 5f888d5

File tree

1 file changed

+78
-40
lines changed

1 file changed

+78
-40
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 78 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,58 +12,96 @@
1212
name: "CodeQL"
1313

1414
on:
15+
push:
16+
branches: [ "master", "release-[0-9].[0-9]", "v[1-3]*" ]
17+
pull_request:
18+
branches: [ "master", "release-[0-9].[0-9]", "v[1-3]*" ]
1519
schedule:
16-
- cron: '20 21 * * 6'
20+
- cron: '45 22 * * 5'
1721

1822
jobs:
1923
analyze:
20-
name: Analyze
21-
runs-on: ubuntu-latest
24+
name: CodeQL Scan (${{ matrix.language }})
25+
# Runner size impacts CodeQL analysis time. To learn more, please see:
26+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27+
# - https://gh.io/supported-runners-and-hardware-resources
28+
# - https://gh.io/using-larger-runners (GitHub.com only)
29+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
30+
runs-on: [self-hosted, nebula]
31+
timeout-minutes: 60
2232
permissions:
33+
# required for all workflows
34+
security-events: write
35+
36+
# required to fetch internal or private CodeQL packs
37+
packages: read
38+
39+
# only required for workflows in private repositories
2340
actions: read
2441
contents: read
25-
security-events: write
2642

2743
strategy:
2844
fail-fast: false
2945
matrix:
30-
language:
31-
- 'cpp'
32-
- 'python'
33-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
34-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
35-
46+
os:
47+
- ubuntu2004
48+
compiler:
49+
- gcc-9.3
50+
include:
51+
- language: c-cpp
52+
build-mode: "manual"
53+
env:
54+
CCACHE_DIR: /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
55+
CCACHE_MAXSIZE: 8G
56+
container:
57+
image: vesoft/nebula-dev:${{ matrix.os }}
58+
volumes:
59+
- /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
60+
options: --cap-add=SYS_PTRACE
3661
steps:
37-
- name: Checkout repository
38-
uses: actions/checkout@v3
39-
40-
# Initializes the CodeQL tools for scanning.
41-
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v2
43-
with:
44-
languages: ${{ matrix.language }}
45-
# If you wish to specify custom queries, you can do so here or in a config file.
46-
# By default, queries listed here will override any specified in a config file.
47-
# Prefix the list here with "+" to use these queries and those in the config file.
48-
49-
# 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
50-
# queries: security-extended,security-and-quality
51-
52-
53-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54-
# If this step fails, then you should remove it and run the build manually (see below)
55-
- name: Autobuild
56-
uses: github/codeql-action/autobuild@v2
57-
58-
# ℹ️ Command-line programs to run using the OS shell.
59-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
62+
- uses: webiny/action-post-run@3.0.0
63+
with:
64+
run: sh -c "find . -mindepth 1 -delete"
65+
- uses: actions/checkout@v3
66+
- name: Prepare environment
67+
id: prepare
68+
run: |
69+
[ -d build/ ] && rm -rf build/* || mkdir -p build
70+
make init -C tests
71+
# Initializes the CodeQL tools for scanning.
72+
- name: Initialize CodeQL
73+
uses: github/codeql-action/init@v3
74+
working-directory: build/
75+
with:
76+
languages: ${{ matrix.language }}
77+
build-mode: ${{ matrix.build-mode }}
78+
# If you wish to specify custom queries, you can do so here or in a config file.
79+
# By default, queries listed here will override any specified in a config file.
80+
# Prefix the list here with "+" to use these queries and those in the config file.
6081

61-
# If the Autobuild fails above, remove it and uncomment the following three lines.
62-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
82+
# 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
83+
# queries: security-extended,security-and-quality
6384

64-
# - run: |
65-
# echo "Run, Build Application using script"
66-
# ./location_of_script_within_repo/buildscript.sh
85+
- name: CMake
86+
id: cmake
87+
run: |
88+
cmake \
89+
-DCMAKE_CXX_COMPILER=$TOOLSET_GCC_DIR/bin/g++ \
90+
-DCMAKE_C_COMPILER=$TOOLSET_GCC_DIR/bin/gcc \
91+
-DNEBULA_USE_LINKER=gold \
92+
-DCMAKE_BUILD_TYPE=Debug \
93+
-DENABLE_TESTING=on \
94+
-GNinja \
95+
-B build
96+
- name: Make
97+
run: |
98+
ccache -z
99+
ninja -j $(nproc)
100+
ccache -s
101+
working-directory: build/
67102

68-
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@v2
103+
- name: Perform CodeQL Analysis
104+
uses: github/codeql-action/analyze@v3
105+
with:
106+
category: "/language:${{matrix.language}}"
107+
working-directory: build/

0 commit comments

Comments
 (0)