diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 273b19918..737fcdbe7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,10 @@ name: CI on: push: branches: - - main + - master pull_request: branches: - - main + - master merge_group: types: - checks_requested @@ -110,7 +110,7 @@ jobs: yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" build-ios: - runs-on: macos-14 + runs-on: macos-15 env: TURBO_CACHE_DIR: .turbo/ios steps: @@ -120,6 +120,10 @@ jobs: - name: Setup uses: ./.github/actions/setup + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 + with: + xcode-version: '16.4' + - name: Cache turborepo for iOS uses: actions/cache@v3 with: @@ -148,7 +152,7 @@ jobs: ${{ runner.os }}-cocoapods- - name: Install cocoapods - if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' + if: env.turbo_cache_hit != 1 run: | cd example/ios pod install diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index bc18af429..eb07cf020 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -49,3 +49,36 @@ jobs: with: token: ${{ secrets.QLTY_COVERAGE_TOKEN }} files: coverage/lcov.info + + android-bridge-tests: + name: Android bridge unit tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Install JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + + - name: Finalize Android SDK + run: | + /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" + + - name: Cache Gradle + uses: actions/cache@v3 + with: + path: | + ~/.gradle/wrapper + ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties', 'android/build.gradle') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Run Android bridge unit tests + run: yarn example test:android diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 56a62b946..934e0483a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,6 +13,10 @@ Contributions (in the form of issues or pull requests) are welcome! * If you have a patch for a bug, or an implementation of a new feature, you're more than welcome to submit a pull request! * If the pull request is for an outstanding issue, please include a link to that issue. Otherwise, there's no need to create a new issue; simply explain the purpose of the Pull Request in the body. +#### **Running tests** +* JS: `yarn test` +* Android bridge (JDK 17 and the Android SDK required): `yarn example test:android` + Thanks, Team Iterable diff --git a/example/package.json b/example/package.json index 64d0dfb51..ae9ac4c66 100644 --- a/example/package.json +++ b/example/package.json @@ -7,6 +7,7 @@ "ios": "react-native run-ios", "start": "react-native start", "build:android": "react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"", + "test:android": "cd android && ./gradlew :iterable_react-native-sdk:testDebugUnitTest --no-daemon --console=plain", "build:ios": "react-native build-ios --scheme ReactNativeSdkExample --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\"" }, "dependencies": { diff --git a/turbo.json b/turbo.json index 0ba47c448..52144cbc3 100644 --- a/turbo.json +++ b/turbo.json @@ -4,31 +4,46 @@ "build:android": { "env": ["ORG_GRADLE_PROJECT_newArchEnabled"], "inputs": [ + "../.github/workflows/ci.yml", + "../package.json", + "../android/**", + "!../android/build/**", + "!../android/.gradle/**", + "!../android/.cxx/**", + "../src/**/*.ts", + "../src/**/*.tsx", "package.json", - "android", - "!android/build", - "src/*.ts", - "src/*.tsx", - "example/package.json", - "example/android", - "!example/android/.gradle", - "!example/android/build", - "!example/android/app/build" + "index.js", + "app.json", + "react-native.config.js", + "src/**/*.ts", + "src/**/*.tsx", + "android/**", + "!android/.gradle/**", + "!android/build/**", + "!android/app/build/**", + "!android/app/.cxx/**" ], "outputs": [] }, "build:ios": { "env": ["RCT_NEW_ARCH_ENABLED"], "inputs": [ + "../.github/workflows/ci.yml", + "../package.json", + "../*.podspec", + "../ios/**", + "../src/**/*.ts", + "../src/**/*.tsx", "package.json", - "*.podspec", - "ios", - "src/*.ts", - "src/*.tsx", - "example/package.json", - "example/ios", - "!example/ios/build", - "!example/ios/Pods" + "index.js", + "app.json", + "react-native.config.js", + "src/**/*.ts", + "src/**/*.tsx", + "ios/**", + "!ios/build/**", + "!ios/Pods/**" ], "outputs": [".turbo/cache"] }