forked from violetljj/blind-assist
-
Notifications
You must be signed in to change notification settings - Fork 0
312 lines (265 loc) · 11 KB
/
Copy pathandroid.yml
File metadata and controls
312 lines (265 loc) · 11 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
name: Android
on:
push:
branches: ["master"]
pull_request:
branches: ["**"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
repository-gates:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Check live repository hygiene and structure
env:
BASE_REF: ${{ github.event.pull_request.base.sha || github.event.before }}
run: pwsh -ExecutionPolicy Bypass -File ./scripts/check_repo_hygiene.ps1 -IncludeStructure
- name: Check live documentation index and authority links
run: pwsh -ExecutionPolicy Bypass -File ./scripts/check_docs_index.ps1
- name: Check open-source maintenance and public asset identity
run: pwsh -ExecutionPolicy Bypass -File ./scripts/check_open_source_readiness.ps1
- name: Smoke-test repository hygiene rules
run: pwsh -ExecutionPolicy Bypass -File ./scripts/test_repo_hygiene.ps1
- name: Smoke-test open-source readiness and release manifests
run: |
pwsh -ExecutionPolicy Bypass -File ./scripts/test_check_open_source_readiness.ps1
pwsh -ExecutionPolicy Bypass -File ./scripts/test_generate_release_manifest.ps1
- name: Smoke-test project structure rules
run: pwsh -ExecutionPolicy Bypass -File ./scripts/test_check_project_structure.ps1
- name: Smoke-test documentation index rules
run: pwsh -ExecutionPolicy Bypass -File ./scripts/test_check_docs_index.ps1
unit-tests-and-lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: "17"
cache: gradle
- name: Grant Gradle execute permission
run: chmod +x ./gradlew
- name: Run unit tests and lint
run: >-
./gradlew
--max-workers=2
"-Dorg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8"
:core:assist:test
:core:ustrf:test
:core:vision:testDebugUnitTest
:core:device:testDebugUnitTest
:core:ui:testDebugUnitTest
:feature:assist:testDebugUnitTest
:app:testDebugUnitTest
:app:lintDebug
:core:vision:lintDebug
:core:device:lintDebug
:core:ui:lintDebug
:feature:assist:lintDebug
- name: Ensure generated files are ignored
shell: pwsh
run: |
$status = git status --short
if ($status) {
Write-Host "Tracked or unignored files changed during CI:"
Write-Host $status
exit 1
}
formal-app:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: "17"
cache: gradle
- name: Grant Gradle execute permission
run: chmod +x ./gradlew
- name: Assemble formal App artifacts
run: >-
./gradlew
--max-workers=2
"-Dorg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8"
:app:assembleDebug
:app:assembleDebugAndroidTest
:app:bundleDebug
:app:mergeReleaseAssets
- name: Reject legacy TensorFlow Lite runtime dependencies
shell: pwsh
run: |
$gradleArgs = @(
'--max-workers=2',
'-Dorg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8'
)
$appDependencies = (& ./gradlew @gradleArgs :app:dependencies --configuration debugRuntimeClasspath) -join "`n"
if ($LASTEXITCODE -ne 0) {
throw "Could not inspect the app runtime dependency tree."
}
$benchmarkDependencies = (& ./gradlew @gradleArgs :device-benchmark:dependencies --configuration debugRuntimeClasspath) -join "`n"
if ($LASTEXITCODE -ne 0) {
throw "Could not inspect the benchmark runtime dependency tree."
}
$dependencyTrees = "$appDependencies`n$benchmarkDependencies"
if ($dependencyTrees -match 'org\.tensorflow:tensorflow-lite') {
throw "Legacy org.tensorflow:tensorflow-lite dependency detected."
}
- name: Verify APK 16KB page-size compatibility
shell: pwsh
run: |
pwsh -ExecutionPolicy Bypass -File ./scripts/verify_apk_16kb.ps1 -ArtifactPath ./app/build/outputs/apk/debug/app-debug.apk -AndroidSdkRoot $env:ANDROID_SDK_ROOT
$bundletool = Join-Path $env:RUNNER_TEMP 'bundletool-all-1.17.1.jar'
Invoke-WebRequest -Uri 'https://github.com/google/bundletool/releases/download/1.17.1/bundletool-all-1.17.1.jar' -OutFile $bundletool
$expectedBundletoolSha256 = '45881EAD13388872D82C4255B195488B7FC33F2CAC5A9A977B0AFC5E92367592'
$actualBundletoolSha256 = (Get-FileHash -LiteralPath $bundletool -Algorithm SHA256).Hash
if (-not $actualBundletoolSha256.Equals(
$expectedBundletoolSha256,
[System.StringComparison]::OrdinalIgnoreCase
)) {
throw "bundletool SHA-256 mismatch. Expected $expectedBundletoolSha256, got $actualBundletoolSha256."
}
pwsh -ExecutionPolicy Bypass -File ./scripts/verify_apk_16kb.ps1 -ArtifactPath ./app/build/outputs/bundle/debug/app-debug.aab -BundletoolPath $bundletool
- name: Verify replay assets stay out of release
shell: pwsh
run: |
$releaseAssets = './app/build/intermediates/assets/release/mergeReleaseAssets'
if (Test-Path (Join-Path $releaseAssets 'replay')) {
throw 'Debug-only replay assets leaked into the release asset set.'
}
- name: Ensure generated files are ignored
shell: pwsh
run: |
$status = git status --short
if ($status) {
Write-Host "Tracked or unignored files changed during CI:"
Write-Host $status
exit 1
}
ustrf:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: "17"
cache: gradle
- name: Grant Gradle execute permission
run: chmod +x ./gradlew
- name: Assemble USTRF artifacts
run: >-
./gradlew
--max-workers=2
"-Dorg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8"
:app:assembleUstrfExperiment
:ustrf-shadow-benchmark:assembleDebug
:ustrf-shadow-benchmark:compileDebugAndroidTestKotlin
- name: Ensure generated files are ignored
shell: pwsh
run: |
$status = git status --short
if ($status) {
Write-Host "Tracked or unignored files changed during CI:"
Write-Host $status
exit 1
}
npu-benchmark:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: "17"
cache: gradle
- name: Grant Gradle execute permission
run: chmod +x ./gradlew
- name: Assemble NPU candidate
run: >-
./gradlew
--max-workers=2
"-Dorg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8"
:npu-candidate:assembleDebug
- name: Assemble device benchmark
run: >-
./gradlew
--max-workers=2
"-Dorg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8"
:device-benchmark:assembleDebug
- name: Ensure generated files are ignored
shell: pwsh
run: |
$status = git status --short
if ($status) {
Write-Host "Tracked or unignored files changed during CI:"
Write-Host $status
exit 1
}
research-contracts-and-models:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up Python for model checks
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
- name: Run dependency-free research contract tests
run: python scripts/run_research_contract_tests.py
- name: Install TFLite inspection runtime
shell: pwsh
run: |
# Locked to the Python 3.12 Linux wheels used by this ubuntu-latest job.
$requirements = @'
ai-edge-litert==2.1.5 --hash=sha256:f1c6d8db4382890881baeb8ed13c0802ada022e0b104b0db8fccf31353899ee0
backports.strenum==1.2.8 --hash=sha256:fc297cb26971f7d5e15a478a06a78575197f81daea47975771b1aae996dcccf4
colorama==0.4.6 --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
flatbuffers==25.12.19 --hash=sha256:7634f50c427838bb021c2d66a3d1168e9d199b0607e6329399f04846d42e20b4
numpy==2.1.3 --hash=sha256:2312b2aa89e1f43ecea6da6ea9a810d06aae08321609d8dc0d0eda6d946a541b
protobuf==5.29.6 --hash=sha256:e3387f44798ac1106af0233c04fb8abf543772ff241169946f698b3a9a3d3ab9
tqdm==4.67.3 --hash=sha256:ee1e4c0e59148062281c49d80b25b67771a127c85fc9676d3be5f243206826bf
typing-extensions==4.15.0 --hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548
'@
$requirementsPath = Join-Path $env:RUNNER_TEMP 'tflite-inspection-requirements.txt'
[System.IO.File]::WriteAllText(
$requirementsPath,
$requirements + [Environment]::NewLine,
[System.Text.UTF8Encoding]::new($false)
)
python -m pip install --disable-pip-version-check --only-binary=:all: --require-hashes -r $requirementsPath
- name: Check TFLite model assets
run: python scripts/inspect_tflite.py
- name: Ensure generated files are ignored
shell: pwsh
run: |
$status = git status --short
if ($status) {
Write-Host "Tracked or unignored files changed during CI:"
Write-Host $status
exit 1
}