Repository navigation
Merge remote-tracking branch 'origin/wip/openjs-ios' into int/openjs-ios #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Compiler | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'feat/native-kit' | |
| paths: | |
| - 'packages/compiler/**' | |
| - 'packages/core/**' | |
| - 'packages/types-ios/**' | |
| - 'packages/types-android/**' | |
| - 'tools/native-kit/**' | |
| - 'tools/assets/App_Resources/**' | |
| - '.github/workflows/compiler.yml' | |
| pull_request: | |
| paths: | |
| - 'packages/compiler/**' | |
| - 'packages/core/**' | |
| - 'packages/types-ios/**' | |
| - 'packages/types-android/**' | |
| - 'tools/native-kit/**' | |
| - 'tools/assets/App_Resources/**' | |
| - '.github/workflows/compiler.yml' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| KOTLIN_VERSION: '2.2.20' | |
| KOTLIN_SHA256: '81f0264c9073b5cbbdb3ff8418cf2c5dac076879fc156fa1a6462f5a5acc4420' | |
| jobs: | |
| kit: | |
| name: Generate the kits from core (Swift and Kotlin) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: '24' | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| # Builds core, then compiles its TypeScript into the kit's Swift (packages/compiler/kit-apple/Sources/NativeScriptKit/Core). | |
| - name: Generate the iOS kit | |
| run: npx nx run compiler:kit | |
| # The same core into Kotlin (packages/compiler/kit-android/generated), the kit Android builds use. | |
| - name: Generate the Android kit | |
| run: npx nx run compiler:kit-android | |
| - name: Upload the generated iOS kit | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: kit-core | |
| path: packages/compiler/kit-apple/Sources/NativeScriptKit/Core | |
| if-no-files-found: error | |
| - name: Upload the generated Android kit | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: kit-android | |
| path: packages/compiler/kit-android/generated | |
| if-no-files-found: error | |
| - name: Upload the built core | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: core-dist | |
| path: dist/packages/core | |
| if-no-files-found: error | |
| # Runs on Linux, without the kits: these hold whether or not a macOS runner is available. | |
| host: | |
| name: Differential tests (Kotlin, host JVM) and release checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: '24' | |
| cache: npm | |
| - name: Setup Java | |
| uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| - name: Install kotlinc | |
| run: | | |
| curl -fsSL -o "$RUNNER_TEMP/kotlinc.zip" "https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}.zip" | |
| echo "${KOTLIN_SHA256} $RUNNER_TEMP/kotlinc.zip" | sha256sum -c - | |
| unzip -q "$RUNNER_TEMP/kotlinc.zip" -d "$RUNNER_TEMP" | |
| echo "KOTLINC=$RUNNER_TEMP/kotlinc/bin/kotlinc" >> "$GITHUB_ENV" | |
| - name: Install the compiler's dependencies | |
| working-directory: packages/compiler | |
| run: | | |
| npm ci --no-audit --no-fund | |
| npm install --prefix tests --no-audit --no-fund | |
| # Known failures are listed with their causes in tests/diff/known-failures.json; anything else fails the job. | |
| - name: Differential tests (Kotlin) | |
| working-directory: packages/compiler | |
| run: node tests/diff/run.ts --kotlin | |
| - name: Worker tests (Kotlin) | |
| working-directory: packages/compiler | |
| run: | | |
| node tests/worker/run.ts | |
| node tests/worker-state/run.ts | |
| - name: Release checks (preflight, version ranges, Kotlin diagnostics) | |
| working-directory: packages/compiler | |
| run: node tests/release-checks/run.ts | |
| android: | |
| name: Pack, build and launch an app (Android) | |
| needs: kit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: '24' | |
| cache: npm | |
| - name: Setup Java | |
| uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| - name: Download the generated iOS kit | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: kit-core | |
| path: packages/compiler/kit-apple/Sources/NativeScriptKit/Core | |
| - name: Download the generated Android kit | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: kit-android | |
| path: packages/compiler/kit-android/generated | |
| - name: Download the built core | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: core-dist | |
| path: dist/packages/core | |
| - name: Install the compiler's dependencies | |
| working-directory: packages/compiler | |
| run: npm ci --no-audit --no-fund | |
| # npm pack as the release publishes, installed into a fresh app, which builds a minified release APK on the generated kit. | |
| - name: Pack and build | |
| run: packages/compiler/tests/pack-check.sh android dist/packages/core "$RUNNER_TEMP/pack" | |
| - name: Enable KVM | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Launch on an emulator | |
| uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0 | |
| with: | |
| api-level: 35 | |
| arch: x86_64 | |
| target: google_apis | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -no-snapshot | |
| disable-animations: true | |
| script: packages/compiler/tests/launch-check-android.sh "$RUNNER_TEMP/pack/app/platforms/compiled/android/build/outputs/apk/release/KitPackCheck-release.apk" org.nativescript.kitpackcheck 30 | |
| ios: | |
| name: Differential tests and the kit's build (iOS) | |
| needs: kit | |
| runs-on: warp-macos-15-arm64-6x | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: '24' | |
| cache: npm | |
| - name: Download the generated kit | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: kit-core | |
| path: packages/compiler/kit-apple/Sources/NativeScriptKit/Core | |
| - name: Download the built core | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: core-dist | |
| path: dist/packages/core | |
| - name: Install the compiler's dependencies | |
| working-directory: packages/compiler | |
| run: | | |
| npm ci --no-audit --no-fund | |
| npm install --prefix tests --no-audit --no-fund | |
| # Each case runs under Node and as compiled Swift; their output must match. | |
| - name: Differential tests (Swift) | |
| working-directory: packages/compiler | |
| run: node tests/diff/run.ts --swift | |
| # Again with the optimizer release builds use. | |
| - name: Differential tests (Swift, -Osize) | |
| working-directory: packages/compiler | |
| run: node tests/diff/run.ts --swift --osize | |
| # The kit builds only inside an app's project, beside core's native code (TNSWidgets, NativeScriptUtils…): a fixture app, | |
| # with every file of the kit compiled. The generated kit uses the newest iOS APIs behind availability checks, so this needs the newest Xcode. | |
| - name: Build the kit | |
| run: | | |
| xcodebuild -version | |
| packages/compiler/tests/kit-build.sh dist/packages/core | |
| # The fixture app renders core's views at launch. The kit gates newer API by availability, which only an older iOS | |
| # runs: the app launches on the newest simulator and on iOS 26, downloaded where the image has no such runtime. | |
| - name: Launch on the newest iOS | |
| run: packages/compiler/tests/launch-check.sh packages/compiler/tests/app/platforms/native latest 30 | |
| - name: Launch on iOS 26 | |
| run: | | |
| xcrun simctl list runtimes | grep -q 'iOS 26\.' || xcodebuild -downloadPlatform iOS -buildVersion 26.5 | |
| packages/compiler/tests/launch-check.sh packages/compiler/tests/app/platforms/native 26 30 |