Skip to content

Commit 0f9f6ef

Browse files
authored
Add CodeQL Advanced workflow for security analysis (#270)
1 parent 2583d50 commit 0f9f6ef

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

.github/workflows/ci-security.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ jobs:
2727
allowlist: |
2828
actions/
2929
PostHog/
30+
github/

.github/workflows/codeql.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
analyze:
13+
name: Analyze (${{ matrix.language }})
14+
runs-on: ${{ matrix.runner }}
15+
permissions:
16+
security-events: write
17+
packages: read
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- language: java-kotlin
23+
build-mode: manual
24+
runner: ubuntu-latest
25+
- language: swift
26+
build-mode: manual
27+
runner: macos-latest
28+
- language: actions
29+
build-mode: none
30+
runner: ubuntu-latest
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v6
34+
35+
- name: Setup Flutter (Swift)
36+
if: matrix.language == 'swift'
37+
uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0
38+
with:
39+
channel: 'stable'
40+
41+
- name: Setup Xcode (Swift)
42+
if: matrix.language == 'swift'
43+
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
44+
with:
45+
xcode-version: '16.4'
46+
47+
- name: Install dependencies (Swift)
48+
if: matrix.language == 'swift'
49+
run: |
50+
flutter pub get
51+
cd example
52+
flutter pub get
53+
54+
- name: Setup Java (Java/Kotlin)
55+
if: matrix.language == 'java-kotlin'
56+
uses: actions/setup-java@v5
57+
with:
58+
java-version: 17
59+
distribution: 'temurin'
60+
61+
- name: Setup Flutter (Java/Kotlin)
62+
if: matrix.language == 'java-kotlin'
63+
uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0
64+
with:
65+
channel: 'stable'
66+
67+
- name: Install dependencies (Java/Kotlin)
68+
if: matrix.language == 'java-kotlin'
69+
run: |
70+
flutter pub get
71+
cd example
72+
flutter pub get
73+
74+
- name: Initialize CodeQL
75+
uses: github/codeql-action/init@v4
76+
with:
77+
languages: ${{ matrix.language }}
78+
build-mode: ${{ matrix.build-mode }}
79+
queries: security-and-quality
80+
81+
- name: Build Android (Java/Kotlin)
82+
if: matrix.language == 'java-kotlin'
83+
working-directory: ./example
84+
run: flutter build apk
85+
86+
- name: Build iOS (Swift)
87+
if: matrix.language == 'swift'
88+
working-directory: ./example
89+
run: |
90+
flutter build ios --simulator --no-codesign --config-only
91+
cd ios
92+
pod install
93+
xcodebuild -workspace Runner.xcworkspace -scheme Runner -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' build
94+
95+
- name: Perform CodeQL Analysis
96+
uses: github/codeql-action/analyze@v4
97+
with:
98+
category: '/language:${{matrix.language}}'

0 commit comments

Comments
 (0)