Skip to content

Commit f86579f

Browse files
committed
Fix CI buildbot failures, expand CI coverage, add release automation
Code fixes: - libretro.c: Move extern declarations to top of function blocks for MSVC 2005/2010 C89 compliance (error C2143 mid-block declarations) - blitter_simd_sse2.c: Replace _mm_cvtsi128_si64 with memcpy-based helper — the former only exists on x86_64, breaking 32-bit x86 builds (Linux i686, Windows i686 MinGW). Also fix C89 mid-block declarations. - Makefile.common: Detect cross-compiler prefixes (arm-, aarch64-, mips, powerpc) in CC to skip host uname -m SIMD fallback. Fixes webOS ARM build getting SSE2 when built on an x86_64 host. CI coverage (c-cpp.yml): - Add Windows i686 MinGW (MSYS2 MINGW32) — catches 32-bit x86 issues - Add Linux i686 (gcc -m32 multilib) — catches 32-bit linker errors - Add Android NDK arm64-v8a + armeabi-v7a — catches ARM cross-compile - Add C89 compliance lint job — catches declaration-after-statement errors that break MSVC C89 builds - Add workflow_dispatch for manual trigger via GitHub UI - Parameterize MSYS2 setup (msystem, packages) per matrix entry Release automation: - release.yml: Sync build matrix with c-cpp.yml (10 platform artifacts) - version-bump.yml: New workflow_dispatch to bump version in libretro.c, commit, tag, and push — triggering release.yml automatically Made-with: Cursor
1 parent 065c8b3 commit f86579f

6 files changed

Lines changed: 272 additions & 29 deletions

File tree

.github/workflows/c-cpp.yml

Lines changed: 92 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [ master ]
66
pull_request:
77
branches: [ master ]
8+
workflow_dispatch:
89

910
jobs:
1011
build:
@@ -31,6 +32,13 @@ jobs:
3132
cc: 'gcc'
3233
cxx: 'g++'
3334

35+
- displayTargetName: 'Linux i686'
36+
artifact: 'virtualjaguar_libretro.so'
37+
os: ubuntu-latest
38+
cc: 'gcc -m32'
39+
cxx: 'g++ -m32'
40+
multilib: true
41+
3442
# macOS
3543
- displayTargetName: 'macOS arm64 (Clang)'
3644
artifact: 'virtualjaguar_libretro.dylib'
@@ -45,13 +53,38 @@ jobs:
4553
cc: 'gcc'
4654
cxx: 'g++'
4755
shell: 'msys2 {0}'
56+
msystem: 'MINGW64'
57+
msys2_packages: 'mingw-w64-x86_64-gcc make'
58+
59+
- displayTargetName: 'Windows i686 (MSYS2)'
60+
artifact: 'virtualjaguar_libretro.dll'
61+
os: windows-latest
62+
cc: 'gcc'
63+
cxx: 'g++'
64+
shell: 'msys2 {0}'
65+
msystem: 'MINGW32'
66+
msys2_packages: 'mingw-w64-i686-gcc make'
4867

4968
# Emscripten (WebAssembly)
5069
- displayTargetName: 'Emscripten (WASM)'
5170
artifact: 'virtualjaguar_libretro_emscripten.bc'
5271
os: ubuntu-latest
5372
emscripten: true
5473

74+
# Android NDK (arm64-v8a)
75+
- displayTargetName: 'Android arm64-v8a'
76+
artifact: 'libs/arm64-v8a/libretro.so'
77+
os: ubuntu-latest
78+
android: true
79+
android_abi: 'arm64-v8a'
80+
81+
# Android NDK (armeabi-v7a)
82+
- displayTargetName: 'Android armeabi-v7a'
83+
artifact: 'libs/armeabi-v7a/libretro.so'
84+
os: ubuntu-latest
85+
android: true
86+
android_abi: 'armeabi-v7a'
87+
5588
name: build-${{ matrix.config.displayTargetName }}
5689
runs-on: ${{ matrix.config.os }}
5790

@@ -62,45 +95,65 @@ jobs:
6295
steps:
6396
- uses: actions/checkout@v4
6497

98+
- name: Install multilib
99+
if: matrix.config.multilib
100+
run: |
101+
sudo dpkg --add-architecture i386
102+
sudo apt-get update
103+
sudo apt-get install -y gcc-multilib g++-multilib
104+
65105
- name: Set up MSYS2
66106
if: runner.os == 'Windows'
67107
uses: msys2/setup-msys2@v2
68108
with:
69-
msystem: MINGW64
109+
msystem: ${{ matrix.config.msystem || 'MINGW64' }}
70110
update: false
71-
install: >-
72-
mingw-w64-x86_64-gcc
73-
make
111+
install: ${{ matrix.config.msys2_packages || 'mingw-w64-x86_64-gcc make' }}
74112

75113
- name: Set up Emscripten
76114
if: matrix.config.emscripten
77115
uses: mymindstorm/setup-emsdk@v14
78116

117+
- name: Set up Android NDK
118+
if: matrix.config.android
119+
uses: nttld/setup-ndk@v1
120+
id: setup-ndk
121+
with:
122+
ndk-version: r26d
123+
79124
- name: Build
80-
if: ${{ !matrix.config.emscripten }}
81-
run: make -j4 CC=${{ matrix.config.cc }} CXX=${{ matrix.config.cxx }}
125+
if: ${{ !matrix.config.emscripten && !matrix.config.android }}
126+
run: make -j4 CC="${{ matrix.config.cc }}" CXX="${{ matrix.config.cxx }}"
82127

83128
- name: Build (Emscripten)
84129
if: matrix.config.emscripten
85130
run: emmake make -j4 platform=emscripten
86131

132+
- name: Build (Android NDK)
133+
if: matrix.config.android
134+
run: |
135+
${{ steps.setup-ndk.outputs.ndk-path }}/ndk-build -C jni \
136+
NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=jni/Android.mk \
137+
APP_ABI=${{ matrix.config.android_abi }} -j4
138+
87139
- name: Run SIMD blitter tests
88-
if: ${{ !matrix.config.emscripten }}
140+
if: ${{ !matrix.config.emscripten && !matrix.config.android }}
89141
run: |
90142
ARCH=$(uname -m)
143+
CC="${{ matrix.config.cc }}"
91144
case "$ARCH" in
92145
x86_64|i686|i386) SIMD_SRC=src/blitter_simd_sse2.c; EXTRA="-msse2" ;;
93146
aarch64|arm64) SIMD_SRC=src/blitter_simd_neon.c; EXTRA="" ;;
94147
*) SIMD_SRC=src/blitter_simd_scalar.c; EXTRA="" ;;
95148
esac
96149
97150
echo "==> Testing ${SIMD_SRC}..."
98-
${{ matrix.config.cc }} -O2 -Wall ${EXTRA} -I src \
151+
$CC -O2 -Wall ${EXTRA} -I src \
99152
-o test_blitter_simd test/test_blitter_simd.c ${SIMD_SRC}
100153
./test_blitter_simd
101154
102155
echo "==> Cross-checking against scalar..."
103-
${{ matrix.config.cc }} -O2 -Wall -I src \
156+
$CC -O2 -Wall -I src \
104157
-o test_blitter_scalar test/test_blitter_simd.c src/blitter_simd_scalar.c
105158
./test_blitter_scalar
106159
@@ -110,3 +163,33 @@ jobs:
110163
name: ${{ matrix.config.displayTargetName }}
111164
path: ${{ matrix.config.artifact }}
112165
if-no-files-found: error
166+
167+
c89-lint:
168+
name: C89 compliance check
169+
runs-on: ubuntu-latest
170+
steps:
171+
- uses: actions/checkout@v4
172+
173+
- name: Check for declaration-after-statement
174+
run: |
175+
echo "==> Checking C89 compliance (catches MSVC C89 errors)..."
176+
FAILED=0
177+
for f in libretro.c src/*.c; do
178+
# Skip machine-generated files
179+
case "$f" in
180+
src/m68000/*|src/jag*bios*.c|src/jagstub*bios.c) continue ;;
181+
esac
182+
if ! gcc -fsyntax-only -std=c89 \
183+
-Werror=declaration-after-statement \
184+
-Wno-unknown-pragmas \
185+
-I. -Isrc -Isrc/m68000 -Ilibretro-common/include \
186+
-D__LIBRETRO__ -DINLINE="inline" \
187+
"$f" 2>&1; then
188+
FAILED=1
189+
fi
190+
done
191+
if [ "$FAILED" = "1" ]; then
192+
echo "::error::C89 compliance check failed — mid-block declarations found"
193+
exit 1
194+
fi
195+
echo "==> All files pass C89 declaration check"

.github/workflows/release.yml

Lines changed: 75 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
config:
16+
# Linux
1617
- platform: linux-x86_64
1718
artifact: virtualjaguar_libretro.so
1819
os: ubuntu-latest
@@ -25,18 +26,57 @@ jobs:
2526
cc: gcc
2627
cxx: g++
2728

29+
- platform: linux-i686
30+
artifact: virtualjaguar_libretro.so
31+
os: ubuntu-latest
32+
cc: 'gcc -m32'
33+
cxx: 'g++ -m32'
34+
multilib: true
35+
36+
# macOS
2837
- platform: macos-arm64
2938
artifact: virtualjaguar_libretro.dylib
3039
os: macos-latest
3140
cc: clang
3241
cxx: clang++
3342

43+
# Windows
3444
- platform: windows-x86_64
3545
artifact: virtualjaguar_libretro.dll
3646
os: windows-latest
3747
cc: gcc
3848
cxx: g++
3949
shell: 'msys2 {0}'
50+
msystem: 'MINGW64'
51+
msys2_packages: 'mingw-w64-x86_64-gcc make'
52+
53+
- platform: windows-i686
54+
artifact: virtualjaguar_libretro.dll
55+
os: windows-latest
56+
cc: gcc
57+
cxx: g++
58+
shell: 'msys2 {0}'
59+
msystem: 'MINGW32'
60+
msys2_packages: 'mingw-w64-i686-gcc make'
61+
62+
# Emscripten (WebAssembly)
63+
- platform: emscripten-wasm
64+
artifact: virtualjaguar_libretro_emscripten.bc
65+
os: ubuntu-latest
66+
emscripten: true
67+
68+
# Android NDK
69+
- platform: android-arm64-v8a
70+
artifact: libs/arm64-v8a/libretro.so
71+
os: ubuntu-latest
72+
android: true
73+
android_abi: 'arm64-v8a'
74+
75+
- platform: android-armeabi-v7a
76+
artifact: libs/armeabi-v7a/libretro.so
77+
os: ubuntu-latest
78+
android: true
79+
android_abi: 'armeabi-v7a'
4080

4181
name: build-${{ matrix.config.platform }}
4282
runs-on: ${{ matrix.config.os }}
@@ -48,25 +88,51 @@ jobs:
4888
steps:
4989
- uses: actions/checkout@v4
5090

91+
- name: Install multilib
92+
if: matrix.config.multilib
93+
run: |
94+
sudo dpkg --add-architecture i386
95+
sudo apt-get update
96+
sudo apt-get install -y gcc-multilib g++-multilib
97+
5198
- name: Set up MSYS2
5299
if: runner.os == 'Windows'
53100
uses: msys2/setup-msys2@v2
54101
with:
55-
msystem: MINGW64
102+
msystem: ${{ matrix.config.msystem || 'MINGW64' }}
56103
update: false
57-
install: >-
58-
mingw-w64-x86_64-gcc
59-
make
104+
install: ${{ matrix.config.msys2_packages || 'mingw-w64-x86_64-gcc make' }}
105+
106+
- name: Set up Emscripten
107+
if: matrix.config.emscripten
108+
uses: mymindstorm/setup-emsdk@v14
109+
110+
- name: Set up Android NDK
111+
if: matrix.config.android
112+
uses: nttld/setup-ndk@v1
113+
id: setup-ndk
114+
with:
115+
ndk-version: r26d
60116

61117
- name: Build
62-
run: make -j4 CC=${{ matrix.config.cc }} CXX=${{ matrix.config.cxx }}
118+
if: ${{ !matrix.config.emscripten && !matrix.config.android }}
119+
run: make -j4 CC="${{ matrix.config.cc }}" CXX="${{ matrix.config.cxx }}"
120+
121+
- name: Build (Emscripten)
122+
if: matrix.config.emscripten
123+
run: emmake make -j4 platform=emscripten
124+
125+
- name: Build (Android NDK)
126+
if: matrix.config.android
127+
run: |
128+
${{ steps.setup-ndk.outputs.ndk-path }}/ndk-build -C jni \
129+
NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=jni/Android.mk \
130+
APP_ABI=${{ matrix.config.android_abi }} -j4
63131
64132
- name: Package
65133
run: |
66134
mkdir -p dist
67-
cp ${{ matrix.config.artifact }} dist/virtualjaguar_libretro-${{ matrix.config.platform }}${SUFFIX}
68-
env:
69-
SUFFIX: ${{ matrix.config.platform == 'windows-x86_64' && '.dll' || (matrix.config.platform == 'macos-arm64' && '.dylib' || '.so') }}
135+
cp ${{ matrix.config.artifact }} dist/virtualjaguar_libretro-${{ matrix.config.platform }}$(echo "${{ matrix.config.artifact }}" | grep -o '\.[^.]*$')
70136
71137
- name: Upload artifact
72138
uses: actions/upload-artifact@v4
@@ -91,7 +157,7 @@ jobs:
91157
GH_TOKEN: ${{ github.token }}
92158
run: |
93159
TAG="${GITHUB_REF_NAME}"
94-
# Collect all built binaries
160+
echo "==> Creating release ${TAG} with artifacts:"
95161
find artifacts/ -type f | sort
96162
97163
gh release create "${TAG}" \

.github/workflows/version-bump.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Bump Version & Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bump:
7+
description: 'Version bump type'
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
dry_run:
15+
description: 'Dry run (no commit/tag/push)'
16+
required: false
17+
type: boolean
18+
default: false
19+
20+
permissions:
21+
contents: write
22+
23+
jobs:
24+
bump:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Parse current version
32+
id: current
33+
run: |
34+
VER=$(grep -oP 'library_version\s*=\s*"v\K[0-9]+\.[0-9]+\.[0-9]+' libretro.c)
35+
echo "version=${VER}" >> "$GITHUB_OUTPUT"
36+
echo "Current version: v${VER}"
37+
38+
- name: Compute next version
39+
id: next
40+
run: |
41+
IFS='.' read -r MAJOR MINOR PATCH <<< "${{ steps.current.outputs.version }}"
42+
case "${{ inputs.bump }}" in
43+
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
44+
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
45+
patch) PATCH=$((PATCH + 1)) ;;
46+
esac
47+
NEXT="${MAJOR}.${MINOR}.${PATCH}"
48+
echo "version=${NEXT}" >> "$GITHUB_OUTPUT"
49+
echo "Next version: v${NEXT}"
50+
51+
- name: Update libretro.c
52+
run: |
53+
sed -i 's/library_version = "v${{ steps.current.outputs.version }}"/library_version = "v${{ steps.next.outputs.version }}"/' libretro.c
54+
grep 'library_version' libretro.c
55+
56+
- name: Commit, tag, and push
57+
if: ${{ !inputs.dry_run }}
58+
run: |
59+
git config user.name "github-actions[bot]"
60+
git config user.email "github-actions[bot]@users.noreply.github.com"
61+
git add libretro.c
62+
git commit -m "Bump version to v${{ steps.next.outputs.version }}"
63+
git tag "v${{ steps.next.outputs.version }}"
64+
git push origin HEAD --tags
65+
66+
- name: Summary
67+
run: |
68+
echo "### Version Bump" >> "$GITHUB_STEP_SUMMARY"
69+
echo "" >> "$GITHUB_STEP_SUMMARY"
70+
echo "- **From:** v${{ steps.current.outputs.version }}" >> "$GITHUB_STEP_SUMMARY"
71+
echo "- **To:** v${{ steps.next.outputs.version }}" >> "$GITHUB_STEP_SUMMARY"
72+
echo "- **Bump:** ${{ inputs.bump }}" >> "$GITHUB_STEP_SUMMARY"
73+
echo "- **Dry run:** ${{ inputs.dry_run }}" >> "$GITHUB_STEP_SUMMARY"
74+
if [ "${{ inputs.dry_run }}" = "false" ]; then
75+
echo "" >> "$GITHUB_STEP_SUMMARY"
76+
echo "Tag \`v${{ steps.next.outputs.version }}\` pushed — Release workflow will create the GitHub Release automatically." >> "$GITHUB_STEP_SUMMARY"
77+
fi

0 commit comments

Comments
 (0)