-
Notifications
You must be signed in to change notification settings - Fork 191
158 lines (142 loc) · 4.65 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
name: CI
on:
push:
branches: [master, beta]
pull_request:
branches: [master, beta]
workflow_dispatch:
jobs:
cancel_previous:
runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
with:
workflow_id: ${{ github.event.workflow.id }}
build-and-test:
needs: cancel_previous
runs-on: 'ubuntu-latest'
env:
YARN_ENABLE_HARDENED_MODE: 0
steps:
- uses: actions/checkout@v4
# Workaround for corepack enable in node
# Source: (https://github.com/actions/setup-node/issues/899#issuecomment-1828798029)
- uses: actions/setup-node@v4
with:
node-version: 20
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
# End workaround
- name: Install
run: yarn install --immutable
- name: Build
run: yarn build
- name: Lint
run: yarn lint
- name: Test
run: yarn test --coverage
run-e2e-ios:
runs-on: 'macos-13'
env:
YARN_ENABLE_HARDENED_MODE: 0
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install applesimutils
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
- uses: actions/checkout@v4
# Workaround for corepack enable in node
# Source: (https://github.com/actions/setup-node/issues/899#issuecomment-1828798029)
- uses: actions/setup-node@v4
with:
node-version: 20
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
# End workaround
- name: Bootstrap
run: yarn install && yarn e2e install && yarn e2e pods
- name: Bundle Build
run: yarn build
- name: Detox - Build
run: RCT_NO_LAUNCH_PACKAGER=1 yarn e2e build:ios
- name: Detox - Test
run: yarn e2e test:ios
run-e2e-android:
runs-on: 'macos-13' # This is important, linux cannot run the emulator graphically for e2e tests
strategy:
matrix:
api-level: [21]
profile: ['pixel_xl']
env:
YARN_ENABLE_HARDENED_MODE: 0
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Gradle cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{matrix.profile}}
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
profile: ${{matrix.profile}}
avd-name: Pixel_API_21_AOSP
target: default
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 for caching."
# Workaround for corepack enable in node
# Source: (https://github.com/actions/setup-node/issues/899#issuecomment-1828798029)
- uses: actions/setup-node@v4
with:
node-version: 20
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
# End workaround
- name: Bootstrap
run: yarn install && yarn e2e install # No need to run bootstrap here since we don't need cocoapods
- name: Bundle build
run: yarn build
- name: Detox - Build
run: RCT_NO_LAUNCH_PACKAGER=1 yarn e2e build:android
- name: Detox - Test
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
profile: ${{matrix.profile}}
avd-name: Pixel_API_21_AOSP
target: default
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: yarn e2e test:android