|
1 | | -# # Ensures certain packages work on simulators |
2 | | -# name: Test Simulators |
3 | | -# on: |
4 | | -# push: |
5 | | - |
6 | | -# jobs: |
7 | | -# test: |
8 | | -# name: Test Simulators |
9 | | -# runs-on: macOS-15 |
10 | | - |
11 | | -# steps: |
12 | | -# - uses: actions/checkout@v4 |
13 | | -# with: |
14 | | -# persist-credentials: false |
15 | | - |
16 | | -# - name: CocoaPods Cache |
17 | | -# uses: actions/cache@v3 |
18 | | -# id: cocoapods-cache |
19 | | -# with: |
20 | | -# path: | |
21 | | -# tools/powersynctests/ios/Pods/* |
22 | | -# key: ${{ runner.os }}-${{ hashFiles('tools/powersynctests/ios/Podfile.lock') }} |
23 | | - |
24 | | -# - name: Setup NodeJS |
25 | | -# uses: actions/setup-node@v4 |
26 | | -# with: |
27 | | -# node-version-file: '.nvmrc' |
28 | | - |
29 | | -# - uses: pnpm/action-setup@v2 |
30 | | -# name: Install pnpm |
31 | | -# with: |
32 | | -# version: 9 |
33 | | -# run_install: false |
34 | | - |
35 | | -# - name: Get pnpm store directory |
36 | | -# shell: bash |
37 | | -# run: | |
38 | | -# echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
39 | | - |
40 | | -# - uses: actions/cache@v3 |
41 | | -# name: Setup pnpm cache |
42 | | -# with: |
43 | | -# path: ${{ env.STORE_PATH }} |
44 | | -# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} |
45 | | -# restore-keys: | |
46 | | -# ${{ runner.os }}-pnpm-store- |
47 | | - |
48 | | -# - name: Install dependencies |
49 | | -# run: pnpm install |
50 | | - |
51 | | -# - name: Build |
52 | | -# run: pnpm build:packages |
53 | | - |
54 | | -# - name: Install Detox dependencies |
55 | | -# run: | |
56 | | -# brew tap wix/brew |
57 | | -# brew install applesimutils |
58 | | -# npm install -g detox-cli |
59 | | -# detox clean-framework-cache && detox build-framework-cache |
60 | | - |
61 | | -# - name: Install CocoaPods dependencies |
62 | | -# working-directory: tools/powersynctests/ios |
63 | | -# run: pod install |
64 | | - |
65 | | -# - name: iOS Simulator Build |
66 | | -# working-directory: ./tools/powersynctests |
67 | | -# run: pnpx detox build --configuration ios.sim.release |
68 | | - |
69 | | -# - name: iOS Simulator Test |
70 | | -# working-directory: ./tools/powersynctests |
71 | | -# run: pnpx detox test --configuration ios.sim.release --cleanup |
| 1 | +# Ensures certain packages work on simulators |
| 2 | +name: Test Simulators/Emulators |
| 3 | +on: |
| 4 | + pull_request: # triggered for any PR updates (including new pushes to PR branch) |
| 5 | + |
| 6 | +jobs: |
| 7 | + test-android: |
| 8 | + name: Test Android |
| 9 | + runs-on: ubuntu-xl |
| 10 | + env: |
| 11 | + AVD_NAME: ubuntu-avd-x86_64-31 |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + with:r |
| 15 | + persist-credentials: false |
| 16 | + |
| 17 | + - name: Enable KVM group perms |
| 18 | + run: | |
| 19 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 20 | + sudo udevadm control --reload-rules |
| 21 | + sudo udevadm trigger --name-match=kvm |
| 22 | +
|
| 23 | + - name: Gradle Cache |
| 24 | + uses: gradle/gradle-build-action@v2 |
| 25 | + |
| 26 | + - name: AVD Cache |
| 27 | + uses: actions/cache@v3 |
| 28 | + id: avd-cache |
| 29 | + with: |
| 30 | + path: | |
| 31 | + ~/.android/avd/* |
| 32 | + ~/.android/adb* |
| 33 | + key: avd-31 |
| 34 | + |
| 35 | + - name: Set up JDK 17 |
| 36 | + uses: actions/setup-java@v3 |
| 37 | + with: |
| 38 | + java-version: 17 |
| 39 | + distribution: 'adopt' |
| 40 | + cache: 'gradle' |
| 41 | + |
| 42 | + - name: Setup NodeJS |
| 43 | + uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version-file: '.nvmrc' |
| 46 | + |
| 47 | + - uses: pnpm/action-setup@v2 |
| 48 | + name: Install pnpm |
| 49 | + with: |
| 50 | + version: 9 |
| 51 | + run_install: false |
| 52 | + |
| 53 | + - name: Get pnpm store directory |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
| 57 | +
|
| 58 | + - uses: actions/cache@v3 |
| 59 | + name: Setup pnpm cache |
| 60 | + with: |
| 61 | + path: ${{ env.STORE_PATH }} |
| 62 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} |
| 63 | + restore-keys: | |
| 64 | + ${{ runner.os }}-pnpm-store- |
| 65 | +
|
| 66 | + - name: Install dependencies |
| 67 | + run: pnpm install |
| 68 | + |
| 69 | + - name: Build |
| 70 | + run: pnpm build:packages |
| 71 | + |
| 72 | + - name: Setup Detox build framework cache |
| 73 | + working-directory: ./tools/powersynctests |
| 74 | + run: | |
| 75 | + pnpx detox clean-framework-cache && pnpx detox build-framework-cache |
| 76 | +
|
| 77 | + - name: Initialize Android Folder |
| 78 | + run: mkdir -p ~/.android/avd |
| 79 | + |
| 80 | + - name: create AVD and generate snapshot for caching |
| 81 | + if: steps.avd-cache.outputs.cache-hit != 'true' |
| 82 | + uses: reactivecircus/[email protected] |
| 83 | + with: |
| 84 | + api-level: 31 |
| 85 | + force-avd-creation: false |
| 86 | + target: google_apis |
| 87 | + arch: x86_64 |
| 88 | + disable-animations: false |
| 89 | + avd-name: $AVD_NAME |
| 90 | + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 91 | + script: echo "Generated AVD snapshot for caching." |
| 92 | + |
| 93 | + - name: Run connected Android tests |
| 94 | + uses: ReactiveCircus/[email protected] |
| 95 | + with: |
| 96 | + api-level: 31 |
| 97 | + target: google_apis |
| 98 | + arch: x86_64 |
| 99 | + avd-name: $AVD_NAME |
| 100 | + script: cd tools/powersynctests && pnpm android |
| 101 | + force-avd-creation: false |
| 102 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 103 | + disable-animations: true |
| 104 | + |
| 105 | + - name: Android Emulator Build |
| 106 | + working-directory: ./tools/powersynctests |
| 107 | + run: pnpx detox build --configuration android.emu.release |
| 108 | + |
| 109 | + - name: Android Emultator Test |
| 110 | + working-directory: ./tools/powersynctests |
| 111 | + run: pnpx detox test --configuration android.emu.release --headless |
| 112 | + |
| 113 | + test-ios: |
| 114 | + name: Test iOS |
| 115 | + runs-on: macOS-15 |
| 116 | + |
| 117 | + steps: |
| 118 | + - uses: actions/checkout@v4 |
| 119 | + with: |
| 120 | + persist-credentials: false |
| 121 | + |
| 122 | + - name: CocoaPods Cache |
| 123 | + uses: actions/cache@v3 |
| 124 | + id: cocoapods-cache |
| 125 | + with: |
| 126 | + path: | |
| 127 | + tools/powersynctests/ios/Pods/* |
| 128 | + key: ${{ runner.os }}-${{ hashFiles('tools/powersynctests/ios/Podfile.lock') }} |
| 129 | + |
| 130 | + - name: Setup NodeJS |
| 131 | + uses: actions/setup-node@v4 |
| 132 | + with: |
| 133 | + node-version-file: '.nvmrc' |
| 134 | + |
| 135 | + - uses: pnpm/action-setup@v2 |
| 136 | + name: Install pnpm |
| 137 | + with: |
| 138 | + version: 9 |
| 139 | + run_install: false |
| 140 | + |
| 141 | + - name: Get pnpm store directory |
| 142 | + shell: bash |
| 143 | + run: | |
| 144 | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
| 145 | +
|
| 146 | + - uses: actions/cache@v3 |
| 147 | + name: Setup pnpm cache |
| 148 | + with: |
| 149 | + path: ${{ env.STORE_PATH }} |
| 150 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} |
| 151 | + restore-keys: | |
| 152 | + ${{ runner.os }}-pnpm-store- |
| 153 | +
|
| 154 | + - name: Install dependencies |
| 155 | + run: pnpm install |
| 156 | + |
| 157 | + - name: Build |
| 158 | + run: pnpm build:packages |
| 159 | + |
| 160 | + - name: Install Detox dependencies |
| 161 | + run: | |
| 162 | + brew tap wix/brew |
| 163 | + brew install applesimutils |
| 164 | + npm install -g detox-cli |
| 165 | + detox clean-framework-cache && detox build-framework-cache |
| 166 | +
|
| 167 | + - name: Install CocoaPods dependencies |
| 168 | + working-directory: tools/powersynctests/ios |
| 169 | + run: pod install |
| 170 | + |
| 171 | + - name: iOS Simulator Build |
| 172 | + working-directory: ./tools/powersynctests |
| 173 | + run: pnpx detox build --configuration ios.sim.release |
| 174 | + |
| 175 | + - name: iOS Simulator Test |
| 176 | + working-directory: ./tools/powersynctests |
| 177 | + run: pnpx detox test --configuration ios.sim.release --cleanup |
0 commit comments