forked from A-EDev/Flow
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (85 loc) · 2.89 KB
/
Copy pathcodeql.yml
File metadata and controls
97 lines (85 loc) · 2.89 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
name: CodeQL
# Only Kotlin/Java sources and the build definition affect the analysis, so
# translation-only and documentation pushes are skipped. Unlike build.yml this
# workflow never runs on tags, so path filters here cannot skip a release.
on:
push:
branches: [ main ]
paths:
- '**/*.kt'
- '**/*.java'
- '**/*.gradle.kts'
- 'gradle/libs.versions.toml'
- '.github/workflows/codeql.yml'
pull_request:
branches: [ main ]
paths:
- '**/*.kt'
- '**/*.java'
- '**/*.gradle.kts'
- 'gradle/libs.versions.toml'
- '.github/workflows/codeql.yml'
schedule:
# Weekly, so newly published queries still run against a quiet main.
- cron: '27 4 * * 1'
workflow_dispatch:
concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
analyze:
name: Analyze Kotlin/Java
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
security-events: write
actions: read
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up JDK 17
uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'temurin'
# Caching is disabled deliberately. CodeQL extracts Kotlin by observing
# the compiler as it runs, so a cache hit that makes the compile tasks
# UP-TO-DATE would produce an empty database and fail the analysis.
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
with:
cache-disabled: true
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# build-mode "none" cannot be used here: buildless extraction supports
# Java only and silently drops Kotlin, which is effectively this entire
# codebase. Kotlin requires a real build.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: java-kotlin
build-mode: manual
- name: Build for extraction
run: >
./gradlew :app:assembleGithubDebug
--no-build-cache --stacktrace
# The Gradle and Kotlin compile daemons stay resident after the build.
# Left running, they hold enough heap that CodeQL's query evaluation --
# which by default claims most of the runner's memory -- OOM-killed the
# runner ("The runner has received a shutdown signal").
- name: Stop Gradle and Kotlin daemons
run: |
./gradlew --stop || true
pkill -f KotlinCompileDaemon || true
free -h || true
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v4
with:
category: /language:java-kotlin
# Explicit cap rather than the default "most of the runner", which
# left no headroom on a 16 GB standard runner.
ram: 10240
threads: 4