-
Notifications
You must be signed in to change notification settings - Fork 49
474 lines (419 loc) · 14.2 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
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
462
463
464
465
466
467
468
469
470
471
472
473
474
name: CI
on:
push:
branches: [master, dev, development, feature/**, bugfix/**, pr/**]
tags:
- 20[0-9][0-9][0-1][0-9][0-3][0-9]
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
prepare:
name: General preparations
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Retrieve tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Get version, tag and pull request info
id: vars
run: |
tag=""
pull="no"
if [[ "${{ github.ref }}" == refs/heads/* ]]; then
# branch build, check if tag exists
tag="$(git tag --points-at HEAD)"
oj_version="$(git rev-parse --short "$GITHUB_SHA")"
elif [[ "${{ github.ref }}" == refs/pull/* ]]; then
# pull request
pull="yes"
oj_version="pull${{ github.event.number }}"
else
# tag
tag="$(git tag --points-at HEAD)"
oj_version="${{ github.ref_name }}"
fi
echo "oj_version=${oj_version}" >> $GITHUB_OUTPUT
echo "tag=${tag}" >> $GITHUB_OUTPUT
echo "pull=${pull}" >> $GITHUB_OUTPUT
- name: Check version, tag and pull request info
run: |
echo "oj_version = ${{ steps.vars.outputs.oj_version }}"
echo "tag = ${{ steps.vars.outputs.tag }}"
echo "pull = ${{ steps.vars.outputs.pull }}"
outputs:
oj_version: ${{ steps.vars.outputs.oj_version }}
tag: ${{ steps.vars.outputs.tag }}
pull: ${{ steps.vars.outputs.pull }}
dist:
name: Distribution archives
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update -yqq
sudo apt-get install -yqq git asciidoctor w3m
- name: Checkout
uses: actions/checkout@v4
- name: Generate Archives
env:
OJ_VERSION: ${{ needs.prepare.outputs.oj_version }}
run: |
builds/ci/adoc2man ${OJ_VERSION} < res/unix/OpenJazz.6.adoc > OpenJazz.6
git archive -o openjazz-${OJ_VERSION}.tar.gz \
--prefix=openjazz-${OJ_VERSION}/res/unix/ --add-file=OpenJazz.6 \
--prefix=openjazz-${OJ_VERSION}/ ${GITHUB_SHA}
git archive -o openjazz-${OJ_VERSION}.zip --prefix=openjazz-${OJ_VERSION}/ ${GITHUB_SHA}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: openjazz-dist
path: openjazz-*.*
linux-gcc:
name: Build (Ubuntu x86_64, GCC, SDL1.2)
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update -yqq
sudo apt-get install -yqq build-essential libsdl1.2-dev
- name: Checkout
uses: actions/checkout@v4
- name: Build OpenJazz (normal)
run: |
export MAKEFLAGS=-j$(nproc)
make
ls -l OpenJazz
linux-clang:
name: Build (Ubuntu 20.04 LTS x86_64, Clang, SDL2)
needs: prepare
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: |
sudo apt-get update -yqq
sudo apt-get install -yqq build-essential cmake ninja-build clang-10 \
libsdl2-dev asciidoctor w3m
- name: Checkout
uses: actions/checkout@v4
- name: Build OpenJazz (slim)
run: |
export CXX=clang++
export CXXFLAGS="-Wall -O2 -g -ffunction-sections -fdata-sections"
export LDFLAGS="-Wl,--gc-sections"
cmake --workflow --preset release
ls -l build-release/OpenJazz
build-release/OpenJazz --version
- name: Prepare artifact
env:
OJ_VERSION: ${{ needs.prepare.outputs.oj_version }}
run: |
mkdir OJ-${OJ_VERSION}
builds/ci/adoc2txt ${OJ_VERSION} < res/unix/OpenJazz.6.adoc > OJ-${OJ_VERSION}/Manual.txt
cp build-release/OpenJazz README.md COPYING licenses.txt OJ-${OJ_VERSION}/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: openjazz-linux-glibc2.31-x86_64
path: OJ-*/
windows-mingw-gcc:
name: Build (Windows x86_64, MinGW, GCC)
needs: prepare
runs-on: windows-2019
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
update: true
install: |
base-devel dos2unix w3m
pacboy: |
toolchain:p cmake:p ninja:p SDL2:p asciidoctor:p
- name: Checkout
uses: actions/checkout@v4
- name: Build OpenJazz
run: |
cmake --workflow --preset release
- name: Prepare artifact
env:
OJ_VERSION: ${{ needs.prepare.outputs.oj_version }}
run: |
cmake --install build-release --prefix $PWD
builds/ci/adoc2html ${OJ_VERSION} < res/unix/OpenJazz.6.adoc > dist/OpenJazzManual.html
builds/ci/docs2dist dist
mv dist OJ-${OJ_VERSION}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: openjazz-windows-mingw-x86_64
path: OJ-*/
web-emscripten:
name: Build (Emscripten)
needs: prepare
runs-on: ubuntu-latest
container: emscripten/emsdk
steps:
- name: Install dependencies
run: |
sudo apt-get update -yqq
sudo apt-get install -yqq build-essential cmake ninja-build \
asciidoctor w3m
- name: Checkout
uses: actions/checkout@v4
- name: Build OpenJazz
run: |
emcmake cmake -B build-web . -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DDATAPATH=/data -DNETWORK=OFF
cmake --build build-web
touch build-web/data.{js,data} # dummy data
ls -l build-web/OpenJazz*
- name: Prepare artifact
env:
OJ_VERSION: ${{ needs.prepare.outputs.oj_version }}
run: |
mkdir OJ-${OJ_VERSION}
builds/ci/adoc2txt ${OJ_VERSION} < res/unix/OpenJazz.6.adoc > OJ-${OJ_VERSION}/Manual.txt
cp build-web/*.{wasm,js,html,data} README.md COPYING licenses.txt OJ-${OJ_VERSION}/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: openjazz-web
path: OJ-*/
nintendo-devkitpro:
strategy:
fail-fast: false
matrix:
settings:
- shortname: 'wii'
image: 'devkitppc:latest'
text: '(Wii, devkitPPC)'
wrapper: '$DEVKITPRO/portlibs/wii/bin/powerpc-eabi-cmake'
- shortname: '3ds'
image: 'devkitarm:latest'
text: '(3DS, devkitARM)'
wrapper: '$DEVKITPRO/portlibs/3ds/bin/arm-none-eabi-cmake'
#- shortname: 'switch'
# image: 'devkita64:latest'
# text: '(Switch, devkitA64)'
# wrapper: '$DEVKITPRO/portlibs/switch/bin/aarch64-none-elf-cmake'
name: Build ${{ matrix.settings.text }}
needs: prepare
runs-on: ubuntu-latest
container: devkitpro/${{ matrix.settings.image }}
steps:
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -yqq ninja-build dos2unix asciidoctor w3m
- name: Checkout
uses: actions/checkout@v4
- name: Build OpenJazz
run: |
${{ matrix.settings.wrapper }} -G Ninja -B build . -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
- name: Prepare artifact
env:
OJ_VERSION: ${{ needs.prepare.outputs.oj_version }}
run: |
cmake --install build --prefix $PWD
builds/ci/adoc2txt ${OJ_VERSION} < res/unix/OpenJazz.6.adoc > OpenJazz/Manual.txt
builds/ci/docs2dist OpenJazz
mv OpenJazz OJ-${OJ_VERSION}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: openjazz-${{ matrix.settings.shortname }}
path: OJ-*/
riscos-gccsdk:
name: Build (RISC OS, GCCSDK 4.7)
needs: prepare
if: false # disabled, no c++14
runs-on: ubuntu-latest
container: riscosdotinfo/riscos-gccsdk-4.7:latest
steps:
- name: Install dependencies
run: |
apt-get update -qq
apt-get install -yqq cmake ninja-build
- name: Prepare GCCSDK autobuilder and build SDL
run: |
cp /usr/bin/false /usr/bin/automake-1.11 # autobuilder wants this, sdl does not need it
cp /usr/bin/false /usr/bin/meson # autobuilder wants this, sdl does not need it
svn co svn://svn.riscos.info/gccsdk/trunk/autobuilder/ autobuilder # todo: maybe use snapshot
mkdir sdl-build
cd sdl-build
../autobuilder/build -v libsdl1.2debian # todo: cache?
- name: Checkout
uses: actions/checkout@v4
- name: Build OpenJazz
run: |
cmake -G Ninja -B build . -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake -DRISCOS=ON
cmake --build build
- name: Prepare artifact
env:
OJ_VERSION: ${{ needs.prepare.outputs.oj_version }}
run: |
cmake --install build --prefix $PWD
cp README.md COPYING licenses.txt !OpenJazz/
mkdir OJ-${OJ_VERSION}
mv !OpenJazz OJ-${OJ_VERSION}/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: openjazz-riscos
path: OJ-*/
psp-pspdev:
name: Build (PSP, pspdev)
needs: prepare
runs-on: ubuntu-latest
container: pspdev/pspdev:latest
steps:
- name: Install dependencies
run: |
apk add git cmake ninja asciidoctor w3m
- name: Checkout
uses: actions/checkout@v4
- name: Build OpenJazz
run: |
cmake --preset=psp-release -DNETWORK=OFF
cmake --build --preset=psp-release
- name: Prepare artifact
env:
OJ_VERSION: ${{ needs.prepare.outputs.oj_version }}
run: |
cmake --install build-psp-release --prefix $PWD
builds/ci/adoc2txt ${OJ_VERSION} < res/unix/OpenJazz.6.adoc > OpenJazz/Manual.txt
builds/ci/docs2dist OpenJazz
mv OpenJazz OJ-${OJ_VERSION}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: openjazz-psp
path: OJ-*/
prerelease:
name: Create Pre-release
needs:
# all
- dist
- linux-clang
- windows-mingw-gcc
- web-emscripten
- nintendo-devkitpro
- riscos-gccsdk
- psp-pspdev
# allow run when some platform jobs failed, but only on master branch in main repo
if: ${{ !cancelled() && github.ref == 'refs/heads/master' && needs.prepare.outputs.tag == '' && github.repository_owner == 'AlisterT' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: repo
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Zip artifacts and inspect directory
run: |
mv openjazz-dist dist
repo/builds/ci/dir2zip openjazz-*
tree -aL 2
- name: Advance tag to recent commit
uses: actions/github-script@v7
with:
script: |
try {
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/continuous"
})
} catch (e) {
console.log("The 'continuous' tag does not exist.", e)
}
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/continuous",
sha: context.sha
})
} catch (e) {
console.log("Unable to create 'continuous' tag.", e)
}
- name: Create CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: continuous
writeToFile: true
excludeTypes: chore,style
includeInvalidCommits: true
- name: Update CHANGELOG to add disclaimer
run: |
echo "" >> CHANGELOG.md
echo "This is an automated development snapshot, for testing only." >> CHANGELOG.md
echo "Using the latest official release might be more stable." >> CHANGELOG.md
- name: Create/Update Pre-release and upload artifacts
id: prerelease
uses: ncipollo/release-action@v1
with:
prerelease: true
tag: continuous
allowUpdates: true
removeArtifacts: true
bodyFile: CHANGELOG.md
generateReleaseNotes: true
artifacts: |
openjazz-*.zip
dist/*.*
- name: Display information about Pre-release
run: |
echo "Created/Updated release with URL: ${{ steps.prerelease.outputs.html_url }}"
release:
name: Create Release
needs:
# all
- dist
- linux-clang
- windows-mingw-gcc
- web-emscripten
- nintendo-devkitpro
- riscos-gccsdk
- psp-pspdev
# allow run when some platform jobs failed, but only for tags in main repo
if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'AlisterT' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: repo
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Zip artifacts and inspect directory
run: |
mv openjazz-dist dist
repo/builds/ci/dir2zip openjazz-*
tree -aL 2
- name: Create Release and upload artifacts
id: release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare.outputs.oj_version }}
files: |
openjazz-*.*
dist/*.*
- name: Display information about release
run: |
echo "Created/Updated release with URL: ${{ steps.release.outputs.url }}"