-
Notifications
You must be signed in to change notification settings - Fork 43
365 lines (313 loc) · 12.2 KB
/
c-cpp.yml
File metadata and controls
365 lines (313 loc) · 12.2 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
name: C/C++ CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
# Linux
- displayTargetName: 'Linux x86_64 (GCC)'
artifact: 'virtualjaguar_libretro.so'
os: ubuntu-latest
cc: 'gcc'
cxx: 'g++'
- displayTargetName: 'Linux x86_64 (Clang)'
artifact: 'virtualjaguar_libretro.so'
os: ubuntu-latest
cc: 'clang'
cxx: 'clang++'
- displayTargetName: 'Linux aarch64'
artifact: 'virtualjaguar_libretro.so'
os: ubuntu-24.04-arm
cc: 'gcc'
cxx: 'g++'
- displayTargetName: 'Linux i686'
artifact: 'virtualjaguar_libretro.so'
os: ubuntu-latest
cc: 'gcc -m32'
cxx: 'g++ -m32'
multilib: true
# macOS
- displayTargetName: 'macOS arm64 (Clang)'
artifact: 'virtualjaguar_libretro.dylib'
os: macos-latest
cc: 'clang'
cxx: 'clang++'
- displayTargetName: 'macOS x86_64 (Clang)'
artifact: 'virtualjaguar_libretro.dylib'
os: macos-13
cc: 'clang'
cxx: 'clang++'
# Windows (MinGW)
- displayTargetName: 'Windows x86_64 (MSYS2)'
artifact: 'virtualjaguar_libretro.dll'
os: windows-latest
cc: 'gcc'
cxx: 'g++'
shell: 'msys2 {0}'
msystem: 'MINGW64'
msys2_packages: 'mingw-w64-x86_64-gcc make'
- displayTargetName: 'Windows i686 (MSYS2)'
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)
- displayTargetName: 'Emscripten (WASM)'
artifact: 'virtualjaguar_libretro_emscripten.bc'
os: ubuntu-latest
emscripten: true
# Android NDK
- displayTargetName: 'Android arm64-v8a'
artifact: 'libs/arm64-v8a/libretro.so'
os: ubuntu-latest
android: true
android_abi: 'arm64-v8a'
- displayTargetName: 'Android armeabi-v7a'
artifact: 'libs/armeabi-v7a/libretro.so'
os: ubuntu-latest
android: true
android_abi: 'armeabi-v7a'
- displayTargetName: 'Android x86_64'
artifact: 'libs/x86_64/libretro.so'
os: ubuntu-latest
android: true
android_abi: 'x86_64'
- displayTargetName: 'Android x86'
artifact: 'libs/x86/libretro.so'
os: ubuntu-latest
android: true
android_abi: 'x86'
# iOS / tvOS
- displayTargetName: 'iOS arm64'
artifact: 'virtualjaguar_libretro_ios.dylib'
os: macos-latest
make_platform: 'ios-arm64'
cross: true
- displayTargetName: 'tvOS arm64'
artifact: 'virtualjaguar_libretro_tvos.dylib'
os: macos-latest
make_platform: 'tvos-arm64'
cross: true
name: build-${{ matrix.config.displayTargetName }}
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 }}
run: make -j4 CC="${{ matrix.config.cc }}" CXX="${{ matrix.config.cxx }}"
- name: Build (platform)
if: matrix.config.make_platform
run: make -j4 platform=${{ matrix.config.make_platform }}
- name: Build (Emscripten)
if: matrix.config.emscripten
run: emmake make -j4 platform=emscripten
- name: Build (Android NDK)
if: matrix.config.android
run: |
${{ steps.setup-ndk.outputs.ndk-path }}/ndk-build \
APP_ABI=${{ matrix.config.android_abi }} -j4
# Host/native toolchains only — skips cross-compile rows (e.g. aarch64 on x86 runner).
- name: Run cheat engine unit tests
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross && runner.os != 'Windows' }}
run: make test CC="${{ matrix.config.cc }}"
- name: Run SIMD blitter tests
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross }}
run: |
ARCH=$(uname -m)
CC="${{ matrix.config.cc }}"
case "$ARCH" in
x86_64|i686|i386) SIMD_SRC=src/tom/blitter_simd_sse2.c; EXTRA="-msse2" ;;
aarch64|arm64) SIMD_SRC=src/tom/blitter_simd_neon.c; EXTRA="" ;;
*) SIMD_SRC=src/tom/blitter_simd_scalar.c; EXTRA="" ;;
esac
echo "==> Testing ${SIMD_SRC}..."
$CC -O2 -Wall ${EXTRA} -I src -I src/core -I src/tom \
-o test_blitter_simd test/test_blitter_simd.c ${SIMD_SRC}
./test_blitter_simd
echo "==> Cross-checking against scalar..."
$CC -O2 -Wall -I src -I src/core -I src/tom \
-o test_blitter_scalar test/test_blitter_simd.c src/tom/blitter_simd_scalar.c
./test_blitter_scalar
echo "==> DSP 40-bit MAC accumulator regression (dsp_acc40.h)..."
$CC -O2 -Wall -I src -I src/jerry -o test_dsp_mac40 test/test_dsp_mac40.c
./test_dsp_mac40
- name: Run memory map test
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross && runner.os != 'Windows' }}
run: |
CC="${{ matrix.config.cc }}"
if [ "$(uname)" = "Linux" ]; then
LDFLAGS="-ldl"
else
LDFLAGS=""
fi
$CC -O2 -Wall -o test/tools/test_memory_map test/tools/test_memory_map.c $LDFLAGS
./test/tools/test_memory_map ./${{ matrix.config.artifact }}
- name: Run DSP instruction set tests
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross && runner.os != 'Windows' }}
run: |
CC="${{ matrix.config.cc }}"
if [ "$(uname)" = "Linux" ]; then LDFLAGS="-ldl"; else LDFLAGS=""; fi
$CC -O2 -Wall -o test/test_dsp_ops test/test_dsp_ops.c $LDFLAGS
$CC -O2 -Wall -o test/test_dsp_unit test/test_dsp_unit.c $LDFLAGS
./test/test_dsp_ops
./test/test_dsp_unit
- name: Run GPU instruction set tests
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross && runner.os != 'Windows' }}
run: |
CC="${{ matrix.config.cc }}"
if [ "$(uname)" = "Linux" ]; then LDFLAGS="-ldl"; else LDFLAGS=""; fi
$CC -O2 -Wall -o test/test_gpu_ops test/test_gpu_ops.c $LDFLAGS
./test/test_gpu_ops
$CC -O2 -Wall -o test/test_op_gpu_object test/test_op_gpu_object.c $LDFLAGS
./test/test_op_gpu_object ./${{ matrix.config.artifact }}
- name: Run 68K instruction set tests
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross && runner.os != 'Windows' }}
run: |
CC="${{ matrix.config.cc }}"
if [ "$(uname)" = "Linux" ]; then LDFLAGS="-ldl"; else LDFLAGS=""; fi
$CC -O2 -Wall -o test/test_m68k_ops test/test_m68k_ops.c $LDFLAGS
./test/test_m68k_ops
- name: Cache pinned rcheevos E2E build
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross && runner.os != 'Windows' }}
uses: actions/cache@v4
with:
path: build/rcheevos-static
key: rcheevos-e2e-fd57e900-${{ runner.os }}-${{ matrix.config.cc }}-${{ matrix.config.displayTargetName }}
- name: RetroAchievements rc_libretro E2E test
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross && runner.os != 'Windows' }}
env:
# Immutable pin (rcheevos v12.3.0); tarball via .../archive/${SHA}.tar.gz
RCHEEVOS_REF: fd57e900758a9e3de343e7b0316b8a6059dce228
CC: ${{ matrix.config.cc }}
run: bash test/tools/test_rcheevos_e2e.sh ./${{ matrix.config.artifact }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.displayTargetName }}
path: ${{ matrix.config.artifact }}
if-no-files-found: error
msvc-check:
name: MSVC ${{ matrix.arch }} compilation check
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch: [x64, x86]
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Compile all sources with cl.exe
shell: cmd
run: |
cl.exe /c /W3 /O2 /DNDEBUG /D_CRT_SECURE_NO_DEPRECATE ^
/I. /Isrc /Isrc\core /Isrc\tom /Isrc\jerry /Isrc\cd /Isrc\bios /Isrc\m68000 /Ilibretro-common\include ^
/D__LIBRETRO__ /DINLINE="_inline" ^
libretro.c ^
src\tom\blitter.c src\tom\blitter_compare.c src\tom\blitter_mmio.c src\jerry\dac.c src\jerry\dsp.c src\core\file.c ^
src\tom\gpu.c src\core\jaguar.c src\jerry\jerry.c src\tom\tom.c src\tom\op.c ^
src\cd\cdintf.c src\cd\cdrom.c src\core\crc32.c src\core\event.c ^
src\jerry\eeprom.c src\core\filedb.c src\jerry\joystick.c src\core\settings.c ^
src\core\memtrack.c src\core\vjag_memory.c src\core\cheat.c ^
src\core\universalhdr.c src\jerry\wavetable.c ^
src\bios\jagbios.c ^
src\bios\jagcdbios.c src\bios\jagdevcdbios.c ^
src\bios\jagstub1bios.c src\bios\jagstub2bios.c ^
src\m68000\m68kinterface.c ^
src\tom\blitter_simd_scalar.c ^
src\tom\blitter_simd_sse2.c
echo MSVC compilation check passed
vita-build:
name: build-PS Vita
runs-on: ubuntu-latest
container:
image: vitasdk/vitasdk:latest
steps:
- uses: actions/checkout@v4
- name: Build
run: make -j4 platform=vita
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PS Vita
path: virtualjaguar_libretro_vita.a
if-no-files-found: error
switch-build:
name: build-Nintendo Switch
runs-on: ubuntu-latest
container:
image: devkitpro/devkita64:latest
steps:
- uses: actions/checkout@v4
- name: Build
run: make -j4 platform=libnx
env:
DEVKITPRO: /opt/devkitpro
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Nintendo Switch
path: virtualjaguar_libretro_libnx.a
if-no-files-found: error
c89-lint:
name: C89 compliance check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for declaration-after-statement
run: |
echo "==> Checking C89 compliance (catches MSVC C89 errors)..."
scripts/c89-lint.sh
- name: Check for stdbool.h usage (use boolean.h instead)
run: |
echo "==> Checking for direct stdbool.h includes..."
FAILED=0
for f in libretro.c $(git ls-files 'src/**/*.c' 'src/**/*.h'); do
case "$f" in
src/core/boolean.h) continue ;;
esac
if grep -n '#include.*<stdbool\.h>' "$f" 2>/dev/null; then
echo "::error file=$f::Use <boolean.h> instead of <stdbool.h> (MSVC 2005/2010 compat)"
FAILED=1
fi
done
if [ "$FAILED" = "1" ]; then
exit 1
fi
echo "==> No direct stdbool.h includes found"