-
Notifications
You must be signed in to change notification settings - Fork 14
292 lines (262 loc) · 10.5 KB
/
ci.yml
File metadata and controls
292 lines (262 loc) · 10.5 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
name: CI
on:
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: read
pull-requests: read
id-token: write
jobs:
detect-changes:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
name: Detect Changes
outputs:
docs: ${{ steps.filter.outputs.docs }}
appkit: ${{ steps.filter.outputs.appkit }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
filters: |
docs:
- 'docs/**'
- 'packages/**'
appkit:
- '!docs/**'
lint_and_typecheck:
name: Lint & Type Check
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup JFrog npm
uses: ./.github/actions/setup-jfrog-npm
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Check generated types are up to date
run: |
pnpm run generate:types
if ! git diff --exit-code \
packages/shared/src/schemas/plugin-manifest.generated.ts \
packages/appkit/src/registry/types.generated.ts \
packages/appkit/src/plugins/ga-exports.generated.ts \
packages/appkit/src/plugins/beta-exports.generated.ts \
docs/docs/plugins/analytics.md \
docs/docs/plugins/files.md \
docs/docs/plugins/genie.md \
docs/docs/plugins/jobs.md \
docs/docs/plugins/lakebase.md \
docs/docs/plugins/model-serving.md \
docs/docs/plugins/server.md \
docs/docs/plugins/vector-search.md; then
echo "❌ Error: Generated files are out of sync with their source manifests/schemas."
echo ""
echo "To fix this:"
echo " 1. Run: pnpm run generate:types"
echo " 2. Review and commit the changes"
echo ""
exit 1
fi
- name: Build shared package dist (for sync:template CLI)
# `pnpm run sync:template` runs through `packages/shared/bin/appkit.js`
# which imports the built `packages/shared/dist/cli/index.js`. The
# lint job doesn't otherwise build, so build just shared's dist
# before invoking sync. We invoke tsdown directly rather than
# `pnpm --filter shared build:package` because the latter also
# re-runs `generate-schema-types.ts`, which writes the raw (unformatted)
# version of `plugin-manifest.generated.ts` and trips the biome
# check that runs immediately after. ~1s.
run: pnpm --filter shared exec tsdown --config tsdown.config.ts
- name: Check synced template manifest is up to date
run: |
pnpm run sync:template
if ! git diff --exit-code template/appkit.plugins.json; then
echo "❌ Error: template/appkit.plugins.json is out of sync with packages/appkit/src/plugins/<name>/manifest.json."
echo ""
echo "This usually happens when a plugin manifest's stability, resources, or display fields"
echo "are edited without running the sync step that regenerates the template manifest."
echo ""
echo "To fix this:"
echo " 1. Run: pnpm run sync:template"
echo " 2. Review and commit the changes"
echo ""
exit 1
fi
- name: Run Biome Check
run: pnpm run check
- name: Run Types Check
run: pnpm run typecheck
- name: Run Knip Check
run: pnpm run knip
- name: Run License Check
run: pnpm run check:licenses
- name: Check template deps are pinned
run: pnpm exec tsx tools/check-template-deps.ts
test:
name: Unit Tests
needs: detect-changes
if: needs.detect-changes.outputs.appkit == 'true'
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup JFrog npm
uses: ./.github/actions/setup-jfrog-npm
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Tests
run: pnpm test
playground-integration-test:
name: Playground Integration Tests
needs: detect-changes
if: needs.detect-changes.outputs.appkit == 'true'
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup JFrog npm
uses: ./.github/actions/setup-jfrog-npm
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright Browsers
run: pnpm --filter=dev-playground exec playwright install --with-deps chromium
- name: Build packages
run: pnpm build
- name: Run Integration Tests
run: pnpm --filter=dev-playground test:integration
env:
APPKIT_E2E_TEST: 'true'
DATABRICKS_WAREHOUSE_ID: e2e-mock
DATABRICKS_WORKSPACE_ID: e2e-mock
pr-template-artifact:
name: PR Template Artifact
needs: detect-changes
if: needs.detect-changes.outputs.appkit == 'true'
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup JFrog npm
uses: ./.github/actions/setup-jfrog-npm
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Set PR version
id: version
env:
BRANCH: ${{ github.head_ref }}
run: |
SANITIZED_BRANCH=$(echo "$BRANCH" | sed 's/[^a-zA-Z0-9-]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
CURRENT_VERSION=$(node -p "require('./packages/appkit/package.json').version")
PR_VERSION="${CURRENT_VERSION}-${SANITIZED_BRANCH}"
echo "version=$PR_VERSION" >> "$GITHUB_OUTPUT"
pnpm exec tsx tools/sync-versions.ts "$PR_VERSION"
- name: Build SDK tarballs
run: pnpm pack:sdk
- name: Prepare template artifact
run: pnpm exec tsx tools/prepare-template-artifact.ts --version "${{ steps.version.outputs.version }}"
- name: Install template dependencies
working-directory: pr-template
run: npm install
- name: Create zip artifact
working-directory: pr-template
run: zip -r ../pr-template.zip . -x 'node_modules/*'
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: appkit-template-${{ steps.version.outputs.version }}
path: pr-template.zip
docs-build:
name: Docs Build
needs: detect-changes
if: needs.detect-changes.outputs.docs == 'true'
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup JFrog npm
uses: ./.github/actions/setup-jfrog-npm
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Docs
run: pnpm run docs:build
- name: Check Generated Docs
run: pnpm run docs:check
- name: Check for uncommitted docs changes
run: |
if ! git diff --exit-code docs/docs/api/; then
echo "❌ Error: Generated docs are out of sync with the codebase."
echo ""
echo "The API documentation in docs/docs/api/ has changes after running docs:generate."
echo "This means the committed docs don't match the current package code."
echo ""
echo "To fix this:"
echo " 1. Run: pnpm docs:build"
echo " 2. Run: pnpm docs:check:fix"
echo " 3. Review and commit the changes"
echo ""
exit 1
fi
devhub-validation:
name: DevHub Build Validation
needs: detect-changes
if: needs.detect-changes.outputs.docs == 'true'
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup JFrog npm
uses: ./.github/actions/setup-jfrog-npm
- name: Clone DevHub
run: git clone --depth 1 https://github.com/databricks/devhub.git /tmp/devhub
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 22
- name: Install DevHub dependencies
working-directory: /tmp/devhub
run: npm install
- name: Sync AppKit docs from PR branch
working-directory: /tmp/devhub
env:
APPKIT_REMOTE: ${{ github.event.pull_request.head.repo.clone_url || format('https://github.com/{0}.git', github.repository) }}
APPKIT_BRANCH: ${{ github.head_ref || github.ref_name }}
run: node scripts/sync-appkit-docs.mjs --force
- name: Build DevHub
working-directory: /tmp/devhub
run: npm run build