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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 88 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
Expand Down Expand Up @@ -80,6 +82,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
Expand All @@ -100,10 +104,28 @@ jobs:
- name: Rustfmt check
run: cargo fmt --manifest-path compiler/Cargo.toml -- --check

- name: Cargo check (default & JNI features)
- name: Cargo check (default, JNI, and Boa-free kernels features)
run: |
cargo check --manifest-path compiler/Cargo.toml --all-targets
cargo check --manifest-path compiler/Cargo.toml --features jni
cargo check --manifest-path compiler/Cargo.toml --no-default-features --features kernels,jni --lib

- name: Build Boa-free kernels library and assert zero Boa symbols
run: |
if cargo tree --manifest-path compiler/Cargo.toml -e normal --no-default-features --features kernels,jni | grep -q "boa_engine"; then
echo "::error::Boa-free kernels dependency graph includes boa_engine!"
exit 1
fi
cargo build --manifest-path compiler/Cargo.toml --no-default-features --features kernels,jni --lib
cargo test --manifest-path compiler/Cargo.toml --no-default-features --features kernels,jni --lib -- --test-threads=1
if nm target/debug/libthree_live_compiler.so | grep -i "boa_engine"; then
echo "::error::Boa-free kernels library leaked boa_engine symbols!"
exit 1
fi
if ! readelf -d target/debug/libthree_live_compiler.so | grep -q "libthree_live_kernels.so"; then
echo "::error::Expected SONAME libthree_live_kernels.so on Boa-free kernels cdylib"
exit 1
fi

# The debug profile is the primary gate: it is the only one where `overflow-checks`
# and `debug_assert!` are live, which matters for a crate doing offset and size
Expand Down Expand Up @@ -137,6 +159,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- name: Set up Java 17
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4
Expand All @@ -154,10 +178,10 @@ jobs:
gradle-version: '8.7'

- name: Run Android unit tests
run: gradle :mobile:android:testReleaseUnitTest :mobile:android-filament:testReleaseUnitTest :mobile:android-firebase-ai:testReleaseUnitTest :mobile:android-detect-mlkit:testReleaseUnitTest :mobile:android-hands-androidxr:testReleaseUnitTest :mobile:android-hands-mediapipe:testReleaseUnitTest --stacktrace
run: gradle :mobile:android-runtime:testReleaseUnitTest :mobile:android-kernels:testReleaseUnitTest :mobile:android:testReleaseUnitTest :mobile:android-filament:testReleaseUnitTest :mobile:android-firebase-ai:testReleaseUnitTest :mobile:android-detect-mlkit:testReleaseUnitTest :mobile:android-hands-androidxr:testReleaseUnitTest :mobile:android-hands-mediapipe:testReleaseUnitTest --stacktrace

- name: Assemble Android release AARs (core + optional Filament / Firebase AI / ML Kit / Hands modules)
run: gradle :mobile:android:assembleRelease :mobile:android-filament:assembleRelease :mobile:android-firebase-ai:assembleRelease :mobile:android-detect-mlkit:assembleRelease :mobile:android-hands-androidxr:assembleRelease :mobile:android-hands-mediapipe:assembleRelease --stacktrace
- name: Assemble Android release AARs (runtime, kernels, compiler + optional adapter modules)
run: gradle :mobile:android-runtime:assembleRelease :mobile:android-kernels:assembleRelease :mobile:android:assembleRelease :mobile:android-filament:assembleRelease :mobile:android-firebase-ai:assembleRelease :mobile:android-detect-mlkit:assembleRelease :mobile:android-hands-androidxr:assembleRelease :mobile:android-hands-mediapipe:assembleRelease --stacktrace

# The example app is not shipped, but it is the first thing a new user runs, and it is the
# only consumer of the library's public API. Compiling it here is what catches breakage in
Expand All @@ -171,6 +195,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

# The SwiftPM target needs its own copy of the C header. A divergence between the two
# copies is an ABI bug that no compiler would catch, so assert they are identical.
Expand Down Expand Up @@ -204,11 +230,68 @@ jobs:
- name: Run Swift package tests
run: swift test

- name: Verify standalone ThreeLiveRuntime + ThreeLiveKernels consumer (zero Boa linked)
run: |
set -euo pipefail
REPO_ROOT="$PWD"
PKG_ID="$(basename "${REPO_ROOT}" | tr '[:upper:]' '[:lower:]')"
WORKDIR="$(mktemp -d)"
mkdir -p "${WORKDIR}/Sources/KernelsSmoke"
cat > "${WORKDIR}/Package.swift" <<MANIFEST
// swift-tools-version: 5.9
import PackageDescription
let package = Package(
name: "KernelsSmoke",
platforms: [.macOS(.v12)],
dependencies: [.package(path: "${REPO_ROOT}")],
targets: [
.executableTarget(
name: "KernelsSmoke",
dependencies: [
.product(name: "ThreeLiveRuntime", package: "${PKG_ID}"),
.product(name: "ThreeLiveKernels", package: "${PKG_ID}"),
]
)
]
)
MANIFEST
cat > "${WORKDIR}/Sources/KernelsSmoke/main.swift" <<'SWIFT'
import Foundation
import ThreeLiveKernels
import ThreeLiveRuntime

guard NSClassFromString("ThreeLiveNativeCompilerBackendRegistrar") == nil else {
fatalError("ThreeLiveCompilerNative unexpectedly linked into standalone consumer")
}
guard ThreeCompiler.backend == nil else {
fatalError("Expected ThreeCompiler.backend == nil without ThreeLiveCompiler")
}
guard ThreeLiveKernels.abiVersion == 1, ThreeLiveKernels.kernelCount == 24 else {
fatalError("Expected ThreeLiveKernels ABI v1 with 24 kernels")
}
print("Standalone ThreeLiveRuntime + ThreeLiveKernels consumer verified")
SWIFT
swift run --package-path "${WORKDIR}"
SMOKE_BIN="$(swift build --package-path "${WORKDIR}" --show-bin-path)/KernelsSmoke"
if nm "${SMOKE_BIN}" | grep -E '(_?three_compile_to_glb|boa_engine)'; then
echo "::error::Standalone ThreeLiveRuntime + ThreeLiveKernels binary leaked compiler/Boa symbols!"
exit 1
fi
rm -rf "${WORKDIR}"

# `swift build` only covers the macOS host, where `canImport(UIKit)` is false and the
# whole of QuickLookHelper.swift is preprocessed away. These steps are what actually
# type-check the iOS-only and visionOS-only code paths.
- name: Compile for iOS
- name: Compile for iOS (ThreeLiveRuntime, ThreeLiveKernels, ThreeLiveCompiler)
run: |
xcodebuild -scheme ThreeLiveRuntime \
-destination 'generic/platform=iOS' \
-derivedDataPath .build/xcodebuild-ios-runtime \
build
xcodebuild -scheme ThreeLiveKernels \
-destination 'generic/platform=iOS' \
-derivedDataPath .build/xcodebuild-ios-kernels \
build
xcodebuild -scheme ThreeLiveCompiler \
-destination 'generic/platform=iOS' \
-derivedDataPath .build/xcodebuild-ios \
Expand Down
Loading
Loading