Skip to content
Draft
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
26 changes: 26 additions & 0 deletions .github/actions/make/android/bindings/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Fetch or make kotlin bindings for android
inputs:
gh-token:
required: true

runs:
using: composite
steps:
- name: fetch ffi library
uses: ./.github/actions/make/ffi-library
with:
gh-token: ${{ inputs.gh-token }}

- name: fetch uniffi bindgen artifact
uses: ./.github/actions/make/uniffi-bindgen
with:
gh-token: ${{ inputs.gh-token }}

- name: make android bindings
uses: ./.github/actions/make
with:
key: bindings-kotlin-android
make-rule: bindings-kotlin-android
target-path: |
crypto-ffi/bindings/android/src/main/uniffi/com/wire/crypto/core_crypto_ffi.kt
gh-token: ${{ inputs.gh-token }}
18 changes: 2 additions & 16 deletions .github/actions/make/android/package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,11 @@ runs:
task: android-x86
gh-token: ${{ inputs.gh-token }}

- name: fetch ffi library
uses: ./.github/actions/make/ffi-library
- name: download android bindings
uses: ./.github/actions/make/android/bindings
with:
gh-token: ${{ inputs.gh-token }}

- name: fetch uniffi bindgen artifact
uses: ./.github/actions/make/uniffi-bindgen
with:
gh-token: ${{ inputs.gh-token }}

- name: make android bindings
uses: ./.github/actions/make
with:
key: bindings-kotlin-android
make-rule: bindings-kotlin-android
target-path: |
crypto-ffi/bindings/android/src/main/uniffi/com/wire/crypto/core_crypto_ffi.kt
gh-token: ${{ inputs.gh-token }}

- name: make android package
uses: ./.github/actions/make
with:
Expand Down
39 changes: 39 additions & 0 deletions .github/actions/make/android/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test kotlin bindings for android via make
inputs:
gh-token:
required: true

runs:
using: composite
steps:
- name: download armv7-linux-androideabi binaries
uses: ./.github/actions/make/android/lib
with:
task: android-armv7
gh-token: ${{ inputs.gh-token }}

- name: download aarch64-linux-android binaries
uses: ./.github/actions/make/android/lib
with:
task: android-armv8
gh-token: ${{ inputs.gh-token }}

- name: download x86_64-linux-android binaries
uses: ./.github/actions/make/android/lib
with:
task: android-x86
gh-token: ${{ inputs.gh-token }}

- name: fetch android bindings
uses: ./.github/actions/make/android/bindings
with:
gh-token: ${{ inputs.gh-token }}

- name: make android-test
uses: ./.github/actions/make
with:
key: android-test
make-rule: android-test
target-path: |
.stamps/android-test
gh-token: ${{ inputs.gh-token }}
16 changes: 14 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,27 @@ jobs:
build-android:
uses: ./.github/workflows/build-android.yml

package-android:
bindings-android:
runs-on: ubuntu-latest
needs:
- uniffi-bindgen-linux
- ffi-library-linux
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/make/android/bindings
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}

package-android:
needs:
- bindings-android
- build-android
uses: ./.github/workflows/package-android.yml

test-android:
needs: package-android
needs:
- bindings-android
- build-android
uses: ./.github/workflows/test-android.yml

#################
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/test-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest

env:
ANDROID_NDK_VERSION: 28.1.13356709

steps:
- uses: actions/checkout@v6
- name: set up jdk 17
Expand All @@ -33,16 +30,7 @@ jobs:
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: download android package
uses: ./.github/actions/make/android/package
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}

- name: android instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
uses: ./.github/actions/make/android/test
with:
api-level: 32
arch: x86_64
working-directory: ./crypto-ffi/bindings
script: ./gradlew android:connectedAndroidTest

gh-token: ${{ secrets.GITHUB_TOKEN }}
79 changes: 70 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ $(STAMPS)/ios-create-xcframework: $(ios-create-xcframework-deps)
.PHONY: ios-create-xcframework
ios-create-xcframework: $(STAMPS)/ios-create-xcframework ## Build the XCode framework (macOS only)

ios-test-deps := $(IOS_SIMULATOR_ARM) $(UNIFFI_SWIFT_OUTPUT)

$(STAMPS)/ios-test: $(ios-test-deps)
$(SHELL) scripts/run-ios-tests.sh $(XCODE_CONFIG)
$(TOUCH_STAMP)

#-------------------------------------------------------------------------------
# Android builds
#-------------------------------------------------------------------------------
Expand All @@ -309,11 +315,12 @@ android-env:
echo "ERROR: set ANDROID_NDK_HOME"; exit 1; \
fi
@ndk_version=$$(perl -ne 's/Pkg\.Revision = // and print' $(ANDROID_NDK_HOME)/source.properties) && \
echo "Using Android NDK $${ndk_version} at $(ANDROID_NDK_HOME)"; \
echo "Using Android NDK $${ndk_version} at $(ANDROID_NDK_HOME)";

ANDROID_ARMv7 := target/armv7-linux-androideabi/$(RELEASE_MODE)/libcore_crypto_ffi.so
android-armv7-deps := $(RUST_SOURCES)
$(ANDROID_ARMv7): $(android-armv7-deps) | android-env
$(ANDROID_ARMv7): $(android-armv7-deps)
$(MAKE) android-env;
cargo rustc --locked \
--target armv7-linux-androideabi \
--package core-crypto-ffi \
Expand All @@ -325,7 +332,8 @@ android-armv7: $(ANDROID_ARMv7) ## Build core-crypto-ffi for armv7-linux-android

ANDROID_ARMv8 := target/aarch64-linux-android/$(RELEASE_MODE)/libcore_crypto_ffi.so
android-armv8-deps := $(RUST_SOURCES)
$(ANDROID_ARMv8): $(android-armv8-deps) | android-env
$(ANDROID_ARMv8): $(android-armv8-deps)
$(MAKE) android-env;
cargo rustc --locked \
--target aarch64-linux-android \
--package core-crypto-ffi \
Expand All @@ -337,7 +345,8 @@ android-armv8: $(ANDROID_ARMv8) ## Build core-crypto-ffi for aarch64-linux-andro

ANDROID_X86 := target/x86_64-linux-android/$(RELEASE_MODE)/libcore_crypto_ffi.so
android-x86-deps := $(RUST_SOURCES)
$(ANDROID_X86): $(android-x86-deps) | android-env
$(ANDROID_X86): $(android-x86-deps)
$(MAKE) android-env;
# Link clang_rt.builtins statically for x86_64 Android
cargo rustc --locked \
--target x86_64-linux-android \
Expand All @@ -357,6 +366,24 @@ android: $(android-deps) ## Build all Android targets
cd crypto-ffi/bindings && \
./gradlew android:assemble$(GRADLE_BUILD_TYPE)

ifeq ($(UNAME_S),Linux)
ANDROID_TEST_LIB := $(ANDROID_X86)
android-test-lib-deps := $(android-x86-deps)
android-test-lib: android-x86 ## Build core-crypto-ffi for Android (automatically select the target based on the host machine)
else ifeq ($(UNAME_S),Darwin)
ANDROID_TEST_LIB := $(ANDROID_ARMv8)
android-test-lib-deps := $(android-armv8-deps)
android-test-lib: android-armv8
else
$(error Unsupported host platform for android-test-lib: $(UNAME_S))
endif

android-test-deps := $(ANDROID_TEST_LIB) $(UNIFFI_ANDROID_OUTPUT)

$(STAMPS)/android-test: $(android-test-deps)
$(SHELL) scripts/run-android-tests.sh
$(TOUCH_STAMP)

#-------------------------------------------------------------------------------
# JVM native builds (Darwin + Linux)
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -402,10 +429,12 @@ else
$(error Unsupported host platform for jvm: $(UNAME_S))
endif

.PHONY: jvm-test
jvm-test: $(JVM_LIB) bindings-kotlin-jvm ## Run Kotlin tests on JVM
jvm-test-deps := $(JVM_LIB) $(UNIFFI_JVM_OUTPUT)

$(STAMPS)/jvm-test: $(jvm-test-deps)
cd crypto-ffi/bindings && \
./gradlew jvm:test --rerun
$(TOUCH_STAMP)

#-------------------------------------------------------------------------------
# TypeScript / JS tasks
Expand Down Expand Up @@ -485,9 +514,10 @@ $(TS_OUT): $(ts-deps)
.PHONY: ts
ts: $(TS_OUT) ## Build the TypeScript wrapper

ts-test-deps := $(TS_OUT)

# run WebDriver tests + bun’s built-in tests
.PHONY: ts-test
ts-test: $(TS_OUT) ## Run TypeScript wrapper tests via wdio and bun. Optionally pass TEST=<test> to filter by test name.
$(STAMPS)/ts-test: $(ts-test-deps)
@set -euo pipefail; \
cd $(JS_DIR) && \
if [ -n "$(TEST)" ]; then \
Expand All @@ -497,6 +527,7 @@ ts-test: $(TS_OUT) ## Run TypeScript wrapper tests via wdio and bun. Optionally
bun x wdio run wdio.conf.ts --spec test/wdio/*.test.ts; \
bun test; \
fi
$(TOUCH_STAMP)

# run WebDriver benches
.PHONY: ts-bench
Expand All @@ -523,6 +554,12 @@ interop-build-deps := $(INTEROP_SOURCES)
$(INTEROP_OUT): $(interop-build-deps)
cargo build --bin interop

interop-test-deps := $(INTEROP_OUT) $(TS_OUT) $(IOS_SIMULATOR_ARM) $(UNIFFI_SWIFT_OUTPUT) $(ANDROID_ARMv8) $(ANDROID_ARMv7) $(ANDROID_X86) $(UNIFFI_ANDROID_OUTPUT)

$(STAMPS)/interop-test: $(interop-test-deps)
$(SHELL) scripts/run-interop-test.sh $(XCODE_CONFIG)
$(TOUCH_STAMP)

#-------------------------------------------------------------------------------
# Documentation targets
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -573,7 +610,7 @@ $(STAMPS)/docs-ts: $(TS_OUT)
docs-ts: $(STAMPS)/docs-ts ## Generate TypeScript docs

# Swift docs via Jazzy (macOS only)
docs-swift-deps := $(IOS_DEVICE) $(IOS_SIMULATOR_ARM) $(STAMPS)/bindings-swift
docs-swift-deps := $(IOS_DEVICE) $(IOS_SIMULATOR_ARM) $(UNIFFI_SWIFT_OUTPUT)
$(STAMPS)/docs-swift: $(docs-swift-deps)
mkdir -p target/swift/doc
cd crypto-ffi/bindings/swift/WireCoreCrypto && \
Expand Down Expand Up @@ -693,3 +730,27 @@ fmt: rust-fmt swift-fmt kotlin-fmt ts-fmt ## Format all files

.PHONY: check
check: rust-check swift-check kotlin-check ts-check ## Run all linters

#-------------------------------------------------------------------------------
# Lazy targets
#-------------------------------------------------------------------------------

LAZY_TARGETS := jvm-test ts-test android-test ios-test interop-test

ts-test: ## Run TypeScript wrapper tests via wdio and bun. Optionally pass TEST=<test> to filter by test name.
jvm-test: ## Run Kotlin tests on JVM
android-test: ## Run Kotlin tests on Android
ios-test: ## Run Swift tests on iOS (macOS only)
interop-test: ## Run e2e interop test

ifeq ($(LAZY_MAKE),)

.PHONY: $(LAZY_TARGETS)
$(LAZY_TARGETS):
@rm -f $(STAMPS)/$@
@$(MAKE) $(STAMPS)/$@

else
$(LAZY_TARGETS): %: $(STAMPS)/%

endif
Loading
Loading