Repository navigation
82 lines (76 loc) · 2.97 KB
/
Copy pathcodeql.yml
File metadata and controls
82 lines (76 loc) · 2.97 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
name: CodeQL
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "17 4 * * 1"
permissions:
contents: read
concurrency:
group: codeql-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
# Replaces CodeQL's default setup, which scanned the Android app's Java without its dependencies:
# Capacitor's Gradle files only exist after `cap sync`, so half the calls had no known target.
# Here the phone app is built first, so the Java analysis sees Android and Capacitor.
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: javascript-typescript
build-mode: none
- language: java-kotlin
build-mode: manual
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# Java: the APK the way `bun run android` builds it, without any keys.
- if: matrix.build-mode == 'manual'
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- if: matrix.build-mode == 'manual'
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- if: matrix.build-mode == 'manual'
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
distribution: temurin
java-version: 21
- if: matrix.build-mode == 'manual'
name: Build the Android app
run: |
bun install --frozen-lockfile
bun run build:mobile
bunx cap sync android
cd mobile/android
sh ./gradlew assembleDebug --no-daemon
# Alerts only for our code: the build compiles Capacitor's Java from node_modules, and
# paths-ignore has no effect on compiled languages, so its results are dropped here.
- uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
category: /language:${{ matrix.language }}
upload: never
output: sarif-results
- name: Drop results in dependencies
run: |
for f in sarif-results/*.sarif; do
jq '.runs[].results |= map(select(any(.locations[]?; .physicalLocation.artifactLocation.uri | startswith("node_modules/")) | not))' "$f" > "$f.tmp"
mv "$f.tmp" "$f"
done
- uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
sarif_file: sarif-results
category: /language:${{ matrix.language }}