-
Notifications
You must be signed in to change notification settings - Fork 70
183 lines (157 loc) · 5.71 KB
/
test-simulators.yaml
File metadata and controls
183 lines (157 loc) · 5.71 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
# Ensures certain packages work on simulators
name: Test Simulators/Emulators
on:
pull_request: # triggered for any PR updates (including new pushes to PR branch)
jobs:
check-changes:
name: Check for relevant changes
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.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 "should_run=false" >> $GITHUB_OUTPUT
else
echo "should_run=true" >> $GITHUB_OUTPUT
fi
test-android:
name: Test Android
needs: check-changes
if: ${{ needs.check-changes.outputs.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: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: AVD Cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-31
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'adopt'
cache: 'gradle'
- 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: Initialize Android Folder
run: mkdir -p ~/.android/avd
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2.28.0
with:
api-level: 31
force-avd-creation: false
target: google_apis
arch: x86_64
disable-animations: false
avd-name: $AVD_NAME
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: echo "Generated AVD snapshot for caching."
- 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: $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-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.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