-
-
Notifications
You must be signed in to change notification settings - Fork 268
175 lines (141 loc) · 4.95 KB
/
Copy pathci.yml
File metadata and controls
175 lines (141 loc) · 4.95 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install dependencies
run: npm ci
- name: Install SwiftLint
run: brew install swiftlint
- name: Lint
run: npm run lint
typecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Type check
run: npx tsc --noEmit
test:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check out pro submodule (private; skipped on open-core forks)
# When the PRO_SUBMODULE_PAT secret is present (this org's CI), pull the private
# pro/ submodule so the pro-dependent suites (TTS/MCP/audio) run against the REAL
# package — a green run then actually exercises pro, not a stub. Forks without the
# secret skip this: proExists=false and jest runs the open-core suite instead.
if: ${{ secrets.PRO_SUBMODULE_PAT != '' }}
env:
PRO_PAT: ${{ secrets.PRO_SUBMODULE_PAT }}
run: |
git config --global url."https://x-access-token:${PRO_PAT}@github.com/".insteadOf "https://github.com/"
git submodule update --init --recursive pro
git config --global --unset url."https://x-access-token:${PRO_PAT}@github.com/".insteadOf || true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install JS dependencies
run: npm ci
- name: Run Jest tests
run: npx jest --coverage --forceExit
- name: Install Android NDK
# Configuring the native modules (op-sqlite etc.) needs the pinned NDK; the macOS
# runner doesn't ship it, so the android test task failed at configure with
# "Failed to install ndk;...". Install the version android/build.gradle forces.
run: |
SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
yes | "$SDKMANAGER" "ndk;27.1.12297006" >/dev/null
- name: Run Android tests
run: cd android && ./gradlew :app:testDebugUnitTest --rerun-tasks
- name: Run iOS tests
run: |
cd ios && xcodebuild test \
-workspace OffgridMobile.xcworkspace \
-scheme OffgridMobile \
-destination 'platform=iOS Simulator,name=iPhone 16' \
-only-testing:OffgridMobileTests \
2>&1 | (xcpretty 2>/dev/null || cat)
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: false
- name: Upload iOS test results
if: always()
uses: actions/upload-artifact@v4
with:
name: ios-test-results
path: ~/Library/Developer/Xcode/DerivedData/**/Logs/Test/*.xcresult
if-no-files-found: ignore
- name: Upload Android test results
if: always()
uses: actions/upload-artifact@v4
with:
name: android-test-results
path: android/app/build/reports/tests/
if-no-files-found: ignore
android-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Free disk space
# The native C++ builds (react-native-audio-api, op-sqlite) exhausted the runner
# disk ("LLVM ERROR: IO failure on output stream: No space left on device").
# Reclaim large preinstalled toolchains we don't use; keep the Android SDK/NDK.
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL || true
sudo docker image prune --all --force || true
df -h
- name: Install dependencies
run: npm ci
- name: Build Android Debug
run: cd android && ./gradlew assembleDebug
- name: Build Android Release
run: cd android && ./gradlew assembleRelease