Repository navigation
260 lines (256 loc) · 11.4 KB
/
Copy pathapi-coverage.yml
File metadata and controls
260 lines (256 loc) · 11.4 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
name: Script API coverage
on:
pull_request:
paths:
- 'app/src/main/java/org/autojs/autojs/runtime/api/augment/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/modules/**'
- 'build-logic/ksp-script-modules-*/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/tts/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/speech/**'
- 'app/src/main/java/org/autojs/autojs/core/plugin/speech/**'
- 'app/src/main/java/org/autojs/autojs/core/plugin/epub/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/epub/**'
- 'plugin-api/epub-api/**'
- 'plugin-api/mail-api/**'
- 'app/src/main/java/org/autojs/autojs/core/plugin/mail/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/mail/**'
- 'app/src/main/java/org/autojs/autojs/engine/**'
- 'app/src/main/java/org/autojs/autojs/runtime/ScriptRuntime.kt'
- 'tools/api-coverage/**'
- 'docs/api-coverage/MATRIX.md'
- 'tools/ace-completion/**'
- '.github/workflows/api-coverage.yml'
push:
branches: [master]
paths:
- 'app/src/main/java/org/autojs/autojs/runtime/api/augment/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/modules/**'
- 'build-logic/ksp-script-modules-*/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/tts/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/speech/**'
- 'app/src/main/java/org/autojs/autojs/core/plugin/speech/**'
- 'app/src/main/java/org/autojs/autojs/core/plugin/epub/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/epub/**'
- 'plugin-api/epub-api/**'
- 'plugin-api/mail-api/**'
- 'app/src/main/java/org/autojs/autojs/core/plugin/mail/**'
- 'app/src/main/java/org/autojs/autojs/runtime/api/mail/**'
- 'app/src/main/java/org/autojs/autojs/engine/**'
- 'app/src/main/java/org/autojs/autojs/runtime/ScriptRuntime.kt'
- 'tools/api-coverage/**'
- 'docs/api-coverage/MATRIX.md'
- 'tools/ace-completion/**'
- '.github/workflows/api-coverage.yml'
workflow_dispatch:
inputs:
documentation_ref:
description: Documentation branch or commit (empty uses default branch)
required: false
declarations_ref:
description: Declaration branch or commit (empty uses default branch)
required: false
ace_ref:
description: Ace plugin branch or commit (empty uses default branch)
required: false
node_runtime_ref:
description: Node Runtime branch or commit (empty uses default branch)
required: false
bun_runtime_ref:
description: Bun Runtime branch or commit (empty uses default branch)
required: false
speech_plugin_ref:
description: Speech plugin branch or commit (empty uses default branch)
required: false
epub_plugin_ref:
description: EPUB plugin branch or commit (empty uses default branch)
required: false
mail_plugin_ref:
description: Mail plugin branch or commit (empty uses default branch)
required: false
imgui_plugin_ref:
description: ImGui plugin branch or commit (empty uses default branch)
required: false
permissions:
contents: read
concurrency:
group: api-coverage-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
coverage:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
path: AutoJs6
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Documentation
ref: ${{ inputs.documentation_ref }}
path: AutoJs6-Documentation
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-TypeScript-Declarations
ref: ${{ inputs.declarations_ref }}
path: AutoJs6-TypeScript-Declarations
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Ace-Editor
ref: ${{ inputs.ace_ref }}
path: AutoJs6-Plugin-Ace-Editor
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-NodeJs-Runtime
ref: ${{ inputs.node_runtime_ref }}
path: AutoJs6-Plugin-NodeJs-Runtime
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Bun-Runtime
ref: ${{ inputs.bun_runtime_ref }}
path: AutoJs6-Plugin-Bun-Runtime
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Bundled-Libraries
path: AutoJs6-Plugin-Bundled-Libraries
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Three-Macaw-Speech
ref: ${{ inputs.speech_plugin_ref }}
path: AutoJs6-Plugin-Three-Macaw-Speech
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Three-Folio-EPUB
ref: ${{ inputs.epub_plugin_ref }}
path: AutoJs6-Plugin-Three-Folio-EPUB
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Three-Stamp-Mail
ref: ${{ inputs.mail_plugin_ref }}
path: AutoJs6-Plugin-Three-Stamp-Mail
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-ImGui
ref: ${{ inputs.imgui_plugin_ref }}
path: AutoJs6-Plugin-ImGui
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Python-Runtime
path: AutoJs6-Plugin-Python-Runtime
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Java-Runtime
path: AutoJs6-Plugin-Java-Runtime
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Kotlin-Runtime
path: AutoJs6-Plugin-Kotlin-Runtime
lfs: false
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/AutoJs6-Plugin-Lua-Runtime
path: AutoJs6-Plugin-Lua-Runtime
lfs: false
- uses: actions/setup-node@v4
with:
node-version: '24'
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up JDK 21 and Gradle dependency cache
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
cache-dependency-path: |
AutoJs6/**/*.gradle*
AutoJs6/**/gradle-wrapper.properties
- name: Build script module metadata (script-modules.json)
working-directory: AutoJs6
env:
GRADLE_CI_TIMEOUT_SECONDS: '1200'
run: |
chmod +x gradlew
bash .github/scripts/run-gradle-ci.sh ./gradlew :app:kspAppDebugKotlin --no-daemon --build-cache --console=plain --stacktrace
- name: Test registration extraction and compare public surfaces
working-directory: AutoJs6
run: |
python -m unittest discover -s tools/api-coverage -p 'test_*.py'
node tools/api-coverage/test-dts-types.mjs
python tools/api-coverage/check.py --source ksp --matrix --strict-arity --strict-types --docs-support
node tools/api-coverage/check-runtime-java-callbacks.mjs
node tools/api-coverage/check-runtime-tts.mjs
node tools/api-coverage/check-runtime-speech.mjs
node tools/api-coverage/check-runtime-plugin-family.mjs
node tools/api-coverage/check-runtime-epub.mjs
node tools/api-coverage/check-runtime-mail.mjs
node tools/api-coverage/check-runtime-flow.mjs
node tools/api-coverage/check-runtime-ai.mjs
node tools/api-coverage/check-runtime-ai-agent.mjs
node tools/api-coverage/check-runtime-js-tools.mjs
node tools/api-coverage/check-runtime-files-data.mjs
node tools/api-coverage/check-runtime-app-shell.mjs
node tools/api-coverage/check-runtime-system.mjs
node tools/api-coverage/check-runtime-device-media.mjs
node tools/api-coverage/check-runtime-automation.mjs
node tools/api-coverage/check-runtime-ui.mjs
node tools/api-coverage/check-bun-js-tools.mjs
node tools/api-coverage/check-bun-files-data.mjs
node tools/api-coverage/check-bun-app-shell.mjs
node tools/api-coverage/check-bun-system.mjs
node tools/api-coverage/check-bun-device-media.mjs
node tools/api-coverage/check-bun-automation-family.mjs
node tools/api-coverage/check-bun-ui-family.mjs
- name: Check language runtime APIs against their documentation pages, type stubs and the host Entry API
working-directory: AutoJs6
run: python tools/api-coverage/language_runtimes.py
- name: Check Ace runtime completion against the runtime matrix
working-directory: AutoJs6-Plugin-Ace-Editor
run: |
node tools/ace-lsp/generate-runtime-api-queries.mjs --check --host ../AutoJs6
node tools/ace-lsp/verify-runtime-api-coverage.mjs --fresh
- name: Check runtime declaration digests (declarations and Ace copies)
working-directory: AutoJs6-TypeScript-Declarations
run: |
compiler="$(node -p "const p=require('node:path');const a=p.resolve('../AutoJs6-Plugin-Ace-Editor');p.join(a,require(p.join(a,'tools/ace-lsp/ace-builds-lock.json')).assetRoot,'autojs6/typescript/typescript.js')")"
node tools/sync-runtime-declarations.mjs --check --ace ../AutoJs6-Plugin-Ace-Editor
node tools/verify-runtime-declarations.mjs "$compiler" --ace ../AutoJs6-Plugin-Ace-Editor
- name: Check handwritten types and conditional extensions
working-directory: AutoJs6-TypeScript-Declarations
run: |
node --input-type=module <<'NODE'
import fs from 'node:fs';
import path from 'node:path';
import {spawnSync} from 'node:child_process';
const plugin = path.resolve('../AutoJs6-Plugin-Ace-Editor');
const lock = JSON.parse(fs.readFileSync(path.join(plugin, 'tools/ace-lsp/ace-builds-lock.json'), 'utf8'));
const compiler = path.join(plugin, lock.assetRoot, 'autojs6/typescript/typescript.js');
const result = spawnSync(process.execPath, ['tools/verify-api-coverage.mjs', '--typescript', compiler], {stdio: 'inherit'});
if (result.error) throw result.error;
process.exit(result.status ?? 1);
NODE
- uses: actions/upload-artifact@v4
if: always()
with:
name: runtime-coverage-matrix
path: |
AutoJs6/build/reports/api-coverage/runtime-matrix.json
AutoJs6/build/reports/api-coverage/summary.json
if-no-files-found: warn
- uses: actions/upload-artifact@v4
if: always()
with:
name: script-api-coverage
path: |
AutoJs6/build/reports/api-coverage/
AutoJs6/app/build/generated/ksp/appDebug/resources/autojs6/script-modules.json
if-no-files-found: warn