-
Notifications
You must be signed in to change notification settings - Fork 44
436 lines (388 loc) · 14.6 KB
/
release.yml
File metadata and controls
436 lines (388 loc) · 14.6 KB
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
name: Release
on:
push:
tags: [ 'v*' ]
permissions:
contents: write
jobs:
# ----------------------------------------------------------------
# Native + cross builds (Linux/macOS/Windows/iOS/tvOS/Android/WASM)
# Each job builds with RELEASE_DEBUG_INFO=1 so we keep -g on the
# optimized binary, then extracts split debug symbols and strips the
# shipped binary.
# ----------------------------------------------------------------
build:
strategy:
fail-fast: false
matrix:
config:
# Linux
- platform: linux-x86_64
artifact: virtualjaguar_libretro.so
os: ubuntu-latest
cc: gcc
cxx: g++
- platform: linux-aarch64
artifact: virtualjaguar_libretro.so
os: ubuntu-24.04-arm
cc: gcc
cxx: g++
- platform: linux-i686
artifact: virtualjaguar_libretro.so
os: ubuntu-latest
cc: 'gcc -m32'
cxx: 'g++ -m32'
multilib: true
# macOS
- platform: macos-arm64
artifact: virtualjaguar_libretro.dylib
os: macos-latest
cc: clang
cxx: clang++
- platform: macos-x86_64
artifact: virtualjaguar_libretro.dylib
os: macos-13
cc: clang
cxx: clang++
# Windows
- platform: windows-x86_64
artifact: virtualjaguar_libretro.dll
os: windows-latest
cc: gcc
cxx: g++
shell: 'msys2 {0}'
msystem: 'MINGW64'
msys2_packages: 'mingw-w64-x86_64-gcc make'
- platform: windows-i686
artifact: virtualjaguar_libretro.dll
os: windows-latest
cc: gcc
cxx: g++
shell: 'msys2 {0}'
msystem: 'MINGW32'
msys2_packages: 'mingw-w64-i686-gcc make'
# Emscripten (WebAssembly)
- platform: emscripten-wasm
artifact: virtualjaguar_libretro_emscripten.bc
os: ubuntu-latest
emscripten: true
# Android NDK
- platform: android-arm64-v8a
artifact: libs/arm64-v8a/libretro.so
os: ubuntu-latest
android: true
android_abi: 'arm64-v8a'
- platform: android-armeabi-v7a
artifact: libs/armeabi-v7a/libretro.so
os: ubuntu-latest
android: true
android_abi: 'armeabi-v7a'
- platform: android-x86_64
artifact: libs/x86_64/libretro.so
os: ubuntu-latest
android: true
android_abi: 'x86_64'
- platform: android-x86
artifact: libs/x86/libretro.so
os: ubuntu-latest
android: true
android_abi: 'x86'
# iOS / tvOS
- platform: ios-arm64
artifact: virtualjaguar_libretro_ios.dylib
os: macos-latest
make_platform: 'ios-arm64'
- platform: tvos-arm64
artifact: virtualjaguar_libretro_tvos.dylib
os: macos-latest
make_platform: 'tvos-arm64'
name: build-${{ matrix.config.platform }}
runs-on: ${{ matrix.config.os }}
defaults:
run:
shell: ${{ matrix.config.shell || 'bash' }}
steps:
- uses: actions/checkout@v4
- name: Install multilib
if: matrix.config.multilib
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
- name: Set up MSYS2
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.msystem || 'MINGW64' }}
update: false
install: ${{ matrix.config.msys2_packages || 'mingw-w64-x86_64-gcc make' }}
- name: Set up Emscripten
if: matrix.config.emscripten
uses: mymindstorm/setup-emsdk@v14
- name: Set up Android NDK
if: matrix.config.android
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26d
- name: Build
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.make_platform }}
env:
RELEASE_DEBUG_INFO: '1'
run: make -j4 CC="${{ matrix.config.cc }}" CXX="${{ matrix.config.cxx }}"
- name: Build (platform)
if: matrix.config.make_platform
env:
RELEASE_DEBUG_INFO: '1'
run: make -j4 platform=${{ matrix.config.make_platform }}
- name: Build (Emscripten)
if: matrix.config.emscripten
env:
RELEASE_DEBUG_INFO: '1'
run: emmake make -j4 platform=emscripten
- name: Build (Android NDK)
if: matrix.config.android
env:
RELEASE_DEBUG_INFO: '1'
run: |
${{ steps.setup-ndk.outputs.ndk-path }}/ndk-build \
APP_ABI=${{ matrix.config.android_abi }} -j4
# ----------------------------------------------------------------
# Package: emit
# dist/<core-name> (stripped, shipped binary)
# dist/<core-name>-debug.tar.gz (split debug symbols)
# The shipped binary keeps a debug-link / dSYM reference so a
# debugger can find the symbols when the .tar.gz is extracted
# alongside it.
# ----------------------------------------------------------------
- name: Package (Linux native build)
if: ${{ runner.os == 'Linux' && !matrix.config.emscripten && !matrix.config.android }}
run: |
set -e
mkdir -p dist
SRC="${{ matrix.config.artifact }}"
EXT=$(echo "$SRC" | grep -o '\.[^.]*$')
OUT="virtualjaguar_libretro-${{ matrix.config.platform }}${EXT}"
DBG="${OUT}.debug"
cp "$SRC" "dist/${OUT}"
objcopy --only-keep-debug "dist/${OUT}" "dist/${DBG}"
objcopy --strip-debug --strip-unneeded "dist/${OUT}"
( cd dist && objcopy --add-gnu-debuglink="${DBG}" "${OUT}" )
tar -C dist -czf "dist/virtualjaguar_libretro-${{ matrix.config.platform }}-debug.tar.gz" "${DBG}"
rm "dist/${DBG}"
- name: Package (Android)
if: matrix.config.android
run: |
set -e
mkdir -p dist
SRC="${{ matrix.config.artifact }}"
OUT="virtualjaguar_libretro-${{ matrix.config.platform }}.so"
DBG="${OUT}.debug"
cp "$SRC" "dist/${OUT}"
# NDK ships its own objcopy/strip; use the unprefixed system one
# (the artifact is already linked). llvm-objcopy works on all ABIs.
OBJCOPY="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-objcopy"
if [ ! -x "$OBJCOPY" ]; then OBJCOPY=objcopy; fi
"$OBJCOPY" --only-keep-debug "dist/${OUT}" "dist/${DBG}"
"$OBJCOPY" --strip-debug --strip-unneeded "dist/${OUT}"
( cd dist && "$OBJCOPY" --add-gnu-debuglink="${DBG}" "${OUT}" )
tar -C dist -czf "dist/virtualjaguar_libretro-${{ matrix.config.platform }}-debug.tar.gz" "${DBG}"
rm "dist/${DBG}"
- name: Package (Emscripten)
if: matrix.config.emscripten
run: |
set -e
mkdir -p dist
SRC="${{ matrix.config.artifact }}"
OUT="virtualjaguar_libretro-${{ matrix.config.platform }}.bc"
cp "$SRC" "dist/${OUT}"
# LLVM bitcode keeps debug info inline; ship the .bc twice with
# the second copy gzipped under -debug for symmetry with the
# other platforms.
gzip -c "dist/${OUT}" > "dist/virtualjaguar_libretro-${{ matrix.config.platform }}-debug.tar.gz"
- name: Package (macOS / iOS / tvOS)
if: ${{ runner.os == 'macOS' }}
run: |
set -e
mkdir -p dist
SRC="${{ matrix.config.artifact }}"
EXT=$(echo "$SRC" | grep -o '\.[^.]*$')
OUT="virtualjaguar_libretro-${{ matrix.config.platform }}${EXT}"
cp "$SRC" "dist/${OUT}"
# dsymutil produces a .dSYM bundle next to the binary
dsymutil "dist/${OUT}" -o "dist/${OUT}.dSYM"
# Strip debug info from the shipped binary (-S = local syms,
# -x = remove non-globals); keeps externals so dlsym still works
strip -S -x "dist/${OUT}"
tar -C dist -czf "dist/virtualjaguar_libretro-${{ matrix.config.platform }}-debug.tar.gz" "${OUT}.dSYM"
rm -rf "dist/${OUT}.dSYM"
- name: Package (Windows MSYS2)
if: ${{ runner.os == 'Windows' }}
run: |
set -e
mkdir -p dist
SRC="${{ matrix.config.artifact }}"
OUT="virtualjaguar_libretro-${{ matrix.config.platform }}.dll"
DBG="${OUT}.debug"
cp "$SRC" "dist/${OUT}"
objcopy --only-keep-debug "dist/${OUT}" "dist/${DBG}"
objcopy --strip-debug --strip-unneeded "dist/${OUT}"
( cd dist && objcopy --add-gnu-debuglink="${DBG}" "${OUT}" )
tar -C dist -czf "dist/virtualjaguar_libretro-${{ matrix.config.platform }}-debug.tar.gz" "${DBG}"
rm "dist/${DBG}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: virtualjaguar_libretro-${{ matrix.config.platform }}
path: dist/
if-no-files-found: error
# ----------------------------------------------------------------
# PS Vita (vitasdk) - cross-compiled .a static archive
# ----------------------------------------------------------------
vita-build:
name: build-vita
runs-on: ubuntu-latest
container:
image: vitasdk/vitasdk:latest
steps:
- uses: actions/checkout@v4
- name: Build
env:
RELEASE_DEBUG_INFO: '1'
run: make -j4 platform=vita
- name: Package
run: |
set -e
mkdir -p dist
OUT="virtualjaguar_libretro-vita.a"
cp virtualjaguar_libretro_vita.a "dist/${OUT}"
# Static archive — extract debug info via objcopy on the archive
# itself. arm-vita-eabi-objcopy is in the vitasdk image.
OBJCOPY=arm-vita-eabi-objcopy
"$OBJCOPY" --only-keep-debug "dist/${OUT}" "dist/${OUT}.debug" || cp "dist/${OUT}" "dist/${OUT}.debug"
"$OBJCOPY" --strip-debug "dist/${OUT}" || true
tar -C dist -czf "dist/virtualjaguar_libretro-vita-debug.tar.gz" "${OUT}.debug"
rm "dist/${OUT}.debug"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: virtualjaguar_libretro-vita
path: dist/
if-no-files-found: error
# ----------------------------------------------------------------
# Nintendo Switch (devkitPro libnx) - .a static archive
# ----------------------------------------------------------------
switch-build:
name: build-switch
runs-on: ubuntu-latest
container:
image: devkitpro/devkita64:latest
steps:
- uses: actions/checkout@v4
- name: Build
env:
DEVKITPRO: /opt/devkitpro
RELEASE_DEBUG_INFO: '1'
run: make -j4 platform=libnx
- name: Package
run: |
set -e
mkdir -p dist
OUT="virtualjaguar_libretro-switch.a"
cp virtualjaguar_libretro_libnx.a "dist/${OUT}"
OBJCOPY=/opt/devkitpro/devkitA64/bin/aarch64-none-elf-objcopy
"$OBJCOPY" --only-keep-debug "dist/${OUT}" "dist/${OUT}.debug" || cp "dist/${OUT}" "dist/${OUT}.debug"
"$OBJCOPY" --strip-debug "dist/${OUT}" || true
tar -C dist -czf "dist/virtualjaguar_libretro-switch-debug.tar.gz" "${OUT}.debug"
rm "dist/${OUT}.debug"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: virtualjaguar_libretro-switch
path: dist/
if-no-files-found: error
# ----------------------------------------------------------------
# Release: collect all artifacts, generate SHA256SUMS, build the
# release body from docs/RELEASE_NOTES_v<TAG>.md (with fall-back to
# GitHub auto-generated notes), then create the tagged release.
# ----------------------------------------------------------------
release:
needs: [build, vita-build, switch-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Stage release files
run: |
set -e
mkdir -p release
# Flatten one level: each artifact directory contains the
# binary + matching -debug.tar.gz; copy them all into release/
find artifacts/ -mindepth 2 -type f -exec cp {} release/ \;
# Include the RetroArch core .info file so frontend maintainers
# / users can drop it into RetroArch's info/ dir. The same file
# is what gets PR'd to libretro/libretro-super after the release.
if [ -f dist/info/virtualjaguar_libretro.info ]; then
cp dist/info/virtualjaguar_libretro.info release/
fi
echo "==> Staged release files:"
ls -la release/
- name: Generate SHA256SUMS
run: |
set -e
cd release
# Deterministic ordering, two-space format compatible with
# `sha256sum -c SHA256SUMS.txt` on Linux + Mac (with coreutils).
sha256sum -- * | sort -k 2 > SHA256SUMS.txt
echo "==> SHA256SUMS.txt:"
cat SHA256SUMS.txt
- name: Prepare release body
id: prep_body
run: |
set -e
TAG="${GITHUB_REF_NAME}"
NOTES_FILE="docs/RELEASE_NOTES_${TAG}.md"
BODY_FILE="$RUNNER_TEMP/release_body.md"
if [ -f "$NOTES_FILE" ]; then
echo "==> Using curated release notes: $NOTES_FILE"
cp "$NOTES_FILE" "$BODY_FILE"
# Append a brief artifact list to the body
{
echo
echo "---"
echo
echo "## Artifacts in this release"
echo
echo '```'
find release -mindepth 1 -maxdepth 1 -type f -printf "%f\n" | sort
echo '```'
} >> "$BODY_FILE"
echo "use_notes_file=1" >> "$GITHUB_OUTPUT"
else
echo "==> No curated $NOTES_FILE found; falling back to auto-generated notes"
echo "use_notes_file=0" >> "$GITHUB_OUTPUT"
fi
echo "body_file=$BODY_FILE" >> "$GITHUB_OUTPUT"
- name: Create release (curated notes)
if: steps.prep_body.outputs.use_notes_file == '1'
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${GITHUB_REF_NAME}"
gh release create "${TAG}" \
--title "${TAG}" \
--notes-file "${{ steps.prep_body.outputs.body_file }}" \
release/*
- name: Create release (auto-generated notes)
if: steps.prep_body.outputs.use_notes_file == '0'
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${GITHUB_REF_NAME}"
gh release create "${TAG}" \
--title "${TAG}" \
--generate-notes \
release/*