Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform JS SR integration test #21527

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/transform-sdk-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Build integration tests
working-directory: src/transform-sdk/js
run: |
Expand All @@ -267,6 +271,8 @@ jobs:
cmake --build --preset release-static -- redpanda_js_transform
cat identity.js | python3 generate_js_provider.py > identity_source.wat
cat identity_logging.js | python3 generate_js_provider.py > logging_source.wat
(cd schema_registry_example && npm install && npm run build)
cat schema_registry_example/dist/schema_registry_example.js | python3 generate_js_provider.py > sr_source.wat
curl -SLO https://github.com/WebAssembly/binaryen/releases/download/version_${{ env.BINARYEN_VERSION }}/binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz
tar xf binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz
rm binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz
Expand All @@ -280,6 +286,11 @@ jobs:
./logging_source.wat redpanda_js_provider \
-mvp --enable-simd --enable-bulk-memory --enable-multimemory \
-o logging.wasm
./binaryen-version_117/bin/wasm-merge \
./build/release-static/redpanda_js_transform js_vm \
./sr_source.wat redpanda_js_provider \
-mvp --enable-simd --enable-bulk-memory --enable-multimemory \
-o sr.wasm
- name: Download integration test suite
uses: actions/download-artifact@v4
with:
Expand All @@ -291,7 +302,7 @@ jobs:
IDENTITY: identity.wasm
LOGGING: logging.wasm
TEE: "@UNIMPLEMENTED@"
SCHEMA_REGISTRY: "@UNIMPLEMENTED@"
SCHEMA_REGISTRY: sr.wasm
run: |
chmod +x wasm-integration-test
./wasm-integration-test -test.v
3 changes: 3 additions & 0 deletions src/transform-sdk/js/schema_registry_example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
node_modules/**/*
user_code.js
29 changes: 29 additions & 0 deletions src/transform-sdk/js/schema_registry_example/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as esbuild from 'esbuild'
import { polyfillNode } from "esbuild-plugin-polyfill-node";

await esbuild.build({
entryPoints: ["src/index.ts"],
outfile: "dist/schema_registry_example.js",
bundle: true,
external: [
// This package is provided by the Redpanda JavaScript runtime.
"@redpanda-data/transform-sdk",
"@redpanda-data/transform-sdk-sr",
],
target: "es2022",
platform: "neutral", // We're running in Wasm
plugins: [
polyfillNode({
globals: {
// Allow a global Buffer variable if referenced.
buffer: true,
// Don't inject the process global, the Redpanda JavaScript runtime
// does that.
process: false,
},
polyfills: {
// Any NodeJS APIs that need to polyfilled can be added here.
},
}),
],
});
Loading
Loading