Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ran.
- WeaveFFI version:
- OS:
- Rust version (`rustc --version`):
- Target generator(s): C / C++ / Swift / Android / Node / Wasm / Python / .NET / Dart / Go / Ruby
- Target generator(s): C / C++ / Swift / Kotlin / Node / Wasm / Python / .NET / Dart / Go / Ruby

## Logs or output

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Which target generators or project areas would this affect?
- [ ] C
- [ ] C++
- [ ] Swift
- [ ] Android / Kotlin
- [ ] Kotlin (Android / JVM)
- [ ] Node.js
- [ ] WebAssembly
- [ ] Python
Expand Down
57 changes: 43 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,26 @@ jobs:
"$BIN" generate samples/calculator/src/lib.rs -o generated

- name: Build sample producer cdylibs (debug)
run: cargo build -p calculator -p contacts -p kvstore
run: cargo build -p calculator -p contacts -p kvstore -p events -p codec

# `weaveffi diff --check` is the CI gate we recommend to users, so it has
# to hold for our own samples: a fresh tree diffs clean (exit 0), and a
# tree with a stale file is reported (exit 1) instead of silently passing.
- name: Verify `weaveffi diff --check` on every sample
shell: bash
run: |
set -euo pipefail
BIN=target/release/weaveffi
[ "${{ runner.os }}" = "Windows" ] && BIN="${BIN}.exe"
for sample in calculator contacts events kvstore shapes async-demo codec inventory; do
"$BIN" generate "samples/$sample/src/lib.rs" -o "diffcheck/$sample" --force --quiet
"$BIN" diff "samples/$sample/src/lib.rs" -o "diffcheck/$sample" --check --quiet
done
echo "stale" >> diffcheck/calculator/c/weaveffi.h
if "$BIN" diff samples/calculator/src/lib.rs -o diffcheck/calculator --check --quiet; then
echo "diff --check did not detect a stale file" >&2
exit 1
fi

- name: Add wasm target
if: runner.os != 'Windows'
Expand Down Expand Up @@ -99,15 +118,20 @@ jobs:
conformance:
# Correctness gate: every consumer binds through the *generated* wrappers and
# asserts concrete results, so a backend that lowers a type wrong, drifts a
# symbol, or skips a feature fails here. Covers contacts + events + kvstore
# across C, C++, Python, Ruby, Dart, Go, Swift, .NET, Node, Kotlin, and
# Wasm: the events lanes exercise listeners/callbacks + iterators, and the
# kvstore lanes exercise interfaces (constructors, methods, async methods,
# iterator methods, destroy), typed error domains, struct getters
# (bytes/optional/list/map), builders, and eviction listeners; see
# conformance/run.sh.
# symbol, or skips a feature fails here. Covers contacts, events, kvstore,
# shapes, async-demo, and codec across C, C++, Python, Ruby, Dart, Go,
# Swift, .NET, Node, Kotlin, and Wasm: the events lanes exercise a callback
# interface plus objects and iterators, the kvstore lanes exercise objects
# in every position (constructors, methods, async methods, iterator methods,
# records and lists carrying objects, clone/destroy), typed error domains,
# builders, and an eviction callback interface, and the codec lanes
# round-trip every value-buffer wire shape; see conformance/run.sh.
name: Conformance harness
runs-on: ubuntu-latest
# A healthy run takes about five minutes. Without a cap, a consumer that
# deadlocks (as the Swift events lane did under Swift 5.10, see below)
# holds the job for the six-hour default before it is marked failed.
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -136,10 +160,15 @@ jobs:
- name: Set up Dart
uses: dart-lang/setup-dart@v1

# Swift 5.10 on Linux miscompiles the events consumer: the top-level
# async code returns to the runtime mid-statement (an iterator
# `first(where:)` call) without ever suspending, so `dispatch_main`
# parks the process forever. Swift 6.0 and 6.1 run the same source
# to completion; the generated package stays on swift-tools 5.7.
- name: Set up Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: "5.10"
swift-version: "6.0"

- name: Set up Java
uses: actions/setup-java@v4
Expand Down Expand Up @@ -196,7 +225,7 @@ jobs:
"generated/c/weaveffi.h",
"generated/swift/Package.swift",
"generated/node/types.d.ts",
"generated/android/build.gradle",
"generated/kotlin/build.gradle.kts",
"generated/python/calculator/weaveffi.py",
"generated/dotnet/WeaveFFI.cs",
"generated/wasm/README.md"
Expand Down Expand Up @@ -238,10 +267,10 @@ jobs:
- name: Build CLI (release)
run: cargo build -p weaveffi-cli --release

- name: Generate Android + C bindings for contacts
- name: Generate Kotlin + C bindings for contacts
run: |
target/release/weaveffi generate samples/contacts/src/lib.rs -o generated --target c
target/release/weaveffi generate samples/contacts/src/lib.rs -o generated --target android
target/release/weaveffi generate samples/contacts/src/lib.rs -o generated --target kotlin

- name: Compile JNI shim with NDK clang
env:
Expand All @@ -258,7 +287,7 @@ jobs:
-I generated/c \
-Wl,--unresolved-symbols=ignore-all \
-o libweaveffi_jni_test.so \
generated/android/src/main/cpp/weaveffi_jni.c
generated/kotlin/src/main/cpp/weaveffi_jni.c

- name: Assert exported JNI symbols
env:
Expand All @@ -269,7 +298,7 @@ jobs:
file libweaveffi_jni_test.so
ldd libweaveffi_jni_test.so || true
"$NM" -D --defined-only libweaveffi_jni_test.so > nm.out
# The Android generator lowers each interface to its own Kotlin
# The Kotlin generator lowers each interface to its own Kotlin
# class with `native*` externals, so the JNI exports are namespaced
# per type: the ContactBook interface's constructor, methods, and
# destroy hook. Records (like Contact) are value types serialized
Expand Down
Loading
Loading