-
Notifications
You must be signed in to change notification settings - Fork 593
278 lines (278 loc) · 10.7 KB
/
transform-sdk-build.yml
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
---
# Copyright 2023 Redpanda Data, Inc.
#
# Use of this software is governed by the Business Source License
# included in the file licenses/BSL.md
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0
name: transform-sdk-build
on:
push:
tags: ['*']
branches: [dev, 'v*']
paths:
- 'src/transform-sdk/**'
- '.github/workflows/transform-sdk-build.yml'
pull_request:
branches: [dev, 'v*']
paths:
- 'src/transform-sdk/**'
- '.github/workflows/transform-sdk-build.yml'
env:
RUST_VERSION: '1.80'
GO_VERSION: '1.22'
TINYGO_VERSION: 'v0.31.0-rpk2'
BINARYEN_VERSION: '117'
jobs:
build-integration-tests:
name: Build integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: src/transform-sdk/go/transform/go.sum
- name: Build integration tests
working-directory: src/transform-sdk/tests
run: go test -c -o ./wasm-integration-test
- name: Upload integration test binary
uses: actions/upload-artifact@v4
with:
name: wasm-integration-test
path: src/transform-sdk/tests/wasm-integration-test
retention-days: 1
test-golang:
name: Test Golang Transform SDK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: src/transform-sdk/go/transform/go.sum
- name: Run tests
working-directory: src/transform-sdk/go/transform
run: go test -v ./...
- uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout 5m
working-directory: src/transform-sdk/go/transform
integration-test-golang:
name: Integration Test Golang Transform SDK
needs: [test-golang, build-integration-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: src/transform-sdk/go/transform/go.sum
- name: Set up Tinygo
working-directory: src/transform-sdk/go/transform
run: |
curl -S -s -L "https://github.com/redpanda-data/tinygo/releases/download/${{ env.TINYGO_VERSION }}/tinygo-linux-amd64.tar.gz" | tar -xvz
echo "$PWD/tinygo/bin" >> $GITHUB_PATH
- name: Build integration tests
working-directory: src/transform-sdk/go/transform/internal/testdata
run: |
tinygo build -scheduler=none -target=wasi -o identity.wasm ./identity
tinygo build -scheduler=none -target=wasi -o identity_logging.wasm ./identity_logging
tinygo build -scheduler=none -target=wasi -o tee.wasm ./tee
tinygo build -scheduler=none -target=wasi -o sr.wasm ./schema-registry
- name: Download integration test suite
uses: actions/download-artifact@v4
with:
name: wasm-integration-test
path: src/transform-sdk/go/transform/internal/testdata
- name: Run integration tests
working-directory: src/transform-sdk/go/transform/internal/testdata
env:
IDENTITY: identity.wasm
LOGGING: identity_logging.wasm
TEE: tee.wasm
SCHEMA_REGISTRY: sr.wasm
run: |
chmod +x wasm-integration-test
./wasm-integration-test -test.v
test-rust:
name: Test Rust Transform SDK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
run: |
rustup update --no-self-update ${{ env.RUST_VERSION }}
rustup component add --toolchain ${{ env.RUST_VERSION }} rustfmt rust-src clippy
rustup default ${{ env.RUST_VERSION }}
- name: Run tests
working-directory: src/transform-sdk/rust
run: cargo test --workspace
- name: Check format
working-directory: src/transform-sdk/rust
run: cargo fmt --check --all
- name: Run clippy
working-directory: src/transform-sdk/rust
run: cargo clippy --all
integration-test-rust:
name: Integration Test Rust Transform SDK
needs: [test-rust, build-integration-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
run: |
rustup update --no-self-update ${{ env.RUST_VERSION }}
rustup component add --toolchain ${{ env.RUST_VERSION }} rustfmt rust-src clippy
rustup default ${{ env.RUST_VERSION }}
rustup target add wasm32-wasi
- name: Build integration tests
working-directory: src/transform-sdk/rust
run: |
cargo build --target=wasm32-wasi --release \
--example=identity \
--example=identity_logging \
--example=tee \
--example=schema_registry
- name: Download integration test suite
uses: actions/download-artifact@v4
with:
name: wasm-integration-test
path: src/transform-sdk/rust
- name: Run integration tests
working-directory: src/transform-sdk/rust
env:
IDENTITY: target/wasm32-wasi/release/examples/identity.wasm
LOGGING: target/wasm32-wasi/release/examples/identity_logging.wasm
TEE: target/wasm32-wasi/release/examples/tee.wasm
SCHEMA_REGISTRY: target/wasm32-wasi/release/examples/schema_registry.wasm
run: |
chmod +x wasm-integration-test
./wasm-integration-test -test.v
test-cpp:
name: Test C++ Transform SDK
runs-on: ubuntu-latest
container:
image: fedora:40
steps:
- uses: actions/checkout@v4
- name: Set up Clang
run: dnf install -y clang clang-tools-extra libcxx libcxxabi libcxx-devel libcxxabi-devel cmake
- name: Run tests
working-directory: src/transform-sdk/cpp
env:
CC: clang
CXX: clang++
run: |
cmake -B build
cmake --build build
ctest --output-on-failure --test-dir build
- name: Run clang-tidy
working-directory: src/transform-sdk/cpp
run: clang-tidy --quiet -p build/compile_commands.json src/transform_sdk.cc
integration-test-cpp:
name: Integration Test C++ Transform SDK
needs: [test-cpp, build-integration-tests]
runs-on: ubuntu-latest
container:
image: ghcr.io/webassembly/wasi-sdk:wasi-sdk-24
steps:
- uses: actions/checkout@v4
- name: Build integration tests
working-directory: src/transform-sdk/cpp/examples
run: cmake -B build && cmake --build build
- name: Download integration test suite
uses: actions/download-artifact@v4
with:
name: wasm-integration-test
path: src/transform-sdk/cpp/examples
- name: Run integration tests
working-directory: src/transform-sdk/cpp/examples
env:
IDENTITY: build/identity_transform
LOGGING: build/identity_logging_transform
TEE: "@UNIMPLEMENTED@"
SCHEMA_REGISTRY: "@UNIMPLEMENTED@"
run: |
chmod +x wasm-integration-test
./wasm-integration-test -test.v
test-js:
name: Test JS Transform SDK
runs-on: ubuntu-latest
container:
image: fedora:40
steps:
- uses: actions/checkout@v4
- name: Set up Clang
run: dnf install -y clang clang-tools-extra libcxx libcxxabi libcxx-devel libcxxabi-devel cmake git
- name: Run tests
working-directory: src/transform-sdk/js
env:
CC: clang
CXX: clang++
run: |
cmake --preset debug
cmake --build --preset debug
ctest --output-on-failure --test-dir build/debug
- name: Run clang-tidy
working-directory: src/transform-sdk/js
run: clang-tidy --quiet -p build/debug/compile_commands.json js_vm.cc js_vm_test.cc main.cc
integration-test-js:
name: Integration Test JS Transform SDK
needs: [test-js, build-integration-tests]
runs-on: ubuntu-latest
container:
image: ghcr.io/webassembly/wasi-sdk:wasi-sdk-24
steps:
- 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: |
apt update
apt install -y git curl python3
cmake --preset release-static
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
./binaryen-version_${{ env.BINARYEN_VERSION }}/bin/wasm-merge \
./build/release-static/redpanda_js_transform js_vm \
./identity_source.wat redpanda_js_provider \
-mvp --enable-simd --enable-bulk-memory --enable-multimemory \
-o identity.wasm
./binaryen-version_${{ env.BINARYEN_VERSION }}/bin/wasm-merge \
./build/release-static/redpanda_js_transform js_vm \
./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:
name: wasm-integration-test
path: src/transform-sdk/js
- name: Run integration tests
working-directory: src/transform-sdk/js
env:
IDENTITY: identity.wasm
LOGGING: logging.wasm
TEE: "@UNIMPLEMENTED@"
SCHEMA_REGISTRY: sr.wasm
run: |
chmod +x wasm-integration-test
./wasm-integration-test -test.v