-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (115 loc) · 4.43 KB
/
Copy pathe2e-ios.yml
File metadata and controls
127 lines (115 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: iOS E2E
on:
workflow_call:
inputs:
matrix-include:
description: 'JSON array of {device, os} objects (e.g. [{"device":"max","os":"macos-26"}])'
type: string
default: '[{"device":"max","os":"macos-26"}]'
timeout-minutes:
description: 'Job timeout in minutes'
type: number
default: 25
boot-timeout:
description: 'Simulator boot timeout in seconds'
type: number
default: 120
test-timeout:
description: 'Test timeout in seconds'
type: number
default: 300
artifact-prefix:
description: 'Prefix for artifact names'
type: string
default: 'ios'
jobs:
ios-e2e:
name: iOS E2E - ${{ matrix.device }}
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ inputs.timeout-minutes }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(inputs.matrix-include) }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Select pinned Xcode
if: matrix.device == 'max'
run: |
XCODE_VERSION=$(jq -r '.env.IOS_XCODE_VERSION' plugins/ios/plugin.json)
XCODE_APP=$(ls -d /Applications/Xcode_${XCODE_VERSION}*.app 2>/dev/null | head -1)
if [ -z "$XCODE_APP" ]; then
XCODE_APP="/Applications/Xcode.app"
fi
echo "Selecting: $XCODE_APP"
sudo xcode-select -s "$XCODE_APP/Contents/Developer"
xcodebuild -version
xcrun simctl list runtimes | grep -i ios
- name: Setup CocoaPods cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: |
~/.cocoapods/repos
~/Library/Caches/CocoaPods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Setup Xcode build cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: |
~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-xcode-${{ hashFiles('**/*.xcodeproj/**', '**/*.xcworkspace/**') }}
restore-keys: |
${{ runner.os }}-xcode-
- name: Install Devbox
uses: jetify-com/devbox-install-action@8c6a66ed6273138b1915457069de78cb52fe3bd7 # v0.15.0
with:
enable-cache: true
- name: Rewrite plugin URLs to local
run: bash scripts/dev/rewrite-plugin-urls.sh --to-local examples/
- name: Run iOS E2E test
id: e2e
working-directory: examples/ios
env:
BOOT_TIMEOUT: ${{ inputs.boot-timeout }}
TEST_TIMEOUT: ${{ inputs.test-timeout }}
IOS_DEFAULT_DEVICE: ${{ matrix.device }}
IOS_DEVICES: ${{ matrix.device }}
TEST_TUI: false
run: |
START=$SECONDS
set +e
devbox run --pure -e SIM_HEADLESS=1 -e IOS_DEVICES=${{ matrix.device }} test:e2e
E2E_EXIT=$?
set -e
echo "e2e_duration=$(( SECONDS - START ))" >> "$GITHUB_OUTPUT"
exit $E2E_EXIT
- name: Write timing summary
if: always()
run: |
DURATION="${{ steps.e2e.outputs.e2e_duration }}"
RESULT="${{ steps.e2e.outcome }}"
DEVICE="${{ matrix.device }}"
MINUTES=$(( ${DURATION:-0} / 60 ))
SECS=$(( ${DURATION:-0} % 60 ))
mkdir -p examples/ios/reports
cat > examples/ios/reports/timing.json <<TJSON
{"platform":"ios","device":"${DEVICE}","e2e_seconds":${DURATION:-0},"result":"${RESULT}","run_id":"${{ github.run_id }}"}
TJSON
echo "## iOS E2E Timing - ${DEVICE}" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Metric | Value |" >> "$GITHUB_STEP_SUMMARY"
echo "|--------|-------|" >> "$GITHUB_STEP_SUMMARY"
echo "| Device | ${DEVICE} |" >> "$GITHUB_STEP_SUMMARY"
echo "| E2E duration | ${MINUTES}m ${SECS}s |" >> "$GITHUB_STEP_SUMMARY"
echo "| Result | ${RESULT} |" >> "$GITHUB_STEP_SUMMARY"
- name: Upload reports and logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ${{ inputs.artifact-prefix }}-${{ matrix.device }}-reports
path: |
examples/ios/reports/
~/Library/Logs/CoreSimulator/
retention-days: 7