Skip to content

Commit cdeab59

Browse files
authored
Enabled CodeQL scanning
1 parent 40ee8ac commit cdeab59

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: "CodeQL"
2+
3+
on:
4+
pull_request:
5+
types: [synchronize, reopened, labeled]
6+
branches:
7+
- master
8+
- 'release-**'
9+
schedule:
10+
- cron: '45 22 * * 5'
11+
12+
concurrency:
13+
group: ${{ github.head_ref }}
14+
cancel-in-progress: true
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
20+
jobs:
21+
analyze:
22+
name: CodeQL Scan (${{ matrix.language }})
23+
# Runner size impacts CodeQL analysis time. To learn more, please see:
24+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
25+
# - https://gh.io/supported-runners-and-hardware-resources
26+
# - https://gh.io/using-larger-runners (GitHub.com only)
27+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
28+
runs-on: [self-hosted, nebula]
29+
timeout-minutes: 60
30+
permissions:
31+
# required for all workflows
32+
security-events: write
33+
34+
# required to fetch internal or private CodeQL packs
35+
packages: read
36+
37+
# only required for workflows in private repositories
38+
actions: read
39+
contents: read
40+
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
os:
45+
- ubuntu2004
46+
compiler:
47+
- gcc-9.3
48+
include:
49+
- language: c-cpp
50+
build-mode: "manual"
51+
env:
52+
CCACHE_DIR: /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
53+
CCACHE_MAXSIZE: 8G
54+
container:
55+
image: vesoft/nebula-dev:${{ matrix.os }}
56+
volumes:
57+
- /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
58+
options: --cap-add=SYS_PTRACE
59+
steps:
60+
- uses: webiny/[email protected]
61+
with:
62+
run: sh -c "find . -mindepth 1 -delete"
63+
- uses: actions/checkout@v3
64+
- name: Prepare environment
65+
id: prepare
66+
run: |
67+
[ -d build/ ] && rm -rf build/* || mkdir -p build
68+
make init -C tests
69+
# Initializes the CodeQL tools for scanning.
70+
- name: Initialize CodeQL
71+
uses: github/codeql-action/init@v3
72+
working-directory: build/
73+
with:
74+
languages: ${{ matrix.language }}
75+
build-mode: ${{ matrix.build-mode }}
76+
# If you wish to specify custom queries, you can do so here or in a config file.
77+
# By default, queries listed here will override any specified in a config file.
78+
# Prefix the list here with "+" to use these queries and those in the config file.
79+
80+
# 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
81+
# queries: security-extended,security-and-quality
82+
83+
- name: CMake
84+
id: cmake
85+
run: |
86+
cmake \
87+
-DCMAKE_CXX_COMPILER=$TOOLSET_GCC_DIR/bin/g++ \
88+
-DCMAKE_C_COMPILER=$TOOLSET_GCC_DIR/bin/gcc \
89+
-DNEBULA_USE_LINKER=gold \
90+
-DCMAKE_BUILD_TYPE=Debug \
91+
-DENABLE_TESTING=on \
92+
-GNinja \
93+
-B build
94+
- name: Make
95+
run: |
96+
ccache -z
97+
ninja -j $(nproc)
98+
ccache -s
99+
working-directory: build/
100+
101+
- name: Perform CodeQL Analysis
102+
uses: github/codeql-action/analyze@v3
103+
with:
104+
category: "/language:${{matrix.language}}"
105+
working-directory: build/

0 commit comments

Comments
 (0)