|
| 1 | +name: Apple installed plugin activity |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + paths: |
| 7 | + - '.github/workflows/apple-plugin-activity.yml' |
| 8 | + - 'integration_test/apple_plugin_activity_probe_test.dart' |
| 9 | + - 'integration_test/support/apple_plugin_activity_fixture.dart' |
| 10 | + - 'integration_test/support/installed_plugin_completion.dart' |
| 11 | + - 'integration_test/support/perf_fixture.dart' |
| 12 | + - 'integration_test/support/webview_probe_window.dart' |
| 13 | + - 'test_driver/apple_plugin_activity.dart' |
| 14 | + - 'tool/perf_probe/apple_plugin_activity/**' |
| 15 | + - 'test/tool/perf_probe/apple_plugin_activity_contract_test.dart' |
| 16 | + - 'test/tool/perf_probe/apple_plugin_activity_completion_test.dart' |
| 17 | + - 'test/tool/perf_probe/installed_plugin_completion_test.dart' |
| 18 | + - 'test/tool/perf_probe/perf_fixture_test.dart' |
| 19 | + - 'test/tool/perf_probe/perf_fixture_startup_settings_test.dart' |
| 20 | + - 'lib/app_scope/external_activation_service.dart' |
| 21 | + - 'test/app_scope/external_activation_service_test.dart' |
| 22 | + - 'lib/plugins/**' |
| 23 | + - 'pubspec.yaml' |
| 24 | + - 'pubspec.lock' |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +concurrency: |
| 30 | + group: apple-plugin-activity-${{ github.event.pull_request.number || github.ref }} |
| 31 | + cancel-in-progress: true |
| 32 | + |
| 33 | +jobs: |
| 34 | + contracts: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + timeout-minutes: 30 |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v7.0.1 |
| 39 | + - uses: subosito/flutter-action@v2 |
| 40 | + with: |
| 41 | + flutter-version: 3.47.7 |
| 42 | + channel: stable |
| 43 | + cache: true |
| 44 | + - uses: dtolnay/rust-toolchain@stable |
| 45 | + - name: Native source fallback prerequisites |
| 46 | + run: sudo apt-get update && sudo apt-get install -y libclang-dev |
| 47 | + - name: Resolve exact dependencies |
| 48 | + run: flutter pub get --enforce-lockfile |
| 49 | + - name: Counter, identity and boundary controls |
| 50 | + run: | |
| 51 | + set -euo pipefail |
| 52 | + node --test tool/perf_probe/apple_plugin_activity/test_fixture.mjs |
| 53 | + python3 -m unittest discover -s tool/perf_probe/apple_plugin_activity -p 'test_*.py' -v |
| 54 | + ruby -c tool/perf_probe/apple_plugin_activity/create_control_project.rb |
| 55 | + flutter test --no-pub \ |
| 56 | + test/tool/perf_probe/apple_plugin_activity_contract_test.dart \ |
| 57 | + test/tool/perf_probe/apple_plugin_activity_completion_test.dart \ |
| 58 | + test/tool/perf_probe/installed_plugin_completion_test.dart \ |
| 59 | + test/tool/perf_probe/perf_fixture_test.dart \ |
| 60 | + test/tool/perf_probe/perf_fixture_startup_settings_test.dart \ |
| 61 | + test/app_scope/external_activation_service_test.dart \ |
| 62 | + test/core/external_activation_channel_test.dart \ |
| 63 | + test/core/external_activation_queue_test.dart |
| 64 | +
|
| 65 | + actual-app: |
| 66 | + name: Actual app (${{ matrix.platform }} ${{ matrix.mode }}) |
| 67 | + runs-on: macos-latest |
| 68 | + timeout-minutes: 75 |
| 69 | + strategy: |
| 70 | + fail-fast: false |
| 71 | + matrix: |
| 72 | + include: |
| 73 | + - platform: macos |
| 74 | + mode: profile |
| 75 | + - platform: ios |
| 76 | + mode: debug |
| 77 | + steps: |
| 78 | + - name: Reserve time for cleanup and evidence |
| 79 | + run: | |
| 80 | + python3 - <<'PY' |
| 81 | + import os, time |
| 82 | + with open(os.environ['GITHUB_ENV'], 'a') as stream: |
| 83 | + stream.write(f'APPLE_PROBE_DEADLINE_MONOTONIC={time.monotonic() + 65 * 60}\n') |
| 84 | + PY |
| 85 | + - uses: actions/checkout@v7.0.1 |
| 86 | + - uses: subosito/flutter-action@v2 |
| 87 | + with: |
| 88 | + flutter-version: 3.47.7 |
| 89 | + channel: stable |
| 90 | + cache: false |
| 91 | + - uses: dtolnay/rust-toolchain@stable |
| 92 | + - name: Native iOS Simulator source targets |
| 93 | + if: matrix.platform == 'ios' |
| 94 | + run: rustup target add aarch64-apple-ios-sim x86_64-apple-ios |
| 95 | + - name: Resolve exact dependencies |
| 96 | + run: flutter pub get --enforce-lockfile |
| 97 | + - name: Select actual runtime |
| 98 | + id: runtime_selection |
| 99 | + env: |
| 100 | + PROBE_PLATFORM: ${{ matrix.platform }} |
| 101 | + run: | |
| 102 | + set -euo pipefail |
| 103 | + if [ "$PROBE_PLATFORM" = macos ]; then |
| 104 | + echo 'APPLE_PROBE_DEVICE=macos' >> "$GITHUB_ENV" |
| 105 | + else |
| 106 | + ruby -e 'require "xcodeproj"' |
| 107 | + xcrun simctl list devices available --json > "$RUNNER_TEMP/apple-devices.json" |
| 108 | + python3 - <<'PY' |
| 109 | + import json, os, subprocess |
| 110 | + from pathlib import Path |
| 111 | + data = json.loads(Path(os.environ['RUNNER_TEMP'], 'apple-devices.json').read_text()) |
| 112 | + candidates = [d for runtime, devices in data['devices'].items() if '.iOS-' in runtime |
| 113 | + for d in devices if d['name'].startswith('iPhone') and d.get('isAvailable', True)] |
| 114 | + if not candidates: |
| 115 | + raise SystemExit('No available iPhone simulator; do not substitute a fake background transition') |
| 116 | + device = next((d for d in candidates if d['state'] == 'Booted'), candidates[0]) |
| 117 | + if device['state'] != 'Booted': |
| 118 | + subprocess.run(['xcrun', 'simctl', 'boot', device['udid']], check=True) |
| 119 | + subprocess.run(['xcrun', 'simctl', 'bootstatus', device['udid'], '-b'], check=True) |
| 120 | + with open(os.environ['GITHUB_ENV'], 'a') as stream: |
| 121 | + stream.write('APPLE_PROBE_DEVICE=' + device['udid'] + '\n') |
| 122 | + PY |
| 123 | + open -a Simulator |
| 124 | + fi |
| 125 | + - name: Verify public identity and diagnose native macOS hide |
| 126 | + id: mac_controls |
| 127 | + if: matrix.platform == 'macos' |
| 128 | + env: |
| 129 | + APPLE_HELPER_CONTROL_OUTPUT: ${{ runner.temp }}/apple-helper-controls |
| 130 | + run: python3 -m unittest discover -s tool/perf_probe/apple_plugin_activity -p 'test_macos_controller.py' -v |
| 131 | + - name: Run installed app hosts and quiet OS transitions |
| 132 | + # Collect product evidence after a helper-control failure; that failure remains fatal to this job. |
| 133 | + if: ${{ !cancelled() && (success() || (matrix.platform == 'macos' && steps.runtime_selection.outcome == 'success' && steps.mac_controls.outcome == 'failure')) }} |
| 134 | + run: >- |
| 135 | + python3 tool/perf_probe/apple_plugin_activity/run.py |
| 136 | + --platform '${{ matrix.platform }}' --mode '${{ matrix.mode }}' |
| 137 | + --device "$APPLE_PROBE_DEVICE" --seconds 12 |
| 138 | + --output '${{ runner.temp }}/apple-plugin-activity' |
| 139 | + - name: Preserve completed and partial evidence |
| 140 | + if: always() |
| 141 | + uses: actions/upload-artifact@v7.0.2 |
| 142 | + with: |
| 143 | + name: apple-plugin-activity-${{ matrix.platform }}-${{ matrix.mode }} |
| 144 | + path: | |
| 145 | + ${{ runner.temp }}/apple-plugin-activity/*.json |
| 146 | + ${{ runner.temp }}/apple-plugin-activity/*.log |
| 147 | + ${{ runner.temp }}/apple-plugin-activity/control/*.swift |
| 148 | + ${{ runner.temp }}/apple-plugin-activity/control/Control.xcodeproj |
| 149 | + ${{ runner.temp }}/apple-plugin-activity/control.xcresult |
| 150 | + ${{ runner.temp }}/apple-helper-controls/*.json |
| 151 | + ${{ runner.temp }}/apple-helper-controls/*.log |
| 152 | + ${{ runner.temp }}/apple-helper-controls/*.swift |
| 153 | + if-no-files-found: warn |
| 154 | + retention-days: 14 |
0 commit comments