|
| 1 | +name: Native Tests |
| 2 | + |
| 3 | +# Native suites are slow (macOS runners, Gradle), so PRs only run the platform |
| 4 | +# whose code they touch; the daily run catches breakage coming from src/. |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + paths: |
| 10 | + - 'platforms/**' |
| 11 | + - 'dev/**' |
| 12 | + - 'tests/fixtures/ssh/**' |
| 13 | + - 'package.json' |
| 14 | + - 'package-lock.json' |
| 15 | + - '.github/workflows/native-tests.yml' |
| 16 | + pull_request: |
| 17 | + paths: |
| 18 | + - 'platforms/**' |
| 19 | + - 'dev/**' |
| 20 | + - 'tests/fixtures/ssh/**' |
| 21 | + - 'package.json' |
| 22 | + - 'package-lock.json' |
| 23 | + - '.github/workflows/native-tests.yml' |
| 24 | + schedule: |
| 25 | + - cron: "0 5 * * *" |
| 26 | + workflow_dispatch: |
| 27 | + |
| 28 | +permissions: |
| 29 | + contents: read |
| 30 | + |
| 31 | +concurrency: |
| 32 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 33 | + cancel-in-progress: true |
| 34 | + |
| 35 | +jobs: |
| 36 | + changes: |
| 37 | + name: Detect changed platforms |
| 38 | + runs-on: ubuntu-latest |
| 39 | + timeout-minutes: 5 |
| 40 | + permissions: |
| 41 | + contents: read |
| 42 | + pull-requests: read |
| 43 | + outputs: |
| 44 | + android: ${{ steps.filter.outputs.android }} |
| 45 | + ios: ${{ steps.filter.outputs.ios }} |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 48 | + if: github.event_name == 'push' || github.event_name == 'pull_request' |
| 49 | + - name: Detect changed files |
| 50 | + id: filter |
| 51 | + if: github.event_name == 'push' || github.event_name == 'pull_request' |
| 52 | + uses: dorny/paths-filter@v4 |
| 53 | + with: |
| 54 | + filters: | |
| 55 | + shared: &shared |
| 56 | + - 'dev/config.js' |
| 57 | + - 'dev/sync.js' |
| 58 | + - 'dev/scripts/native.js' |
| 59 | + - 'dev/scripts/build.sh' |
| 60 | + - 'package.json' |
| 61 | + - 'package-lock.json' |
| 62 | + - '.github/workflows/native-tests.yml' |
| 63 | + android: |
| 64 | + - *shared |
| 65 | + - 'platforms/android/**' |
| 66 | + - 'dev/storage_manager.mjs' |
| 67 | + - 'dev/scripts/android.js' |
| 68 | + ios: |
| 69 | + - *shared |
| 70 | + - 'platforms/ios/**' |
| 71 | + - 'dev/ios/**' |
| 72 | + - 'dev/scripts/ios.js' |
| 73 | + - 'dev/scripts/iosAds.js' |
| 74 | + - 'tests/fixtures/ssh/**' |
| 75 | +
|
| 76 | + android: |
| 77 | + name: Android (${{ matrix.variant }}, ${{ matrix.distribution }}) |
| 78 | + needs: changes |
| 79 | + if: needs.changes.outputs.android == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' |
| 80 | + runs-on: ubuntu-latest |
| 81 | + timeout-minutes: 30 |
| 82 | + strategy: |
| 83 | + fail-fast: false |
| 84 | + matrix: |
| 85 | + include: |
| 86 | + - variant: paid |
| 87 | + package: com.foxdebug.acode |
| 88 | + distribution: store |
| 89 | + - variant: free |
| 90 | + package: com.foxdebug.acodefree |
| 91 | + distribution: store |
| 92 | + - variant: paid |
| 93 | + package: com.foxdebug.acode |
| 94 | + distribution: fdroid |
| 95 | + steps: |
| 96 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 97 | + with: |
| 98 | + submodules: recursive |
| 99 | + - uses: actions/setup-java@v6 |
| 100 | + with: |
| 101 | + distribution: temurin |
| 102 | + java-version: '26' |
| 103 | + cache: gradle |
| 104 | + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 |
| 105 | + with: |
| 106 | + node-version: '24' |
| 107 | + cache: npm |
| 108 | + - name: Install dependencies |
| 109 | + run: npm ci --no-audit --no-fund |
| 110 | + - name: Install Android SDK packages |
| 111 | + run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager 'platforms;android-37.0' 'build-tools;36.0.0' |
| 112 | + - name: Select package |
| 113 | + run: npm pkg set androidPackageId=${{ matrix.package }} |
| 114 | + - name: Native unit tests |
| 115 | + run: npm run test:android -- ${{ matrix.distribution }} |
| 116 | + |
| 117 | + ios: |
| 118 | + name: iOS |
| 119 | + needs: changes |
| 120 | + if: needs.changes.outputs.ios == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' |
| 121 | + runs-on: macos-26 |
| 122 | + timeout-minutes: 30 |
| 123 | + steps: |
| 124 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 125 | + with: |
| 126 | + submodules: recursive |
| 127 | + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 |
| 128 | + with: |
| 129 | + node-version: '24' |
| 130 | + cache: npm |
| 131 | + - name: Install dependencies |
| 132 | + run: npm ci --no-audit --no-fund |
| 133 | + - name: Install Alpine runtime build tools |
| 134 | + run: brew install meson ninja llvm lld |
| 135 | + - name: Prepare local iOS configuration |
| 136 | + run: cp platforms/ios/Config.xcconfig.example platforms/ios/Config.xcconfig |
| 137 | + - name: Select iPhone and iPad simulators with working StoreKit testing |
| 138 | + id: simulator |
| 139 | + run: | |
| 140 | + node <<'JS' |
| 141 | + const { execFileSync } = require('node:child_process'); |
| 142 | + const { appendFileSync } = require('node:fs'); |
| 143 | + const { devices } = JSON.parse(execFileSync('xcrun', ['simctl', 'list', 'devices', 'available', '--json'])); |
| 144 | + // iOS 26.3–26.5 fails SKTestSession configuration in command-line runs: |
| 145 | + // https://developer.apple.com/forums/thread/826971 |
| 146 | + const supported = ['iOS-18-6', 'iOS-26-2'].flatMap(version => |
| 147 | + devices[`com.apple.CoreSimulator.SimRuntime.${version}`] || []); |
| 148 | + for (const [family, output] of [['iPhone', 'id'], ['iPad', 'ipad']]) { |
| 149 | + const device = supported.find(device => device.isAvailable && |
| 150 | + device.deviceTypeIdentifier?.startsWith(`com.apple.CoreSimulator.SimDeviceType.${family}-`)); |
| 151 | + if (!device) throw new Error(`Install an iOS 18.6 or 26.2 ${family} simulator for integration tests`); |
| 152 | + appendFileSync(process.env.GITHUB_OUTPUT, `${output}=${device.udid}\n`); |
| 153 | + } |
| 154 | + JS |
| 155 | + - name: Build and run simulator tests with SSH and FTP fixtures |
| 156 | + run: | |
| 157 | + python3 -m venv .ios-build/ssh-fixture-venv |
| 158 | + .ios-build/ssh-fixture-venv/bin/pip install -r tests/fixtures/ssh/requirements.txt |
| 159 | + .ios-build/ssh-fixture-venv/bin/python tests/fixtures/ssh/server.py -- npm run test:ios -- --target=${{ steps.simulator.outputs.id }} |
| 160 | + - name: Run iPad startup and native UI checks |
| 161 | + run: | |
| 162 | + checks=() |
| 163 | + for test in AppBridgeTests SystemUITests KeyboardLayoutTests PlatformUITests HapticControlsTests DocumentsPickerTests ShareTests PreviewBrowserTests FilesBrowserTests BrowserBridgeTests; do |
| 164 | + checks+=("-only-testing:runnerTests/$test") |
| 165 | + done |
| 166 | + checks+=("-only-testing:runnerUITests/AppIconUITests") |
| 167 | + xcodebuild -project platforms/ios/runner.xcodeproj -scheme runner \ |
| 168 | + -configuration Debug -sdk iphonesimulator \ |
| 169 | + -destination 'platform=iOS Simulator,id=${{ steps.simulator.outputs.ipad }}' \ |
| 170 | + -derivedDataPath .ios-build -clonedSourcePackagesDirPath .ios-build/SourcePackages \ |
| 171 | + -parallel-testing-enabled NO -collect-test-diagnostics never \ |
| 172 | + "${checks[@]}" CODE_SIGNING_ALLOWED=YES CODE_SIGN_IDENTITY=- test-without-building |
0 commit comments