|
| 1 | +name: Test Kotlin Multiplatform foundation |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + paths: |
| 7 | + - '.github/workflows/test-kmp.yml' |
| 8 | + - '.github/actions/setup-gradle/**' |
| 9 | + - '.github/actions/setup-xcode/**' |
| 10 | + - 'packages/react-native/ReactShared/**' |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + - '*-stable' |
| 15 | + paths: |
| 16 | + - '.github/workflows/test-kmp.yml' |
| 17 | + - '.github/actions/setup-gradle/**' |
| 18 | + - '.github/actions/setup-xcode/**' |
| 19 | + - 'packages/react-native/ReactShared/**' |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + |
| 24 | +concurrency: |
| 25 | + group: kmp-${{ github.workflow }}-${{ github.ref }} |
| 26 | + cancel-in-progress: true |
| 27 | + |
| 28 | +jobs: |
| 29 | + smoke: |
| 30 | + runs-on: macos-26 |
| 31 | + timeout-minutes: 45 |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v6 |
| 35 | + - name: Set up JDK 17 |
| 36 | + uses: actions/setup-java@v5 |
| 37 | + with: |
| 38 | + java-version: '17' |
| 39 | + distribution: 'zulu' |
| 40 | + - name: Set up Xcode |
| 41 | + uses: ./.github/actions/setup-xcode |
| 42 | + with: |
| 43 | + xcode-version: '26.4.1' |
| 44 | + - name: Set up Gradle |
| 45 | + uses: ./.github/actions/setup-gradle |
| 46 | + - name: Cache Kotlin Native toolchain |
| 47 | + uses: actions/cache@v5 |
| 48 | + with: |
| 49 | + path: ~/.konan |
| 50 | + key: kmp-foundation-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('packages/react-native/ReactShared/*.gradle.kts', 'packages/react-native/ReactShared/gradle.properties', 'packages/react-native/ReactShared/gradle/wrapper/gradle-wrapper.properties') }} |
| 51 | + - name: Test common code and build Apple frameworks |
| 52 | + working-directory: packages/react-native/ReactShared |
| 53 | + run: >- |
| 54 | + ./gradlew -PreactNativeSharedSmoke=true |
| 55 | + jvmTest iosSimulatorArm64Test |
| 56 | + linkDebugFrameworkIosArm64 linkReleaseFrameworkIosArm64 |
| 57 | + linkDebugFrameworkIosSimulatorArm64 linkReleaseFrameworkIosSimulatorArm64 |
| 58 | + linkDebugFrameworkIosX64 linkReleaseFrameworkIosX64 |
| 59 | + --max-workers=2 --stacktrace --console=plain |
| 60 | + - name: Test Objective-C consumption |
| 61 | + working-directory: packages/react-native/ReactShared |
| 62 | + run: ./scripts/test-apple-smoke.sh |
| 63 | + - name: Verify nonempty tests and fixture isolation |
| 64 | + working-directory: packages/react-native/ReactShared |
| 65 | + run: | |
| 66 | + ./gradlew jvmJar --max-workers=2 --console=plain |
| 67 | + python3 - <<'PY' |
| 68 | + from pathlib import Path |
| 69 | + import xml.etree.ElementTree as ET |
| 70 | + import zipfile |
| 71 | + for target in ('jvmTest', 'iosSimulatorArm64Test'): |
| 72 | + suites = [ET.parse(p).getroot() for p in Path('build/smoke/test-results', target).glob('TEST-*.xml')] |
| 73 | + assert suites and sum(int(s.get('tests', 0)) for s in suites) > 0, target |
| 74 | + assert all(not int(s.get(k, 0)) for s in suites for k in ('failures', 'errors', 'skipped')), target |
| 75 | + jars = list(Path('build/libs').glob('*.jar')) |
| 76 | + assert len(jars) == 1, jars |
| 77 | + with zipfile.ZipFile(jars[0]) as jar: |
| 78 | + assert not any('/smoke/' in name for name in jar.namelist()), 'Test fixture leaked into default output' |
| 79 | + PY |
| 80 | + - name: Upload smoke reports |
| 81 | + if: always() |
| 82 | + uses: actions/upload-artifact@v6 |
| 83 | + with: |
| 84 | + name: kotlin-multiplatform-smoke-results |
| 85 | + path: | |
| 86 | + packages/react-native/ReactShared/build/smoke/reports/tests |
| 87 | + packages/react-native/ReactShared/build/smoke/test-results |
| 88 | + packages/react-native/ReactShared/build/smoke/apple-interop/*.log |
| 89 | + if-no-files-found: warn |
0 commit comments