-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (102 loc) · 3.38 KB
/
codeql.yml
File metadata and controls
117 lines (102 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# 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'
on:
workflow_run:
workflows: [ 'IgrOS-Kernel CI/CD' ]
types:
- completed
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
max-parallel: 4
matrix:
arch: [ 'i386', 'x86_64' ]
compiler: [ 'clang++', 'g++' ]
# Environment variables
env:
IGROS_KERNEL_DIR_BUILD: "${{ github.workspace }}/build"
IGROS_KERNEL_DIR_INSTALL: "${{ github.workspace }}/install"
CCACHE_BASEDIR: "${{ github.workspace }}/.ccache"
CCACHE_DIR: "${{ github.workspace }}/.ccache/ccache"
CCACHE_COMPRESS: "true"
CCACHE_COMPRESSLEVEL: "6"
CCACHE_MAXSIZE: "200M"
CLICOLOR_FORCE: "1"
NINJA_STATUS: "[%p::%e\t%f/%t]\t"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# CodeQL initialize
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: c-cpp
# Install dependencies
- name: 'Install Dependencies'
shell: bash
run: |
sudo apt update
sudo apt install -y --no-install-recommends ccache cmake doxygen graphviz g++-multilib gcc-multilib mtools ninja-build xorriso
# Install Clang 16.0.0
- name: 'Install Clang 16.0.0'
shell: bash
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16 all
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 160
sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-16 160
# Restore Build Cache
- name: 'Restore Build Cache'
uses: actions/cache@v3
with:
path: ${{ env.IGROS_KERNEL_DIR_BUILD }}
key: build-${{ matrix.compiler }}-${{ matrix.arch }}-${{ github.sha }}
restore-keys: |
build-${{ matrix.compiler }}-${{ matrix.arch }}-
# Restore CCache Cache
- name: 'Restore CCache Cache'
uses: actions/cache@v3
with:
path: ${{ env.CCACHE_BASEDIR }}
key: ccache-${{ matrix.compiler }}-${{ matrix.arch }}-${{ github.sha }}
restore-keys: |
ccache-${{ matrix.compiler }}-${{ matrix.arch }}-
# Configure
- name: 'CMake Configure'
shell: bash
run: |
mkdir -p ${{ env.CCACHE_BASEDIR }}
cmake --preset="config-linux-${{ matrix.compiler }}-${{ matrix.arch }}-debug"
# Build
- name: 'CMake Build'
shell: bash
run: |
cmake --build --preset="build-linux-${{ matrix.compiler }}-${{ matrix.arch }}-debug" --target all --parallel
# Install
- name: 'CMake Install'
shell: bash
run: |
cmake --build --preset="build-linux-${{ matrix.compiler }}-${{ matrix.arch }}-debug" --target install
# CodeQL Analysis
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3