-
Notifications
You must be signed in to change notification settings - Fork 73
224 lines (192 loc) · 7.26 KB
/
test-simulators.yaml
File metadata and controls
224 lines (192 loc) · 7.26 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# Ensures certain packages work on simulators
name: Test Simulators/Emulators
on:
pull_request: # triggered for any PR updates (including new pushes to PR branch)
permissions:
contents: read
jobs:
check-changes:
name: Check for relevant changes
runs-on: ubuntu-latest
outputs:
react_native_simulator_should_run: ${{ steps.check.outputs.react_native_simulator_should_run }}
capacitor_should_run: ${{ steps.check.outputs.capacitor_should_run }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check for changes
id: check
run: |
git fetch origin ${{ github.base_ref }}
if git diff --quiet origin/${{ github.base_ref }} -- packages/common packages/powersync-op-sqlite tools/powersynctests; then
echo "react_native_simulator_should_run=false" >> $GITHUB_OUTPUT
else
echo "react_native_simulator_should_run=true" >> $GITHUB_OUTPUT
fi
if git diff --quiet origin/${{ github.base_ref }} -- packages/capacitor pnpm-lock.yaml .github/workflows/test-simulators.yaml; then
echo "capacitor_should_run=false" >> $GITHUB_OUTPUT
else
echo "capacitor_should_run=true" >> $GITHUB_OUTPUT
fi
test-android:
name: Test Android
needs: check-changes
if: ${{ needs.check-changes.outputs.react_native_simulator_should_run == 'true' }}
runs-on: ubuntu-xl
timeout-minutes: 30
env:
AVD_NAME: ubuntu-avd-x86_64-31
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Android emulator
uses: ./.github/actions/setup-android-emulator
with:
avd-name: ${{ env.AVD_NAME }}
cache-key: avd-31
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build:packages
- name: Setup Detox build framework cache
working-directory: ./tools/powersynctests
run: |
pnpx detox clean-framework-cache && pnpx detox build-framework-cache
- name: Android Emulator Build
working-directory: ./tools/powersynctests
run: pnpx detox build --configuration android.emu.release
- name: Run connected Android tests
uses: ReactiveCircus/android-emulator-runner@v2.28.0
with:
api-level: 31
target: google_apis
arch: x86_64
avd-name: ${{ env.AVD_NAME }}
script: cd tools/powersynctests && pnpx detox test --configuration android.emu.release --headless
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
test-capacitor-android:
name: Test Capacitor Android
needs: check-changes
if: ${{ needs.check-changes.outputs.capacitor_should_run == 'true' }}
runs-on: ubuntu-xl
timeout-minutes: 30
env:
AVD_NAME: capacitor-avd-x86_64-35
TEST_PLATFORM: android
TEST_TARGET: emulator-5554
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Android emulator
uses: ./.github/actions/setup-android-emulator
with:
avd-name: ${{ env.AVD_NAME }}
cache-key: capacitor-avd-35
api-level: '35'
java-version: '21'
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build:packages
- name: Install Capacitor example dependencies
working-directory: ./packages/capacitor/example-app
run: pnpm install
- name: Sync and build Capacitor Android app
working-directory: ./packages/capacitor/example-app
# Prebuild the native app so the later browser-test action can start quickly.
# This dummy Vitest server URL is only used for the prebuild; the test run
# updates Capacitor with the actual Vitest URL before launching the app.
env:
CAPACITOR_VITEST_SERVER_URL: http://10.0.2.2
run: |
pnpm exec cap sync android
cd android
./gradlew assembleDebug
- name: Run Capacitor Android browser tests
uses: reactivecircus/android-emulator-runner@v2.28.0
with:
api-level: 35
target: google_apis
arch: x86_64
avd-name: ${{ env.AVD_NAME }}
script: pnpm --dir packages/capacitor exec vitest run --config vitest.config.ts
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
test-ios:
name: Test iOS
needs: check-changes
# TODO: Re-enable iOS tests. They have been disabled because they are failing extremely frequently without
# any apparent cause. In particular, it seems like even starting the simulator times out most of the time.
if: ${{ false && needs.check-changes.outputs.react_native_simulator_should_run == 'true' }}
runs-on: macOS-15
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up XCode
uses: maxim-lobanov/setup-xcode@v1
with:
# TODO: Update to latest-stable once GH installs iOS 26 simulators
xcode-version: '^16.4.0'
- name: CocoaPods Cache
uses: actions/cache@v3
id: cocoapods-cache
with:
path: |
tools/powersynctests/ios/Pods/*
key: ${{ runner.os }}-${{ hashFiles('tools/powersynctests/ios/Podfile.lock') }}
- name: Cache Xcode Derived Data
uses: actions/cache@v3
with:
path: |
tools/powersynctests/ios/build/*
key: xcode-derived-${{ runner.os }}-${{ hashFiles('tools/powersynctests/ios/Podfile.lock') }}
restore-keys: |
xcode-derived-${{ runner.os }}-
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build:packages
- name: Install Detox dependencies
run: |
brew tap wix/brew
brew install applesimutils
npm install -g detox-cli
detox clean-framework-cache && detox build-framework-cache
- name: Install CocoaPods dependencies
working-directory: tools/powersynctests/ios
run: pod install
- name: iOS Simulator Build
working-directory: ./tools/powersynctests
run: pnpx detox build --configuration ios.sim.release
- name: iOS Simulator Test
working-directory: ./tools/powersynctests
run: pnpx detox test --configuration ios.sim.release --cleanup