Skip to content

Commit ab0b020

Browse files
committed
Add CodeQL
1 parent 3c34cac commit ab0b020

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

.github/workflows/codeql.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "trunk" ]
6+
pull_request:
7+
branches: [ "*" ]
8+
schedule:
9+
- cron: '33 23 * * 4'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze (${{ matrix.language }})
14+
# Runner size impacts CodeQL analysis time. To learn more, please see:
15+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
16+
# - https://gh.io/supported-runners-and-hardware-resources
17+
# - https://gh.io/using-larger-runners (GitHub.com only)
18+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
19+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
20+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
21+
permissions:
22+
# required for all workflows
23+
security-events: write
24+
25+
# required to fetch internal or private CodeQL packs
26+
packages: read
27+
28+
# only required for workflows in private repositories
29+
actions: read
30+
contents: read
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include:
36+
- language: java-kotlin
37+
build-mode: manual
38+
- language: ruby
39+
build-mode: none
40+
- language: swift
41+
build-mode: autobuild
42+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
43+
# Use `c-cpp` to analyze code written in C, C++ or both
44+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
45+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
46+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
47+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
48+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
49+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
54+
- if: matrix.language == 'java-kotlin'
55+
uses: actions/setup-java@v4
56+
with:
57+
java-version: '17'
58+
distribution: corretto
59+
60+
# Initializes the CodeQL tools for scanning.
61+
- name: Initialize CodeQL
62+
uses: github/codeql-action/init@v3
63+
with:
64+
languages: ${{ matrix.language }}
65+
build-mode: ${{ matrix.build-mode }}
66+
# If you wish to specify custom queries, you can do so here or in a config file.
67+
# By default, queries listed here will override any specified in a config file.
68+
# Prefix the list here with "+" to use these queries and those in the config file.
69+
70+
# 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
71+
# queries: security-extended,security-and-quality
72+
73+
- name: Install NDK
74+
if: matrix.language == 'java-kotlin'
75+
uses: nttld/setup-ndk@v1
76+
with:
77+
ndk-version: "r25b"
78+
link-to-sdk: true
79+
80+
- name: Prepare Kotlin Project
81+
if: matrix.language == 'java-kotlin'
82+
shell: bash
83+
run: |
84+
make setup-rust-android-targets
85+
cd native/kotlin
86+
./gradlew cargoBuildAll --info
87+
88+
- name: Perform CodeQL Analysis
89+
if: matrix.language == 'java-kotlin'
90+
uses: github/codeql-action/analyze@v3
91+
with:
92+
category: "/language:${{matrix.language}}"
93+
94+
- name: Prepare Swift Project
95+
if: matrix.language == 'swift'
96+
shell: bash
97+
run: make setup-rust xcframework
98+
99+
- name: Perform CodeQL Analysis
100+
uses: github/codeql-action/analyze@v3
101+
with:
102+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)