-
Notifications
You must be signed in to change notification settings - Fork 1
161 lines (132 loc) · 4.68 KB
/
Copy pathci-react-native.yml
File metadata and controls
161 lines (132 loc) · 4.68 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
name: CI React Native
on:
push:
branches: [main]
paths:
- 'libraries/react-native-ondevice-ai/**'
- '!libraries/react-native-ondevice-ai/**/*.md'
- '!libraries/react-native-ondevice-ai/**/*.mdx'
- '!libraries/react-native-ondevice-ai/example/src/screens/SettingsScreen.tsx'
- '.github/workflows/ci-react-native.yml'
pull_request:
branches: [main]
paths:
- 'libraries/react-native-ondevice-ai/**'
- '!libraries/react-native-ondevice-ai/**/*.md'
- '!libraries/react-native-ondevice-ai/**/*.mdx'
- '!libraries/react-native-ondevice-ai/example/src/screens/SettingsScreen.tsx'
- '.github/workflows/ci-react-native.yml'
jobs:
lint-and-test:
name: Lint & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: libraries/react-native-ondevice-ai
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.1.38'
- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-rn-${{ hashFiles('libraries/react-native-ondevice-ai/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-rn-
- name: Install dependencies
run: bun install
- name: Lint
run: bun run lint:ci
- name: Test
run: bun run test
- name: Build
run: npx bob build
- name: Verify build output
run: |
if [ ! -f "lib/module/index.js" ] || [ ! -f "lib/typescript/src/index.d.ts" ]; then
echo "Build output missing!"
exit 1
fi
- name: Verify nitrogen generated
run: |
if [ ! -d "nitrogen/generated" ]; then
echo "Nitrogen generated files missing!"
exit 1
fi
build-android:
name: Build Android
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.1.38'
- name: Install library dependencies
working-directory: libraries/react-native-ondevice-ai
run: bun install
- name: Install example dependencies
working-directory: libraries/react-native-ondevice-ai/example
run: bun install
- name: Build Android
working-directory: libraries/react-native-ondevice-ai/example/android
run: ./gradlew assembleDebug --no-daemon
build-ios:
name: Build iOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.1.38'
- name: Install library dependencies
working-directory: libraries/react-native-ondevice-ai
run: bun install
- name: Install example dependencies
working-directory: libraries/react-native-ondevice-ai/example
run: bun install
- name: Fix circular symlink
working-directory: libraries/react-native-ondevice-ai/example
run: |
# bun creates a symlink or directory copy for node_modules/react-native-ondevice-ai
# which includes example/ creating an infinite loop that breaks CocoaPods.
# Replace with a shallow copy excluding example/ to break the cycle.
rm -rf node_modules/react-native-ondevice-ai
rsync -a --exclude='example' --exclude='node_modules' ../../ node_modules/react-native-ondevice-ai/
- name: Cache CocoaPods
uses: actions/cache@v4
with:
path: libraries/react-native-ondevice-ai/example/ios/Pods
key: ${{ runner.os }}-pods-rn-${{ hashFiles('libraries/react-native-ondevice-ai/example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-rn-
- name: Install CocoaPods
working-directory: libraries/react-native-ondevice-ai/example/ios
run: pod install --no-repo-update
- name: Build iOS
working-directory: libraries/react-native-ondevice-ai/example/ios
run: |
xcodebuild \
-workspace OndeviceAiExample.xcworkspace \
-scheme OndeviceAiExample \
-destination 'generic/platform=iOS Simulator' \
-configuration Debug \
build \
CODE_SIGNING_ALLOWED=NO