-
-
Notifications
You must be signed in to change notification settings - Fork 53
462 lines (422 loc) · 17.4 KB
/
make.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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
name: Win/Mac/Linux
on:
push:
tags:
- v* # push events versioned tags
branches:
- master
env:
AUTOTESTER_LIBS_GROUP: ${{github.workspace}}/toolchain/clibs.8xg
AUTOTESTER_ROM: ${{github.workspace}}/secrets/83pce_515_530.rom
CEDEV: ${{github.workspace}}/CEdev
CEDEV_BIN: ${{github.workspace}}/CEdev/bin
CEDEV_EXAMPLES: ${{github.workspace}}/CEdev/examples
CEDEV_TEST: ${{github.workspace}}/toolchain/test
CEMU_PATH: ${{github.workspace}}/CEmu
FASMG_DOMAIN: https://flatassembler.net
FASMG_PATH: ${{github.workspace}}/fasmg
SECRETS_PATH: ${{github.workspace}}/secrets
TOOLCHAIN_PATH: ${{github.workspace}}/toolchain
jobs:
build:
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04, macos-13, macos-14, windows-latest]
include:
- nul: /dev/null
- runs-on: macos-13
fasmg: /source/macos/x64/fasmg
arch-suffix: "-intel"
ez80-bins-suffix: macOS_intel
install-output-ext: "dmg"
- runs-on: macos-14
fasmg: /source/macos/x64/fasmg
arch-suffix: "-arm"
ez80-bins-suffix: macOS_arm
install-output-ext: "dmg"
- runs-on: windows-latest
fasmg: /fasmg.exe
ez80-bins-suffix: windows
env: "env:"
exe: .exe
nul: nul
ldflags: LDFLAGS="-static-libgcc -static-libstdc++ -static"
install-output-ext: "zip"
- runs-on: ubuntu-20.04
ez80-bins-suffix: ubuntu
fasmg: /fasmg.x64
install-output-ext: "tar.gz"
runs-on: ${{matrix.runs-on}}
steps:
- name: Prepare Build Environment
run: cmake -E echo >> $${{matrix.env}}GITHUB_PATH ${{env.CEDEV_BIN}}
- name: Download ez80-clang and ez80-link
id: ez80-bins
uses: carlosperate/[email protected]
with:
file-url: https://github.com/CE-Programming/llvm-project/releases/download/nightly/ez80-clang-link_${{matrix.ez80-bins-suffix}}_nightly.zip
- name: Extract ez80-clang
uses: DuckSoft/[email protected]
with:
pathSource: ${{steps.ez80-bins.outputs.file-path}}
pathTarget: ${{env.CEDEV_BIN}}
- name: Add fasmg website to /etc/hosts since DNS seems to be broken
if: runner.os == 'macOS'
run: |
sudo echo "208.99.203.253 flatassembler.net" | sudo tee -a /etc/hosts
- name: Download Fasmg Download Page
id: fasmg-download
uses: carlosperate/[email protected]
with:
file-url: ${{env.FASMG_DOMAIN}}/download.php
- name: Parse Fasmg Download Page
id: fasmg-url
uses: QwerMike/xpath-action@v1
with:
filename: ${{steps.fasmg-download.outputs.file-path}}
expression: //a[starts-with(text(),"flat assembler g ")]/@href
- name: Extract Fasmg Url
run: cmake -E echo >> $${{matrix.env}}GITHUB_ENV ${{steps.fasmg-url.outputs.result}}
- name: Download Fasmg
id: fasmg
uses: carlosperate/[email protected]
with:
file-url: ${{env.FASMG_DOMAIN}}/${{env.href}}
- name: Extract Fasmg
uses: DuckSoft/[email protected]
with:
pathSource: ${{steps.fasmg.outputs.file-path}}
pathTarget: ${{env.FASMG_PATH}}
- name: Setup Fasmg
run: cmake -E copy fasmg${{matrix.fasmg}} ${{env.CEDEV_BIN}}/fasmg${{matrix.exe}}
- name: Checkout CEmu
uses: actions/checkout@v4
with:
repository: ${{github.repository_owner}}/CEmu
ref: latest-stable
path: ${{env.CEMU_PATH}}
persist-credentials: false
- name: Build CEmu
run: make -j4 -C ${{env.CEMU_PATH}}/core
- name: Build Autotester CLI
run: make -j4 -C ${{env.CEMU_PATH}}/tests/autotester ${{matrix.ldflags}}
- name: Install Autotester CLI
run: cmake -E copy ${{env.CEMU_PATH}}/tests/autotester/autotester${{matrix.exe}} ${{env.CEDEV_BIN}}/cemu-autotester${{matrix.exe}}
- name: Make Binaries Executable
if: runner.os != 'Windows'
run: chmod +x ${{env.CEDEV_BIN}}/*
- name: Test Build Dependencies
run: |
ez80-clang --version
ez80-link --version
fasmg ${{matrix.nul}} ${{matrix.nul}}
- name: Checkout Toolchain
uses: actions/checkout@v4
with:
path: ${{env.TOOLCHAIN_PATH}}
submodules: recursive
persist-credentials: false
- name: Build Toolchain
run: make -j4 -C ${{env.TOOLCHAIN_PATH}} V=1
- name: Build Libraries
run: |
make -j4 -C ${{env.TOOLCHAIN_PATH}} libs V=1
make -j4 -C ${{env.TOOLCHAIN_PATH}} libs-zip V=1
- name: Install Toolchain
env:
PREFIX: ${{github.workspace}}
run: make -j4 -C ${{env.TOOLCHAIN_PATH}} install V=1 DESTDIR=${{github.workspace}}
- name: Make Binaries Executable
if: runner.os != 'Windows'
run: chmod +x ${{env.CEDEV_BIN}}/*
- name: "[macOS] CodeSign Toolchain binaries"
if: runner.os == 'macOS' && github.repository == 'CE-Programming/toolchain' # don't run on forks, since they don't have secrets
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }}
MACOS_CODESIGN_IDENT: ${{ secrets.MACOS_CODESIGN_IDENT }}
run: |
echo $MACOS_CERTIFICATE | base64 -d > certificate.p12
security create-keychain -p $MACOS_KEYCHAIN_PWD build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p $MACOS_KEYCHAIN_PWD build.keychain
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_KEYCHAIN_PWD build.keychain
/usr/bin/codesign --deep --force --verify --verbose --sign "$MACOS_CODESIGN_IDENT" --timestamp --options runtime $CEDEV_BIN/*
- name: "[macOS] Create the DMG"
if: runner.os == 'macOS'
run: |
brew install create-dmg || brew install create-dmg; # we try twice because sometimes it fails...
echo killing XProtect...; sudo pkill -9 XProtect >/dev/null || true;
echo waiting...; while pgrep XProtect; do sleep 3; done;
cp -a "${CEDEV}" "${TOOLCHAIN_PATH}/resources/macOS/dmg/contents/";
# The codesign variable may be empty (for forks) but that's fine, create-dmg only does code-signing if it's not empty.
createDmgArgs="--codesign '${{ secrets.MACOS_CODESIGN_IDENT }}' \
--volname 'CE Programming Toolchain' \
--volicon '${TOOLCHAIN_PATH}/resources/macOS/dmg/icon.icns' \
--background '${TOOLCHAIN_PATH}/resources/macOS/dmg/background.png' \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 64 \
--icon 'Readme.txt' 125 120 \
--icon 'CEdev' 125 275 \
'CEdev-${{runner.os}}${{matrix.arch-suffix}}.${{matrix.install-output-ext}}' \
'${TOOLCHAIN_PATH}/resources/macOS/dmg/contents'"
eval "create-dmg $createDmgArgs" || eval "create-dmg $createDmgArgs" # We also retry just in case...
- name: "[macOS] Notarize and staple DMG"
if: runner.os == 'macOS' && github.repository == 'CE-Programming/toolchain' # don't run on forks, since they don't have secrets
env:
APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
APPLE_NOTARIZATION_TEAMID: ${{ secrets.APPLE_NOTARIZATION_TEAMID }}
run: |
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$APPLE_NOTARIZATION_USERNAME" --team-id "$APPLE_NOTARIZATION_TEAMID" --password "$APPLE_NOTARIZATION_PASSWORD"
xcrun notarytool submit "CEdev-${{runner.os}}${{matrix.arch-suffix}}.${{matrix.install-output-ext}}" --keychain-profile "notarytool-profile" --wait
xcrun stapler staple "CEdev-${{runner.os}}${{matrix.arch-suffix}}.${{matrix.install-output-ext}}"
- name: "[Linux] Tar toolchain"
if: runner.os == 'Linux'
run: |
tar -C ${{env.CEDEV}}/.. -czvf CEdev-${{runner.os}}.${{matrix.install-output-ext}} CEdev
- name: "[Windows] Zip toolchain"
if: runner.os == 'Windows'
run: |
cd ${{env.CEDEV}}/.. && 7z a -tzip CEdev-${{runner.os}}.${{matrix.install-output-ext}} CEdev
- name: Upload CEdev
uses: actions/upload-artifact@v4
with:
name: CEdev-${{runner.os}}${{matrix.arch-suffix}}
path: CEdev-${{runner.os}}${{matrix.arch-suffix}}.${{matrix.install-output-ext}}
- name: Create Libraries Zip
if: runner.os == 'Linux'
run: cd ${{env.TOOLCHAIN_PATH}} && zip -r9 clibs_separately_in_zip.zip clibs/
- name: Upload Libraries
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: clibs
path: ${{env.AUTOTESTER_LIBS_GROUP}}
- name: Upload Libraries Zip
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: clibs_separately_in_zip
path: ${{github.workspace}}/toolchain/clibs_separately_in_zip.zip
test:
needs: build
environment: Autotester
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, macos-13, macos-14, windows-latest]
compressed: [YES, NO]
include:
- runs-on: macos-13
arch-suffix: "-intel"
- runs-on: macos-14
arch-suffix: "-arm"
- runs-on: windows-latest
env: "env:"
runs-on: ${{matrix.runs-on}}
steps:
- name: Prepare Test Environment
run: cmake -E echo >> $${{matrix.env}}GITHUB_PATH ${{env.CEDEV_BIN}}
- name: Download CEdev
uses: actions/download-artifact@v4
with:
name: CEdev-${{runner.os}}${{matrix.arch-suffix}}
path: ${{github.workspace}}
- name: Extract Artifact Contents
if: runner.os == 'Linux'
run: tar -xvf CEdev-${{runner.os}}.tar.gz
- name: Extract Artifact Contents
if: runner.os == 'macOS'
run: |
hdiutil attach CEdev-${{runner.os}}${{matrix.arch-suffix}}.dmg
cp -a "/Volumes/CE Programming Toolchain/CEdev" ./
umount "/Volumes/CE Programming Toolchain"
- name: Extract Artifact Contents
if: runner.os == 'Windows'
run: |
cd ${{github.workspace}} && 7z x CEdev-${{runner.os}}.zip
# checkout only for test files -- contents should not be used otherwise.
- name: Checkout Toolchain
uses: actions/checkout@v4
with:
path: ${{env.TOOLCHAIN_PATH}}
persist-credentials: false
- name: Build Test Graphics
run: make -j4 -C ${{env.CEDEV_TEST}} COMPRESSED=${{matrix.compressed}} V=1 gfx
- name: Build Tests
run: make -j4 -C ${{env.CEDEV_TEST}} COMPRESSED=${{matrix.compressed}} V=1
- name: Build Example Graphics
run: make -j4 -C ${{env.CEDEV_EXAMPLES}} COMPRESSED=${{matrix.compressed}} V=1 gfx
- name: Build Examples
run: make -j4 -C ${{env.CEDEV_EXAMPLES}} COMPRESSED=${{matrix.compressed}} V=1
- name: Download CI test secrets
uses: actions/checkout@v4
with:
repository: "CE-Programming/ci-test-secrets"
token: ${{ secrets.GH_PAT_CI_SECRETS }}
path: "secrets"
- name: Download Libraries
uses: actions/download-artifact@v4
with:
name: clibs
path: ${{env.TOOLCHAIN_PATH}}
- name: Test Examples
if: runner.os != 'Windows'
run: |
find ${{env.CEDEV_EXAMPLES}} -name autotest.json -print0 | {
failed=0
while read -d '' test; do
make -C $(dirname $test) test || cmake -E true $((failed += $?))
done
cmake -E echo "$failed tests failed"
exit $failed
}
- name: Test Examples
if: runner.os == 'Windows'
run: |
$failed = 0
foreach ($test in get-childitem "${{env.CEDEV_EXAMPLES}}" -recurse -include autotest.json) {
make -C (split-path -path $test) test
$failed += $lastexitcode
}
cmake -E echo "$failed tests failed"
exit $failed
- name: Test Tests
if: runner.os != 'Windows'
run: |
find ${{env.CEDEV_TEST}} -name autotest.json -print0 | {
failed=0
while read -d '' test; do
make -C $(dirname $test) test || cmake -E true $((failed += $?))
done
cmake -E echo "$failed tests failed"
exit $failed
}
- name: Test Tests
if: runner.os == 'Windows'
run: |
$failed = 0
foreach ($test in get-childitem "${{env.CEDEV_TEST}}" -recurse -include autotest.json) {
make -C (split-path -path $test) test
$failed += $lastexitcode
}
cmake -E echo "$failed tests failed"
exit $failed
- name: Remove Secrets
if: always()
run: cmake -E rm -rf ${{env.SECRETS_PATH}}
- name: "[Linux] Zip built examples"
if: runner.os == 'Linux' && matrix.compressed == 'YES'
run: zip -r ${{env.CEDEV}}/built-examples.zip ${{env.CEDEV_EXAMPLES}}
- name: "[Linux] Upload built examples"
if: runner.os == 'Linux' && matrix.compressed == 'YES'
uses: actions/upload-artifact@v4
with:
name: built-examples
path: ${{env.CEDEV}}/built-examples.zip
docs:
runs-on: ubuntu-latest
steps:
- name: Install Documentation Dependencies
run: |
sudo apt-get install -y doxygen
cmake -E echo >> $${{matrix.env}}GITHUB_PATH $${{matrix.env}}HOME/.local/bin
- name: Checkout Toolchain
uses: actions/checkout@v4
with:
path: ${{env.TOOLCHAIN_PATH}}
persist-credentials: false
fetch-depth: 0
- name: Install Sphinx Dependencies
run: pip install -r ${{env.TOOLCHAIN_PATH}}/docs/requirements.txt
- name: Build Website Documentation
run: make -C ${{env.TOOLCHAIN_PATH}} docs
- name: Disable Jekyll
run: touch ${{env.TOOLCHAIN_PATH}}/docs/build/html/.nojekyll
- name: Remove .pickle files
run: find ${{env.TOOLCHAIN_PATH}}/docs/build/ -name '*.pickle' -delete
- name: Upload Website Documentation
if: github.ref == 'refs/heads/master'
run: |
git config --global user.name 'gh-pages'
git config --global user.email '<>'
cd ${{env.TOOLCHAIN_PATH}}/docs/build/html
git init
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git checkout -b gh-pages
git add .
git commit -m "build documentation"
git fetch origin gh-pages
git diff --quiet origin/gh-pages gh-pages || git push -f origin gh-pages
nightly:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
steps:
- name: Download CEdev Linux
uses: actions/download-artifact@v4
with:
name: CEdev-Linux
path: ${{github.workspace}}
- name: Download CEdev Windows
uses: actions/download-artifact@v4
with:
name: CEdev-Windows
path: ${{github.workspace}}
- name: Download CEdev macOS-intel
uses: actions/download-artifact@v4
with:
name: CEdev-macOS-intel
path: ${{github.workspace}}
- name: Download CEdev macOS-arm
uses: actions/download-artifact@v4
with:
name: CEdev-macOS-arm
path: ${{github.workspace}}
- name: Download CE Libraries
uses: actions/download-artifact@v4
with:
name: clibs
path: ${{github.workspace}}
- name: Download Libraries Zip
uses: actions/download-artifact@v4
with:
name: clibs_separately_in_zip
path: ${{github.workspace}}
- name: Download Built examples
uses: actions/download-artifact@v4
with:
name: built-examples
path: ${{github.workspace}}
- name: Rename Artifacts
run: |
mv CEdev-Linux.tar.gz CEdev-Linux-nightly.tar.gz
mv CEdev-Windows.zip CEdev-Windows-nightly.zip
mv CEdev-macOS-intel.dmg CEdev-macOS-intel-nightly.dmg
mv CEdev-macOS-arm.dmg CEdev-macOS-arm-nightly.dmg
mv built-examples.zip built-examples-nightly.zip
- name: Update nightly release
uses: pyTooling/Actions/releaser@main
with:
tag: nightly
rm: true
token: ${{secrets.GITHUB_TOKEN}}
files: |
CEdev-Linux-nightly.tar.gz
CEdev-Windows-nightly.zip
CEdev-macOS-intel-nightly.dmg
CEdev-macOS-arm-nightly.dmg
clibs.8xg
clibs_separately_in_zip.zip
built-examples-nightly.zip
- name: Dispatch libraries repo
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.CI_PAT_CLIBS_NIGHTLTY }}
repository: CE-Programming/libraries
event-type: ci-clibs-nightly