Skip to content

Commit

Permalink
Set up CI for bob / rn compatibility matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Johennes committed Nov 13, 2024
1 parent 33fb8c6 commit 1a9059e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 20 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Compatibility

on:
schedule:
- cron: "0 0 * * *"
pull_request:
branches: ["main"]

env:
CARGO_TERM_COLOR: always

jobs:

integration-tests-generation:
strategy:
matrix:
runner:
- macos-latest
- ubuntu-latest
bob-version:
- 0.42.2
rn-version:
- 0.76.0
- 0.76.1

runs-on: ${{ matrix.runner }}
name: "😬 Compatibility: bob ${{ matrix.bob-version }} | rn ${{ matrix.rn-version }} (${{ matrix.runner == 'macos-latest' && 'iOS' || 'Android' }})"

steps:
- uses: actions/checkout@v4

- name: Generate & build turbo module
run: |
./scripts/test-turbo-modules.sh \
--ubrn-config integration/fixtures/builder-bob/ubrn.config.yaml
--builder-bob-version ${{ matrix.bob-version }} \
--rn-version ${{ matrix.rn-version }} \
--${{ matrix.runner == 'macos-latest' && 'ios' || 'android' }} \
../turbo-module
4 changes: 4 additions & 0 deletions integration/fixtures/builder-bob/ubrn.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rust:
repo: https://github.com/ianthetechie/uniffi-starter
branch: main
manifestPath: rust/foobar/Cargo.toml
26 changes: 6 additions & 20 deletions scripts/test-turbo-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ create_library() {
rm -rf "$base" || error "Failed to remove existing directory $base"
fi

local example_type
if [ "$BOB_VERSION" == "latest" ] ; then
example_type=vanilla
fi
echo "-- Creating library $PROJECT_SLUG with create-react-native-library@$BOB_VERSION"
npm_config_yes=true npx "create-react-native-library@$BOB_VERSION" \
--react-native-version "$RN_VERSION" \
Expand All @@ -184,7 +180,7 @@ create_library() {
--repo-url "https://github.com/jhugman/$PROJECT_SLUG" \
--languages cpp \
--type module-new \
--example $example_type \
--example vanilla \
--local false \
"$base"
exit_dir
Expand Down Expand Up @@ -329,8 +325,8 @@ build_android_example() {
echo "-- Running ubrn build android"
"$UBRN_BIN" build android --config "$UBRN_CONFIG" --and-generate --targets aarch64-linux-android
exit_dir
enter_dir "$PROJECT_DIR/example/android"
./gradlew build || error "Failed to build Android example"
enter_dir "$PROJECT_DIR/example"
yarn build:android || error "Failed to build Android example"
exit_dir
}

Expand All @@ -342,19 +338,9 @@ build_ios_example() {
enter_dir "$PROJECT_DIR/example/ios"
echo "pod 'uniffi-bindgen-react-native', :path => '../../node_modules/uniffi-bindgen-react-native'" >> Podfile
pod install || error "Cannot run Podfile"

# Find the UDID of the first booted device, or fall back to the first available device
udid=$(xcrun simctl list --json devices | jq -r '.devices[][] | select(.state == "Booted") | .udid')
if [ "$udid" == "null" ]; then
udid=$(xcrun simctl list --json devices | jq -r '.devices[][] | select(.isAvailable == true) | .udid' | head -n 1)
xcrun simctl boot "$udid"
fi

if [ "$udid" == "null" ]; then
error "No available iOS simulator found"
fi

xcodebuild -workspace "${IOS_NAME}Example.xcworkspace" -scheme "${IOS_NAME}Example" -configuration Debug -destination "id=$udid" || error "Failed to build iOS example"
exit_dir
enter_dir "$PROJECT_DIR/example"
yarn build:ios --extra-params "ARCHS=$(uname -m)" || error "Failed to build iOS example"
exit_dir
}

Expand Down

0 comments on commit 1a9059e

Please sign in to comment.