Skip to content

Commit 6663830

Browse files
committed
code-ql: Simplify the workflow
Signed-off-by: Tam Mach <[email protected]>
1 parent 0d1ca06 commit 6663830

File tree

1 file changed

+35
-45
lines changed

1 file changed

+35
-45
lines changed

.github/workflows/codeql.yml

+35-45
Original file line numberDiff line numberDiff line change
@@ -6,62 +6,48 @@ on:
66
jobs:
77
analyze:
88
name: Analyze
9-
runs-on: ubuntu-22.04
9+
runs-on: ${{ matrix.config.runner }}
1010
permissions:
1111
actions: read
1212
contents: read
1313
security-events: write
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
language: ['go', 'actions']
17+
config:
18+
- runner: ubuntu-24.04
19+
language: 'go'
20+
- runner: ubuntu-24.04
21+
language: 'go'
22+
- runner: ubuntu-latest-64-cores-256gb
23+
language: 'cpp'
1824
steps:
1925
- name: Checkout repository
2026
uses: actions/checkout@v4
2127
- name: Initialize CodeQL
2228
uses: github/codeql-action/init@v3
2329
with:
24-
languages: ${{ matrix.language }}
25-
- name: Autobuild
26-
uses: github/codeql-action/autobuild@v3
27-
- name: Perform CodeQL Analysis
28-
uses: github/codeql-action/analyze@v3
29-
with:
30-
category: '/language:${{matrix.language}}'
30+
languages: ${{ matrix.config.language }}
3131

32-
analyze-cpp:
33-
name: Analyze
34-
runs-on: ubuntu-latest-64-cores-256gb
35-
permissions:
36-
actions: read
37-
contents: read
38-
security-events: write
39-
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v4
42-
43-
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v3
45-
with:
46-
languages: 'cpp'
47-
48-
- name: Install deps (for C++)
49-
shell: bash
50-
run: |
51-
sudo apt-get update --error-on=any
52-
sudo apt-get install --yes \
53-
libtool cmake automake autoconf make ninja-build curl unzip \
54-
virtualenv openjdk-11-jdk build-essential libc++1
55-
mkdir -p bin/clang17
56-
cd bin/clang17
57-
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz
58-
tar -xf clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz --strip-components 1
32+
- name: Install deps (for C++)
33+
if: matrix.config.language == 'cpp'
34+
shell: bash
35+
run: |
36+
sudo apt-get update --error-on=any
37+
sudo apt-get install --yes \
38+
libtool cmake automake autoconf make ninja-build curl unzip \
39+
virtualenv openjdk-11-jdk build-essential libc++1
40+
mkdir -p bin/clang17
41+
cd bin/clang17
42+
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz
43+
tar -xf clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz --strip-components 1
5944
60-
- name: Build (for C++)
61-
run: |
62-
bazel/setup_clang.sh bin/clang17
63-
bazelisk shutdown
64-
bazel build \
45+
- name: Build (for C++)
46+
if: matrix.config.language == 'cpp'
47+
run: |
48+
bazel/setup_clang.sh bin/clang17
49+
bazelisk shutdown
50+
bazel build \
6551
-c fastbuild \
6652
--spawn_strategy=local \
6753
--discard_analysis_cache \
@@ -71,7 +57,11 @@ jobs:
7157
--config=ci \
7258
//cilium/...
7359
74-
- name: Perform CodeQL Analysis
75-
uses: github/codeql-action/analyze@v3
76-
with:
77-
category: '/language:cpp'
60+
- name: Autobuild
61+
if: matrix.config.language != 'cpp'
62+
uses: github/codeql-action/autobuild@v3
63+
64+
- name: Perform CodeQL Analysis
65+
uses: github/codeql-action/analyze@v3
66+
with:
67+
category: '/language:${{matrix.config.language}}'

0 commit comments

Comments
 (0)