-
Notifications
You must be signed in to change notification settings - Fork 4
171 lines (137 loc) · 4.38 KB
/
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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Lint files
run: yarn lint
- name: Typecheck files
run: yarn typecheck
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Run unit tests
run: yarn test --maxWorkers=2 --coverage
build-library:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Build package
run: yarn prepare
build-android-e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Setup Java
uses: actions/setup-java@v4
with:
cache: 'gradle'
distribution: temurin
java-version: 17
- name: Write sitekeys to file
env:
EXAMPLE_ENV: ${{ secrets.EXAMPLE_ENV }}
run: echo "$EXAMPLE_ENV" >> example/.env
- name: Finalize Android SDK
run: |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
- name: Build example for Android
env:
JAVA_OPTS: "-XX:MaxHeapSize=6g"
run: |
yarn run build:android
- name: Get device name
id: device
run: |
cd example
node -e "console.log('AVD_NAME=' + require('./.detoxrc').devices.emulator.device.avdName)" >> $GITHUB_OUTPUT
- 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: Detox build
run: |
cd example
yarn detox build --configuration android.emu.release
- name: E2E test for Android
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
arch: x86_64
avd-name: ${{ steps.device.outputs.AVD_NAME }}
script: cd example && yarn detox test --configuration android.emu.release --headless --record-logs all
build-ios-e2e:
runs-on: macos-14-xlarge
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Select xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.3'
- name: Install macOS dependencies
run: |
brew tap wix/brew
brew install applesimutils
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Write sitekeys to file
env:
EXAMPLE_ENV: ${{ secrets.EXAMPLE_ENV }}
run: echo "$EXAMPLE_ENV" >> example/.env
- name: Cache XCode Derived Data
uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
- name: Cache Example CocoaPods
id: cache-example-cocoapods
uses: actions/cache@v3
with:
path: example/ios/Pods
key: ${{ runner.os }}-example-pods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-example-pods-
- name: Install Example CocoaPods # Need to still run pod install even with cache
run: cd example/ios ; pod install
- name: Build example for iOS
run: |
yarn run build:ios
- name: Detox rebuild framework cache
run: |
cd example
yarn detox rebuild-framework-cache
- name: Detox build
run: |
cd example
yarn detox build --configuration ios.sim.release
- name: Detox test
# continue-on-error: true # iOS test is flaky, run locally for now
run: |
cd example
yarn detox test --configuration ios.sim.release --headless --record-logs all