-
Notifications
You must be signed in to change notification settings - Fork 111
330 lines (298 loc) · 10.3 KB
/
client-build-tool.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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
on:
workflow_call:
inputs:
# controllable flow properties
# do you want to deploy
# do you want to run tests
# do you want to notify on slack
# do you want to use 7zip to package instead of zip
should-deploy:
required: true
type: boolean
should-deploy-as-server:
required: false
type: boolean
should-run-unit-tests:
required: true
type: boolean
should-notify-on-failure:
required: true
type: boolean
should-unzip-editor: # macos requires an extra zip file on cicd
required: false
type: boolean
should-install-timeout-macos:
required: false
type: boolean
# godot export properties
# specifies the workflow, name, branch and binary to download for the editor and template.
editor-binary-workflow:
required: true
type: string
editor-binary-name:
required: true
type: string
# for when the binary name is not consistent like on macos.
editor-binary-download:
required: true
type: string
editor-binary-branch:
required: true
type: string
editor-template-directory:
required: true
type: string
template-binary-workflow:
required: true
type: string
template-binary-name:
required: true
type: string
template-binary-branch:
required: true
type: string
export-template-file:
required: true
type: string
# server properties
server-pck-path:
required: false
type: string
# game properties
# the mirror environment configuration to use
game-environment-cfg-name:
required: true
type: string
# the export preset to use
game-export-preset:
required: true
type: string
# game output binary name
game-binary-name:
required: true
type: string
# gcp bucket name to upload to
bucket-name:
required: true
type: string
os:
required: true
type: string
environment:
required: false
type: string
url:
required: false
type: string
itch-channel:
required: false
type: string
itch-project-name:
required: false
type: string
platform-file-extension:
required: false
type: string
custom-project-file:
required: false
type: string
editor-download-url:
required: true
type: string
template-download-url:
required: true
type: string
keep-openxr-binaries:
required: false
type: boolean
outputs:
url:
value: ${{ jobs.client-build-tool.outputs.url }}
file-name:
value: ${{ jobs.client-build-tool.outputs.file-name }}
version:
value: ${{ jobs.client-build-tool.outputs.version }}
secrets:
# only required when you deploy
GCP_DEPLOYMENT_SECRET:
required: false
# declare these so that they can be populated by the app
env:
app_platform:
app_ver:
url: ${{ inputs.url }}
# we ensure our windows runners use bash always.
defaults:
run:
shell: bash
# working-directory: ./mirror-godot-app
jobs:
client-build-tool:
name: Build
environment: ${{ inputs.environment }}
runs-on: ${{ inputs.os }}
timeout-minutes: 65
outputs:
url: ${{ steps.output-url.outputs.url }}
file-name: ${{ steps.output-file-name.outputs.file-name }}
version: ${{ steps.output-version.outputs.version }}
steps:
- name: Cleanup working directory (git version differences break the clean command otherwise)
run: |
shopt -s dotglob # includes all hidden files
rm -rf ./*
- uses: actions/checkout@v4
with:
path: app-clone/
- name: Installing coreutils (for gtimeout)
if: ${{ inputs.should-install-timeout-macos }}
run: brew install coreutils
- name: Fix working directory
run: |
ls -lah
shopt -s dotglob # includes all hidden files
mv ./app-clone/mirror-godot-app/* .
ls -lah
- name: Remove VR contents if not required
if: ${{ !inputs.keep-openxr-binaries }}
run: |
rm -rf addons/godotopenxrvendors
- name: Use custom project file (required for custom splash screen)
if: ${{ inputs.custom-project-file }}
run: |
rm -Rf project.godot
mv ${{ inputs.custom-project-file }} project.godot
- name: Download editor and template
run: |
curl ${{ inputs.editor-download-url }} > ${{ inputs.editor-binary-download }}
curl ${{ inputs.template-download-url }} > ${{ inputs.template-binary-name }}
- name: Unzip editor binary
if: ${{ inputs.should-unzip-editor }}
run: |
unzip -o ${{ inputs.editor-binary-download }}
- name: Set up template in system-wide editor data
run: |
chmod +x ./${{ inputs.template-binary-name }}
mkdir -p ${{ inputs.editor-template-directory }}
mv ./${{ inputs.template-binary-name }} ${{ inputs.editor-template-directory }}/${{ inputs.export-template-file }}
- name: Copy environment configuration to override.cfg
run: |
ls -R .
rm -Rf override.cfg
cp ./addons/mirror_internal/env_configs/${{ inputs.game-environment-cfg-name }}.cfg override.cfg
# must be removed before booting the app otherwise we overwrite the override.cfg
rm -Rf addons/mirror_internal
- name: Wait for import of all assets
if: ${{ !inputs.should-install-timeout-macos }}
run: |
chmod +x ./${{ inputs.editor-binary-name }}
timeout 3m ./${{ inputs.editor-binary-name }} --editor --headless || true;
- name: Wait for import of all assets
if: ${{ inputs.should-install-timeout-macos }}
run: |
chmod +x ./${{ inputs.editor-binary-name }}
gtimeout 3m ./${{ inputs.editor-binary-name }} --editor --headless || true;
- name: Unit Tests
timeout-minutes: 15
# disabled until we can fix gut
if: false
run: |
chmod +x ./${{ inputs.editor-binary-name }}
./${{ inputs.editor-binary-name }} -s --path ./ addons/gut/gut_cmdln.gd --headless
- name: Delete tests and other editor-only files
run: |
rm -Rf test
rm -Rf addons/gut
rm -Rf gha-creds-*.json # ensure no credentials are stored in the app.
- name: Export game client
timeout-minutes: 10
run: |
mkdir build/
chmod +x ./${{ inputs.editor-binary-name }}
./${{ inputs.editor-binary-name }} \
--headless \
--export-release ${{ inputs.game-export-preset }} \
"build/${{ inputs.game-binary-name }}";
chmod -R +x build/
- name: Retrieve version information from platform data
run: |
cd build/
ls
cat version.txt
cat platform_name.txt
ver=$(cat version.txt)
platform=$(cat platform_name.txt)
echo $ver
echo $platform
echo "app_ver=${ver}" >> $GITHUB_ENV
echo "app_platform=${platform}" >> $GITHUB_ENV
- uses: msys2/setup-msys2@v2
if: ${{ inputs.os == 'windows-latest' }}
with:
update: true
install: >-
zip
- name: Zip for client download
if: ${{ inputs.os != 'windows-latest' }}
run: |
cd build/
ls ./
zip -r ${{env.app_platform}}.zip "${{ inputs.game-binary-name }}" *.pck
- name: Zip for client download
if: ${{ inputs.os == 'windows-latest' }}
shell: msys2 {0}
run: |
cd build/
ls ./
zip -r ${{env.app_platform}}.zip "${{ inputs.game-binary-name }}" *.pck
- name: Google Cloud Platform authentication
if: ${{ inputs.should-deploy || inputs.should-deploy-as-server }}
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_DEPLOYMENT_SECRET }}'
- name: Upload build to GCP (for auto-updater)
if: inputs.should-deploy
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: build/${{ env.app_platform }}.tar.gz
destination: ${{ inputs.bucket-name }}/versions/${{ env.app_ver }}/
- name: Upload build to GCP (for users)
if: inputs.should-deploy
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: build/${{ env.app_platform }}.zip
destination: ${{ inputs.bucket-name }}/versions/${{ env.app_ver }}/
- name: Upload platform json to GCP
if: inputs.should-deploy
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: build/${{ env.app_platform }}.json
destination: ${{ inputs.bucket-name }}/versions/${{ env.app_ver }}/
- name: Upload server pck
if: inputs.should-deploy-as-server
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: build/${{ inputs.server-pck-path }}
destination: ${{ inputs.bucket-name }}/versions/${{ env.app_ver }}/
- name: Uploading server binary
if: inputs.should-deploy-as-server
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: build/${{ inputs.game-binary-name }}
destination: ${{ inputs.bucket-name }}/versions/${{ env.app_ver }}/
- id: output-url
run: |
echo "url=${{ inputs.bucket-name }}/versions/${{ env.app_ver }}/${{ env.app_platform }}${{ inputs.platform-file-extension }}" >> $GITHUB_OUTPUT
- id: output-file-name
run: |
echo "file-name=${{ env.app_platform }}${{ inputs.platform-file-extension }}" >> $GITHUB_OUTPUT
- id: output-version
run: |
echo "version=${{ env.app_ver }}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: ./.github/actions/upload-artifact
with:
path: |
build/${{ inputs.game-binary-name }}
build/*.pck
name: ${{ env.app_platform }}-client