Skip to content

Commit 7b22c57

Browse files
committed
Add CodeQL
1 parent 3c34cac commit 7b22c57

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

.github/workflows/codeql.yml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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+
- name: Install NDK
61+
if: matrix.language == 'java-kotlin'
62+
uses: nttld/setup-ndk@v1
63+
with:
64+
ndk-version: "r25b"
65+
link-to-sdk: true
66+
67+
- name: Prepare Kotlin Project
68+
if: matrix.language == 'java-kotlin'
69+
shell: bash
70+
run: |
71+
make setup-rust-android-targets
72+
cd native/kotlin
73+
./gradlew cargoBuild --info
74+
75+
- name: Prepare Swift Project
76+
if: matrix.language == 'swift'
77+
shell: bash
78+
run: make setup-rust xcframework
79+
80+
# Initializes the CodeQL tools for scanning.
81+
- name: Initialize CodeQL
82+
uses: github/codeql-action/init@v3
83+
with:
84+
languages: ${{ matrix.language }}
85+
build-mode: ${{ matrix.build-mode }}
86+
# If you wish to specify custom queries, you can do so here or in a config file.
87+
# By default, queries listed here will override any specified in a config file.
88+
# Prefix the list here with "+" to use these queries and those in the config file.
89+
90+
# 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
91+
# queries: security-extended,security-and-quality
92+
93+
- name: Perform CodeQL Analysis
94+
uses: github/codeql-action/analyze@v3
95+
with:
96+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)