-
Notifications
You must be signed in to change notification settings - Fork 7
375 lines (328 loc) · 14.1 KB
/
package-and-deploy.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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
name: package-and-deploy
on:
push:
branches: [ main ]
jobs:
# WINDOWS BUILD
windows-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: get cmake
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
cmakeVersion: "3.27.0"
- name: run build
run: |
cd ${{ github.workspace }}
mkdir -p builds
cmake -S . -B builds -DCMAKE_BUILD_TYPE=Release -DIS_CI_BUILD="true"
cmake --build builds --config Release
- name: rename binaries
run: |
move ${{ github.workspace }}\builds\Release\crescent_engine.exe ${{ github.workspace }}\crescent_engine_windows.exe
move ${{ github.workspace }}\builds\Release\crescent_engine_editor.exe ${{ github.workspace }}\crescent_engine_editor_windows.exe
- name: run unit tests
run: |
echo "Running crescent engine tests!"
${{ github.workspace }}\builds\Release\crescent_engine_test.exe
echo ""
echo "Running crescent engine editor tests!"
${{ github.workspace }}\builds\Release\crescent_engine_editor_test.exe
- name: package dlls (and python zip)
run: |
cd ${{ github.workspace }}
mkdir -p windows_run_dependencies
# Get all dll files
$dllFiles = Get-ChildItem -Path . -Filter *.dll -Recurse
# Copy dlls
foreach ($file in $dllFiles) {
$destPath = Join-Path -Path windows_run_dependencies\ -ChildPath $file.Name
Copy-Item -Path $file.FullName -Destination $destPath
}
Compress-Archive -Path windows_run_dependencies -DestinationPath ${{ github.workspace }}\windows_run_dependencies.zip
- name: store engine binary
uses: actions/upload-artifact@v4
with:
name: crescent_engine_windows.exe
path: crescent_engine_windows.exe
if-no-files-found: error
- name: store editor binary
uses: actions/upload-artifact@v4
with:
name: crescent_engine_editor_windows.exe
path: crescent_engine_editor_windows.exe
if-no-files-found: error
- name: store windows deps
uses: actions/upload-artifact@v4
with:
name: windows_run_dependencies.zip
path: windows_run_dependencies.zip
if-no-files-found: error
# LINUX BUILD
linux-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install dependencies
run: |
sudo apt install gcc-11 g++-11 libgl1-mesa-dev libglu1-mesa-dev libxext-dev
- name: get cmake
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
cmakeVersion: "3.27.0"
- name: run build
run: |
cd ${{ github.workspace }}
mkdir -p builds
cmake -S . -B builds -DCMAKE_BUILD_TYPE=Release -DIS_CI_BUILD="true"
cmake --build builds --config Release
- name: rename binaries
run: |
cd ${{ github.workspace }}
mv builds/crescent_engine crescent_engine_linux
mv builds/crescent_engine_editor crescent_engine_editor_linux
chmod +x crescent_engine_linux
chmod +x crescent_engine_editor_linux
- name: run unit tests
run: |
echo "Running crescent engine tests!"
${{ github.workspace }}/builds/crescent_engine_test
echo ""
echo "Running crescent engine editor tests!"
${{ github.workspace }}/builds/crescent_engine_editor_test
- name: store engine binary
uses: actions/upload-artifact@v4
with:
name: crescent_engine_linux
path: crescent_engine_linux
if-no-files-found: error
- name: store editor binary
uses: actions/upload-artifact@v4
with:
name: crescent_engine_editor_linux
path: crescent_engine_editor_linux
if-no-files-found: error
# MACOSX BUILD
macosx-build:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- name: install dependencies
run: |
brew install pkg-config
- name: get cmake
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
cmakeVersion: "3.27.0"
- name: run build
run: |
cd ${{ github.workspace }}
mkdir -p builds
cmake -S . -B builds -DCMAKE_BUILD_TYPE=Release -DIS_CI_BUILD="true"
cmake --build builds --config Release
- name: rename binaries
run: |
cd ${{ github.workspace }}
mv builds/crescent_engine crescent_engine_macosx
mv builds/crescent_engine_editor crescent_engine_editor_macosx
chmod +x crescent_engine_macosx
chmod +x crescent_engine_editor_macosx
- name: run unit tests
run: |
cd ${{ github.workspace }}
echo "Running crescent engine tests!"
builds/crescent_engine_test
echo ""
echo "Running crescent engine editor tests!"
builds/crescent_engine_editor_test
# - name: decode private key and cert
# run: |
# echo "${{ secrets.MAC_CERT_KEY }}" >> cert.txt
# echo "${{ secrets.MAC_PKEY }}" >> pkey.txt
# base64 -D -i cert.txt -o cert.cer
# base64 -D -i pkey.txt -o private.key
#
# - name: setup keychain
# run: |
# security create-keychain -p '${{ secrets.MAC_KEYCHAIN_PASS }}' build.keychain
# security default-keychain -s build.keychain
# security unlock-keychain -p '${{ secrets.MAC_KEYCHAIN_PASS }}' build.keychain
# security set-keychain-settings -t 3600 -u build.keychain
#
# - name: import private key
# run: |
# security import private.key -A -k build.keychain
#
# - name: import cert
# run: |
# security import cert.cer -A -k build.keychain
#
# - name: set up code signing
# run: |
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${{ secrets.MAC_KEYCHAIN_PASS }}" build.keychain
# security find-identity -v -p codesigning build.keychain
#
# - name: sign app
# run: |
# codesign -s "${{ secrets.MAC_SIGNING_ID }}" -v crescent_engine_macosx
# codesign -s "${{ secrets.MAC_SIGNING_ID }}" -v crescent_engine_editor_macosx
- name: store engine binary
uses: actions/upload-artifact@v4
with:
name: crescent_engine_macosx
path: crescent_engine_macosx
if-no-files-found: error
- name: store engine binary
uses: actions/upload-artifact@v4
with:
name: crescent_engine_editor_macosx
path: crescent_engine_editor_macosx
if-no-files-found: error
package-all:
runs-on: ubuntu-latest
needs: [windows-build, linux-build, macosx-build]
steps:
- uses: actions/checkout@v1
- name: set env vars
run: |
CRESCENT_VERSION=$(python3 ${{ github.workspace }}/ci/get_engine_version.py ${{ github.workspace }}/engine/src/core/core_info.h)
echo "CRESCENT_VERSION=$CRESCENT_VERSION" >> $GITHUB_ENV
- name: install pip packages
run: |
python3 -m pip install google-auth google-api-python-client
- name: setup directories
run: |
# Windows
mkdir -p crescent_windows/bin/windows
mkdir -p crescent_windows/bin/linux
mkdir -p crescent_windows/bin/macosx
# Linux
mkdir -p crescent_linux/bin/windows
mkdir -p crescent_linux/bin/linux
mkdir -p crescent_linux/bin/macosx
# Macosx
mkdir -p crescent_macosx/bin/windows
mkdir -p crescent_macosx/bin/linux
mkdir -p crescent_macosx/bin/macosx
# Create creds file
cd ${{ github.workspace }}
echo "${{ secrets.GDRIVE_CREDENTIALS }}" >> creds.json
- name: download windows engine binary
uses: actions/download-artifact@v4
with:
name: crescent_engine_windows.exe
- name: download windows editor binary
uses: actions/download-artifact@v4
with:
name: crescent_engine_editor_windows.exe
- name: download windows deps
uses: actions/download-artifact@v4
with:
name: windows_run_dependencies.zip
- name: download linux engine binary
uses: actions/download-artifact@v4
with:
name: crescent_engine_linux
- name: download linux editor binary
uses: actions/download-artifact@v4
with:
name: crescent_engine_editor_linux
- name: download macosx signed engine binary
uses: actions/download-artifact@v4
with:
name: crescent_engine_macosx
- name: download macosx signed editor binary
uses: actions/download-artifact@v4
with:
name: crescent_engine_editor_macosx
- name: build windows package
run: |
# Copy engine binaries
cp crescent_engine_windows.exe crescent_windows/bin/windows/crescent_engine.exe
cp crescent_engine_linux crescent_windows/bin/linux/crescent_engine
cp crescent_engine_macosx crescent_windows/bin/macosx/crescent_engine
cp -r assets crescent_windows/bin/windows
cp -r test_games crescent_windows/bin/windows
cp -r assets crescent_windows/bin/linux
cp -r test_games crescent_windows/bin/linux
cp -r assets crescent_windows/bin/macosx
cp -r test_games crescent_windows/bin/macosx
# Move editor
mv crescent_engine_editor_windows.exe crescent_windows/crescent.exe
# Copy windows runtime deps
# Copy windows runtime deps
unzip windows_run_dependencies.zip
cp windows_run_dependencies/* crescent_windows/
cp windows_run_dependencies/* crescent_windows/bin/windows/
chmod -R 755 crescent_windows
zip -r crescent_windows.zip crescent_windows/
- name: build linux package
run: |
# Copy engine binaries
cp crescent_engine_windows.exe crescent_linux/bin/windows/crescent_engine.exe
cp crescent_engine_linux crescent_linux/bin/linux/crescent_engine
cp crescent_engine_macosx crescent_linux/bin/macosx/crescent_engine
cp -r assets crescent_linux/bin/windows
cp -r test_games crescent_linux/bin/windows
cp -r assets crescent_linux/bin/linux
cp -r test_games crescent_linux/bin/linux
cp -r assets crescent_linux/bin/macosx
cp -r test_games crescent_linux/bin/macosx
# Move editor
mv crescent_engine_editor_linux crescent_linux/crescent
# Copy runtime deps
cp windows_run_dependencies/* crescent_linux/bin/windows/
chmod -R 755 crescent_linux
zip -r crescent_linux.zip crescent_linux/
tar -czvf crescent_linux.tar.gz crescent_linux/
- name: build macosx package
run: |
# Just build app bundle for engine as editor doesn't exist yet
# Create export template
mkdir -p crescent.app/Contents/MacOS
mkdir -p crescent.app/Contents/Resources
mkdir -p crescent.app/Contents/MacOS/bin/windows
mkdir -p crescent.app/Contents/MacOS/bin/linux
mkdir -p crescent.app/Contents/MacOS/bin/macosx
python ci/generate_macos_plist_info.py crescent.app/Contents/Info.plist crescent ${{ env.CRESCENT_VERSION }} crescent
# Copy engine binaries
cp crescent_engine_windows.exe crescent.app/Contents/MacOS/bin/windows/crescent_engine.exe
cp crescent_engine_linux crescent.app/Contents/MacOS/bin/linux/crescent_engine
cp crescent_engine_macosx crescent.app/Contents/MacOS/bin/macosx/crescent_engine
cp -r assets crescent.app/Contents/MacOS/bin/windows
cp -r test_games crescent.app/Contents/MacOS/bin/windows
cp -r assets crescent.app/Contents/MacOS/bin/linux
cp -r test_games crescent.app/Contents/MacOS/bin/linux
cp -r assets crescent.app/Contents/MacOS/bin/macosx
cp -r test_games crescent.app/Contents/MacOS/bin/macosx
# Move editor
mv crescent_engine_editor_macosx crescent.app/Contents/MacOS/crescent
# Copy runtime deps
cp windows_run_dependencies/* crescent.app/Contents/MacOS/bin/windows/
chmod -R 755 crescent.app
zip -r crescent_macosx.zip crescent.app/
tar -czvf crescent_macosx.tar.gz crescent.app/
- name: deploy packages
run: |
python -m pip install google-auth google-api-python-client
echo "${{ secrets.GDRIVE_CREDENTIALS }}" > creds.json
echo "deploying windows package"
python ci/upload_to_gd.py crescent_windows.zip ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
echo "deploying linux packages"
python ci/upload_to_gd.py crescent_linux.zip ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
python ci/upload_to_gd.py crescent_linux.tar.gz ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
echo "deploying macosx packages"
python ci/upload_to_gd.py crescent_macosx.zip ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
python ci/upload_to_gd.py crescent_macosx.tar.gz ${{ github.workspace }}/creds.json ${{ secrets.GDRIVE_FOLDER_ID }}
- name: create or update release draft
run: |
python -m pip install PyGithub urllib3 Brotli
echo "Creating or updating release draft stub"
python ci/create_or_update_release_draft.py ${{ secrets.CI_ACCESS_TOKEN }} ${{ env.CRESCENT_VERSION }} crescent_windows.zip crescent_linux.zip crescent_linux.tar.gz crescent_macosx.zip crescent_macosx.tar.gz