Skip to content

Commit 49adab7

Browse files
authored
Merge pull request #21527 from oleiman/xform/sdk/core-5638/js-sr-integration-test
Transform JS SR integration test
2 parents dfa12c0 + 48f4edb commit 49adab7

File tree

9 files changed

+698
-24
lines changed

9 files changed

+698
-24
lines changed

.github/workflows/transform-sdk-build.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ jobs:
258258
steps:
259259
- name: Check out code
260260
uses: actions/checkout@v4
261+
- name: Install node
262+
uses: actions/setup-node@v4
263+
with:
264+
node-version: 20
261265
- name: Build integration tests
262266
working-directory: src/transform-sdk/js
263267
run: |
@@ -267,6 +271,8 @@ jobs:
267271
cmake --build --preset release-static -- redpanda_js_transform
268272
cat identity.js | python3 generate_js_provider.py > identity_source.wat
269273
cat identity_logging.js | python3 generate_js_provider.py > logging_source.wat
274+
(cd schema_registry_example && npm install && npm run build)
275+
cat schema_registry_example/dist/schema_registry_example.js | python3 generate_js_provider.py > sr_source.wat
270276
curl -SLO https://github.com/WebAssembly/binaryen/releases/download/version_${{ env.BINARYEN_VERSION }}/binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz
271277
tar xf binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz
272278
rm binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz
@@ -280,6 +286,11 @@ jobs:
280286
./logging_source.wat redpanda_js_provider \
281287
-mvp --enable-simd --enable-bulk-memory --enable-multimemory \
282288
-o logging.wasm
289+
./binaryen-version_117/bin/wasm-merge \
290+
./build/release-static/redpanda_js_transform js_vm \
291+
./sr_source.wat redpanda_js_provider \
292+
-mvp --enable-simd --enable-bulk-memory --enable-multimemory \
293+
-o sr.wasm
283294
- name: Download integration test suite
284295
uses: actions/download-artifact@v4
285296
with:
@@ -291,7 +302,7 @@ jobs:
291302
IDENTITY: identity.wasm
292303
LOGGING: logging.wasm
293304
TEE: "@UNIMPLEMENTED@"
294-
SCHEMA_REGISTRY: "@UNIMPLEMENTED@"
305+
SCHEMA_REGISTRY: sr.wasm
295306
run: |
296307
chmod +x wasm-integration-test
297308
./wasm-integration-test -test.v
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
node_modules/**/*
3+
user_code.js
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as esbuild from 'esbuild'
2+
import { polyfillNode } from "esbuild-plugin-polyfill-node";
3+
4+
await esbuild.build({
5+
entryPoints: ["src/index.ts"],
6+
outfile: "dist/schema_registry_example.js",
7+
bundle: true,
8+
external: [
9+
// This package is provided by the Redpanda JavaScript runtime.
10+
"@redpanda-data/transform-sdk",
11+
"@redpanda-data/transform-sdk-sr",
12+
],
13+
target: "es2022",
14+
platform: "neutral", // We're running in Wasm
15+
plugins: [
16+
polyfillNode({
17+
globals: {
18+
// Allow a global Buffer variable if referenced.
19+
buffer: true,
20+
// Don't inject the process global, the Redpanda JavaScript runtime
21+
// does that.
22+
process: false,
23+
},
24+
polyfills: {
25+
// Any NodeJS APIs that need to polyfilled can be added here.
26+
},
27+
}),
28+
],
29+
});

0 commit comments

Comments
 (0)