-
-
Notifications
You must be signed in to change notification settings - Fork 989
207 lines (188 loc) · 6.31 KB
/
mobile-ci.yml
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
name: Mobile CI
on:
push:
branches:
- main
pull_request:
paths:
- 'apps/mobile/**'
- '.github/workflows/mobile-ci.yml'
- 'core/**'
- 'crates/**'
- 'packages/assets/**'
- 'packages/client/**'
- 'packages/config/**'
workflow_dispatch:
env:
SPACEDRIVE_CUSTOM_APT_FLAGS: --no-install-recommends
SPACEDRIVE_CI: '1'
# From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/ci.yaml
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
# Cancel previous runs of the same workflow on the same branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
js:
name: JS
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js, pnpm and dependencies
uses: ./.github/actions/setup-pnpm
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build mobile JS
run: pnpm mobile export
# Disabled until I can figure out why our app on x86_64 crashes on startup.
# android:
# name: Android
# runs-on: macos-12
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
#
# - name: Setup Java JDK
# uses: actions/[email protected]
# with:
# java-version: '18'
# distribution: 'temurin'
#
# - name: Setup Node.js, pnpm and dependencies
# uses: ./.github/actions/setup-pnpm
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Setup System and Rust
# uses: ./.github/actions/setup-system
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# setup-arg: mobile
#
# - name: Setup Android SDK Tools
# uses: android-actions/[email protected]
#
# - name: Cache NDK
# uses: actions/cache@v3
# with:
# path: ${{ env.ANDROID_HOME }}/ndk/26.1.10909125
# key: ndk-26.1.10909125
#
# - name: Install NDK
# run: echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;26.1.10909125"
#
# - name: Cache Gradle
# uses: gradle/gradle-build-action@v2
#
# - name: Build Android
# working-directory: ./apps/mobile/android
# run: chmod +x ./gradlew && ./gradlew assembleRelease -PreactNativeArchitectures=x86_64 --no-daemon
#
# - name: Cache AVD
# uses: actions/cache@v3
# id: avd-cache
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adb*
# key: avd-30
#
# - name: Generate AVD Snapshot
# if: ${{ steps.avd-cache.outputs.cache-hit != 'true' }}
# uses: ReactiveCircus/[email protected]
# with:
# arch: x86_64
# api-level: 30
# target: google_apis
# ndk: 26.1.10909125
# ram-size: 4096M
# emulator-boot-timeout: 12000
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: false
# script: echo "Generated AVD snapshot."
#
# - name: Install Maestro
# run: |
# # workaround for https://github.com/mobile-dev-inc/maestro/issues/877
# export MAESTRO_VERSION=1.21.3; curl -Ls "https://get.maestro.mobile.dev" | bash
# echo "$HOME/.maestro/bin" >> $GITHUB_PATH
#
# - name: Run Tests
# uses: ReactiveCircus/[email protected]
# with:
# arch: x86_64
# api-level: 30
# target: google_apis
# ndk: 26.1.10909125
# ram-size: 4096M
# emulator-boot-timeout: 12000
# force-avd-creation: false
# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: true
# script: |
# adb install -r apps/mobile/android/app/build/outputs/apk/release/app-release.apk
# adb wait-for-device
# ./apps/mobile/scripts/run-maestro-tests.sh android
ios:
name: iOS
runs-on: macos-14
steps:
- name: Checkout repository
uses: actions/checkout@v4
# - name: Install Xcode
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: latest-stable
- name: Setup System and Rust
uses: ./.github/actions/setup-system
with:
token: ${{ secrets.GITHUB_TOKEN }}
setup-arg: mobile
- name: Setup Node.js, pnpm and dependencies
uses: ./.github/actions/setup-pnpm
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate iOS Project
working-directory: ./apps/mobile
run: pnpm expo prebuild --platform ios --no-install
# Hermes doesn't work with Cocoapods 1.15.0
# https://forums.developer.apple.com/forums/thread/745518
- name: Setup Cocoapods
uses: maxim-lobanov/setup-cocoapods@v1
with:
version: latest
# - name: Cache Pods
# uses: actions/cache@v4
# with:
# path: |
# ./apps/mobile/ios/Pods
# ~/Library/Caches/CocoaPods
# ~/.cocoapods
# key: pods-${{ hashFiles('./apps/mobile/ios/Podfile.lock') }}
# restore-keys: pods-
- name: Install Pods
working-directory: ./apps/mobile/ios
run: pod install --repo-update
- name: Build iOS
working-directory: ./apps/mobile/ios
run: xcodebuild -workspace ./Spacedrive.xcworkspace -scheme Spacedrive -configuration Release -sdk iphonesimulator -derivedDataPath build -arch "$(uname -m)"
- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
brew tap facebook/fb
brew install facebook/fb/idb-companion
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
- name: Run Simulator
id: run_simulator
uses: futureware-tech/simulator-action@v3
with:
model: 'iPhone 14'
os_version: 17.4
erase_before_boot: false
- name: Run Tests
run: ./apps/mobile/scripts/run-maestro-tests.sh ios ${{ steps.run_simulator.outputs.udid }}