|
42 | 42 | simulator: |
43 | 43 | name: integration_test on iPhone 17 simulator |
44 | 44 | runs-on: macos-26 |
45 | | - # About 7 min of setup, the test step's 45 and the log upload. |
46 | | - timeout-minutes: 55 |
| 45 | + # About 7 min of setup, the warm-up's 15, the test step's 10 and 5 for the |
| 46 | + # crash reports and the log upload: 37, so 90 leaves 53 of slack (kept at |
| 47 | + # 90 by Leader's R54 L1). |
| 48 | + timeout-minutes: 90 |
47 | 49 | env: |
48 | 50 | DEVELOPER_DIR: /Applications/Xcode_26.6.app/Contents/Developer |
49 | 51 | steps: |
@@ -81,17 +83,49 @@ jobs: |
81 | 83 | with: |
82 | 84 | model: iPhone 17 |
83 | 85 | wait_for_boot: true |
| 86 | + # SwiftPM off for this job, before pub get writes the plugin list: then |
| 87 | + # integration_test comes in through CocoaPods like rustline_flutter, and |
| 88 | + # RunnerTests' `inherit! :search_paths` (Podfile) resolves |
| 89 | + # `@import integration_test` now that RunnerTests no longer links |
| 90 | + # FlutterGeneratedPluginSwiftPackage. Flutter leaves the pbxproj's package |
| 91 | + # reference alone and generates that package empty. |
84 | 92 | - name: Pub get |
85 | 93 | working-directory: rustline_flutter/example |
86 | | - run: flutter pub get --enforce-lockfile |
87 | | - # One file at a time, each limited to 7 min, so a hang names its file. |
88 | | - # Flutter 3.47.8 can launch the app before its simulator log reader is |
89 | | - # up, miss the VM Service URL and wait forever (flutter/flutter#181771, |
90 | | - # fixed on master by flutter/flutter#193142). A file that times out |
91 | | - # stops the run; a file that fails does not. |
| 94 | + run: | |
| 95 | + flutter config --no-enable-swift-package-manager |
| 96 | + flutter pub get --enforce-lockfile |
| 97 | + # Pod install and the full app build (Rust included) once, outside the |
| 98 | + # per-file cap; `xcodebuild test` in the loop reuses the products in the |
| 99 | + # default DerivedData. Same file as the loop. |
| 100 | + - name: Warm-up build |
| 101 | + working-directory: rustline_flutter/example |
| 102 | + timeout-minutes: 15 |
| 103 | + shell: bash --noprofile --norc -eo pipefail {0} |
| 104 | + env: |
| 105 | + UDID: ${{ steps.sim.outputs.udid }} |
| 106 | + run: | |
| 107 | + set -- integration_test/m11_ios_test.dart |
| 108 | + { |
| 109 | + flutter build ios --config-only --simulator "$1" \ |
| 110 | + --dart-define=RUSTLINE_M11_PACK_ZST="$PACK_ZST" \ |
| 111 | + --dart-define=RUSTLINE_M11_REQUIRE_PACK=true |
| 112 | + xcodebuild build-for-testing -workspace ios/Runner.xcworkspace -scheme Runner \ |
| 113 | + -configuration Debug -destination "platform=iOS Simulator,id=$UDID" \ |
| 114 | + CODE_SIGNING_ALLOWED=NO |
| 115 | + } 2>&1 | tee "$LOGS/warmup.log" |
| 116 | + # Only m11_ios_test.dart: the M6 files (rustline_smoke, lifecycle, |
| 117 | + # pack_safety, panic, perf) need a Brașov pack with streets that CI does |
| 118 | + # not have, and without it they only soft-pass (known gap, R54 H2). |
| 119 | + # One file at a time, each limited to 7 min, so a hang names its file: |
| 120 | + # 1 file x 7 min plus 3. |
| 121 | + # Runs through XCTest (integration_test's iOS runner, RunnerTests.m), not |
| 122 | + # `flutter test -d`: Flutter 3.47.8 can launch the app before its |
| 123 | + # simulator log reader is up, miss the VM Service URL and wait forever |
| 124 | + # (flutter/flutter#181771, fixed on master by flutter/flutter#193142). |
| 125 | + # A file that times out stops the run; a file that fails does not. |
92 | 126 | - name: Integration tests |
93 | 127 | working-directory: rustline_flutter/example |
94 | | - timeout-minutes: 45 |
| 128 | + timeout-minutes: 10 |
95 | 129 | shell: bash --noprofile --norc -eo pipefail {0} |
96 | 130 | env: |
97 | 131 | UDID: ${{ steps.sim.outputs.udid }} |
@@ -128,18 +162,62 @@ jobs: |
128 | 162 | exit(($? & 127) ? 128 + ($? & 127) : $? >> 8); |
129 | 163 | ' "$@" |
130 | 164 | } |
| 165 | + # One file: point the Xcode project at it (FLUTTER_TARGET and the |
| 166 | + # defines go into Generated.xcconfig; pod install), then build and |
| 167 | + # run it through XCTest. One XCTest case per Dart test; a failing |
| 168 | + # Dart test fails its case and xcodebuild. |
| 169 | + test_file() { |
| 170 | + flutter build ios --config-only --simulator integration_test/"$1".dart \ |
| 171 | + --dart-define=RUSTLINE_M11_PACK_ZST="$PACK_ZST" \ |
| 172 | + --dart-define=RUSTLINE_M11_REQUIRE_PACK=true && |
| 173 | + xcodebuild test -workspace ios/Runner.xcworkspace -scheme Runner \ |
| 174 | + -configuration Debug -destination "platform=iOS Simulator,id=$UDID" \ |
| 175 | + -parallel-testing-enabled NO -resultBundlePath "$LOGS/$1.xcresult" \ |
| 176 | + CODE_SIGNING_ALLOWED=NO |
| 177 | + } |
| 178 | + export -f test_file |
| 179 | + # XCTest only reports the Dart tests whose body ran, and a run with |
| 180 | + # none passes, so a file passes only if its result bundle exists and |
| 181 | + # counts passed tests and no failed or skipped ones. The summary is |
| 182 | + # kept as $LOGS/<name>.summary.json. |
| 183 | + check_summary() { |
| 184 | + local xr="$LOGS/$1.xcresult" js="$LOGS/$1.summary.json" |
| 185 | + if [ ! -d "$xr" ]; then |
| 186 | + echo "::error::$1: no result bundle ($xr)" |
| 187 | + return 1 |
| 188 | + fi |
| 189 | + if ! xcrun xcresulttool get test-results summary --path "$xr" > "$js"; then |
| 190 | + echo "::error::$1: xcresulttool could not read $xr" |
| 191 | + return 1 |
| 192 | + fi |
| 193 | + cat "$js" |
| 194 | + if ! python3 - "$js" <<'PY' |
| 195 | + import json, sys |
| 196 | + s = json.load(open(sys.argv[1])) |
| 197 | + p, f, k = (s.get(n) for n in ("passedTests", "failedTests", "skippedTests")) |
| 198 | + print(f"passed={p} failed={f} skipped={k}") |
| 199 | + sys.exit(0 if isinstance(p, int) and p > 0 and f == 0 and k == 0 else 1) |
| 200 | + PY |
| 201 | + then |
| 202 | + echo "::error::$1: needs passedTests > 0, failedTests 0, skippedTests 0" |
| 203 | + return 1 |
| 204 | + fi |
| 205 | + } |
131 | 206 | # The files still to run. |
132 | | - set -- integration_test/*_test.dart |
| 207 | + set -- integration_test/m11_ios_test.dart |
133 | 208 | failed="" |
134 | | - for f in integration_test/*_test.dart; do |
| 209 | + # shellcheck disable=SC2043 # one file for now (see above). |
| 210 | + for f in integration_test/m11_ios_test.dart; do |
135 | 211 | name=$(basename "$f" .dart) |
136 | 212 | echo "::group::$f" |
137 | 213 | set +e |
138 | | - run_with_timeout 420 flutter test integration_test/"$name".dart -d "$UDID" --verbose --reporter expanded \ |
139 | | - --dart-define=RUSTLINE_M11_PACK_ZST="$PACK_ZST" \ |
140 | | - --dart-define=RUSTLINE_M11_REQUIRE_PACK=true 2>&1 | tee "$LOGS/$name.log" |
| 214 | + # shellcheck disable=SC2016 # $1 is the child bash's argument. |
| 215 | + run_with_timeout 420 bash -c 'test_file "$1"' _ "$name" 2>&1 | tee "$LOGS/$name.log" |
141 | 216 | rc=${PIPESTATUS[0]} |
142 | 217 | set -e |
| 218 | + if [ "$rc" -ne 124 ] && ! check_summary "$name" && [ "$rc" -eq 0 ]; then |
| 219 | + rc=1 |
| 220 | + fi |
143 | 221 | echo "::endgroup::" |
144 | 222 | shift |
145 | 223 | if [ "$rc" -eq 124 ]; then |
|
0 commit comments