-
Notifications
You must be signed in to change notification settings - Fork 80
218 lines (188 loc) · 6.13 KB
/
test.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
208
209
210
211
212
213
214
215
216
217
218
name: test
on:
schedule:
- cron: '0 15 * * *'
push:
branches: [main]
pull_request:
types: [opened, synchronize]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
env:
hasAuth: ${{ !!secrets.EXPO_TOKEN }}
jobs:
setup:
strategy:
matrix:
os: [ubuntu, windows, macos]
cache: [cache, no-cache]
packager: [bun, npm, yarn]
exclude:
# Windows can't unpack caches that fast
- os: windows
cache: cache
# Bun isn't supported on Windows (yet)
- os: windows
packager: bun
runs-on: ${{ matrix.os }}-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
- name: 🏗 Setup runner
uses: ./.github/actions/setup
- name: 🏗 Setup Expo
uses: ./
with:
eas-version: latest
eas-cache: ${{ matrix.cache == 'cache' }}
expo-version: latest
expo-cache: ${{ matrix.cache == 'cache' }}
packager: ${{ matrix.packager }}
token: ${{ secrets.EXPO_TOKEN }}
- name: 🧪 EAS installed
run: eas --version
- name: 🧪 EAS authenticated
if: ${{ env.hasAuth == 'true' }}
run: eas whoami
- name: 🧪 Expo installed
run: expo --version
- name: 🧪 Expo authenticated
if: ${{ env.hasAuth == 'true' }}
run: expo whoami
preview:
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
- name: 🏗 Setup runner
uses: ./.github/actions/setup
- name: 🏗 Setup EAS
uses: ./
with:
eas-version: latest
packager: bun
token: ${{ secrets.EXPO_TOKEN }}
- name: 🏗 Setup project
run: bun create expo ./temp --template blank
- name: 👷 Configure project
working-directory: ./temp
run: |
eas init --id ${{ secrets.EXPO_PROJECT_ID }} --force --non-interactive
echo $(jq '.expo.runtimeVersion.policy = "sdkVersion"' app.json) > app.json
- name: 🚀 Create preview (without comment)
if: ${{ env.hasAuth == 'true' }}
uses: ./preview
id: no-comment
env:
EXPO_TEST_GITHUB_PULL: 206
with:
working-directory: ./temp
command: eas update --branch test --message "This is a test"
comment: false
- name: 🧪 Comment has content
if: ${{ env.hasAuth == 'true' }}
uses: actions/github-script@v7
with:
script: |
const comment = `${{ steps.no-comment.outputs.comment }}`
if (!comment) {
console.log({ comment });
throw new Error('Message output is empty');
}
- name: 🚀 Create preview (single QR)
if: ${{ env.hasAuth == 'true' }}
id: single-qr
uses: ./preview
env:
EXPO_TEST_GITHUB_PULL: 206
with:
working-directory: ./temp
command: eas update --branch test --message "This is a test"
comment-id: 'projectId:{projectId} single-qr'
- name: 🧪 Single QR has content
if: ${{ env.hasAuth == 'true' }}
uses: actions/github-script@v7
with:
script: |
const comment = `${{ steps.single-qr.outputs.comment }}`
if (!comment) {
console.log({ comment });
throw new Error('Message output is empty');
}
- name: 👷 Configure runtime versions
working-directory: ./temp
run: |
echo $(jq 'del(.expo.runtimeVersion)' app.json) > app.json
echo $(jq '.expo.android.runtimeVersion.policy = "sdkVersion"' app.json) > app.json
echo $(jq '.expo.ios.runtimeVersion.policy = "appVersion"' app.json) > app.json
echo $(jq '.expo.scheme = "expogithubaction"' app.json) > app.json
- name: 🚀 Create preview (multi QR)
if: ${{ env.hasAuth == 'true' }}
id: multi-qr
uses: ./preview
env:
EXPO_TEST_GITHUB_PULL: 206
with:
working-directory: ./temp
command: eas update --branch test --message "This is a test"
comment-id: 'projectId:{projectId} multi-qr'
- name: 🧪 Multi QR has content
if: ${{ env.hasAuth == 'true' }}
uses: actions/github-script@v7
with:
script: |
const comment = `${{ steps.multi-qr.outputs.comment }}`
if (!comment) {
console.log({ comment });
throw new Error('Message output is empty');
}
preview-comment:
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
- name: 🏗 Setup runner
uses: ./.github/actions/setup
- name: 🏗 Setup Expo
uses: ./
with:
eas-version: latest
expo-version: latest
packager: bun
token: ${{ secrets.EXPO_TOKEN }}
- name: 🏗 Setup project
run: bun create expo ./temp --template blank
- name: 🧪 Without commenting
if: ${{ env.hasAuth == 'true' }}
uses: ./preview-comment
id: preview
with:
project: ./temp
comment: false
- name: 🧪 Output has content
if: ${{ env.hasAuth == 'true' }}
uses: actions/github-script@v7
with:
script: |
const message = `${{ steps.preview.outputs.message }}`
if (!message) throw new Error('Message output is empty')
- name: 🧪 Comment on PR (github-token)
if: ${{ env.hasAuth == 'true' }}
uses: ./preview-comment
env:
EXPO_TEST_GITHUB_PULL: 149
with:
project: ./temp
channel: test
- name: 🧪 Comment on PR (GITHUB_TOKEN)
if: ${{ env.hasAuth == 'true' }}
uses: ./preview-comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXPO_TEST_GITHUB_PULL: 149
with:
project: ./temp
channel: test
github-token: badtoken