-
-
Notifications
You must be signed in to change notification settings - Fork 60
426 lines (417 loc) · 16.5 KB
/
gearsystem.yml
File metadata and controls
426 lines (417 loc) · 16.5 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
name: Build and Release
on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
- '.github/**'
- '.vscode/**'
- '.devcontainer/**'
pull_request:
schedule:
- cron: '0 0 * * 0'
env:
NAME_LOWER: gearsystem
NAME_UPPER: Gearsystem
jobs:
linux:
name: Linux
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-24.04-arm]
include:
- os: ubuntu-24.04
artifact_name: ubuntu24.04-x64
- os: ubuntu-22.04
artifact_name: ubuntu22.04-x64
- os: ubuntu-24.04-arm
artifact_name: ubuntu24.04-arm64
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Update OS
run: sudo apt-get update -qq
- name: Install dependencies
run: |
sudo apt-get install -y build-essential cmake \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev \
libxi-dev libxss-dev libxkbcommon-dev libwayland-dev libdecor-0-dev \
libdrm-dev libgbm-dev libgl1-mesa-dev libegl1-mesa-dev libdbus-1-dev libudev-dev libxtst-dev
- name: Build and install SDL3
env:
GH_TOKEN: ${{ github.token }}
run: |
SDL3_TAG=$(gh release view --repo libsdl-org/SDL --json tagName -q '.tagName')
echo "Building SDL3 $SDL3_TAG"
git clone --depth 1 --branch "$SDL3_TAG" https://github.com/libsdl-org/SDL.git /tmp/SDL3
cmake -S /tmp/SDL3 -B /tmp/SDL3/build -DCMAKE_INSTALL_PREFIX=/usr -DSDL_TESTS=OFF -DSDL_EXAMPLES=OFF
cmake --build /tmp/SDL3/build -j$(nproc)
sudo cmake --install /tmp/SDL3/build
- name: Get build number
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: make
run: make
working-directory: platforms/linux
- name: Prepare artifact directory
run: |
mkdir -p artifact/mcp
cp platforms/shared/README.txt artifact
cp platforms/shared/gamecontrollerdb.txt artifact
cp platforms/linux/${{ env.NAME_LOWER }} artifact
cp -r platforms/shared/desktop/mcp/resources artifact/mcp/
- name: Archive binary
uses: actions/upload-artifact@v7
with:
name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-desktop-${{ matrix.artifact_name }}
path: artifact/*
linux-clang:
name: Linux (Clang/LLVM)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Update OS
run: sudo apt-get update -qq
- name: Install dependencies
run: |
sudo apt-get install -y build-essential cmake \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev \
libxi-dev libxss-dev libxkbcommon-dev libwayland-dev libdecor-0-dev \
libdrm-dev libgbm-dev libgl1-mesa-dev libegl1-mesa-dev libdbus-1-dev libudev-dev libxtst-dev
- name: Build and install SDL3
env:
GH_TOKEN: ${{ github.token }}
run: |
SDL3_TAG=$(gh release view --repo libsdl-org/SDL --json tagName -q '.tagName')
echo "Building SDL3 $SDL3_TAG"
git clone --depth 1 --branch "$SDL3_TAG" https://github.com/libsdl-org/SDL.git /tmp/SDL3
cmake -S /tmp/SDL3 -B /tmp/SDL3/build -DCMAKE_INSTALL_PREFIX=/usr -DSDL_TESTS=OFF -DSDL_EXAMPLES=OFF
cmake --build /tmp/SDL3/build -j$(nproc)
sudo cmake --install /tmp/SDL3/build
- name: Get build number
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: make
run: make
working-directory: platforms/linux
env:
USE_CLANG: 1
libretro:
name: Libretro (ubuntu)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get build number
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: make
run: make
working-directory: platforms/libretro
- name: Archive binary
uses: actions/upload-artifact@v7
with:
name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-libretro-linux-x64
path: platforms/libretro/${{ env.NAME_LOWER }}_libretro.so
macos:
name: macOS
strategy:
matrix:
os: [macos-15, macos-15-intel]
include:
- os: macos-15-intel
architecture: intel
- os: macos-15
architecture: arm
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install dependencies
run: brew install sdl3
- name: Get build number
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: make
run: make dist
working-directory: platforms/macos
- name: Codesign app bundle
if: github.event_name != 'pull_request' && github.repository_owner == 'drhelius'
env:
MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_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_CI_KEYCHAIN_PWD" build.keychain
codesign -v -f -o runtime --sign "$MACOS_CERTIFICATE_NAME" ${{ env.NAME_UPPER }}.app/Contents/Frameworks/libSDL3.0.dylib
codesign -v -f -o runtime --entitlements "app.entitlements" --sign "$MACOS_CERTIFICATE_NAME" ${{ env.NAME_UPPER }}.app/Contents/MacOS/${{ env.NAME_LOWER }}
codesign -v -f -o runtime --sign "$MACOS_CERTIFICATE_NAME" ${{ env.NAME_UPPER }}.app
codesign -v -vvv --deep "${{ env.NAME_UPPER }}.app"
working-directory: platforms/macos
- name: Notarize app bundle
if: github.event_name != 'pull_request' && github.repository_owner == 'drhelius'
env:
PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
run: |
xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD"
ditto -c -k --keepParent "${{ env.NAME_UPPER }}.app" "notarization.zip"
xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait
xcrun stapler staple "${{ env.NAME_UPPER }}.app"
spctl -a -vvv -t install "${{ env.NAME_UPPER }}.app"
working-directory: platforms/macos
- name: Prepare artifact directory
run: |
mkdir -p artifact
cp platforms/shared/README.txt artifact/
ditto -c -k --keepParent "platforms/macos/${{ env.NAME_UPPER }}.app" "platforms/macos/${{ env.NAME_UPPER }}.app.zip"
mv platforms/macos/${{ env.NAME_UPPER }}.app.zip artifact/
- name: Archive binary
uses: actions/upload-artifact@v7
with:
name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-desktop-macos-${{ matrix.architecture == 'arm' && 'arm64' || 'intel' }}
path: artifact/*
windows:
name: Windows
strategy:
matrix:
architecture: [x64, arm64]
runs-on: windows-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup msbuild
uses: microsoft/setup-msbuild@v3
- name: Download SDL3 development libraries
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
SDL3_TAG=$(gh release view --repo libsdl-org/SDL --json tagName -q '.tagName')
SDL3_VERSION=${SDL3_TAG#release-}
echo "Downloading SDL3 $SDL3_VERSION"
curl -sL "https://github.com/libsdl-org/SDL/releases/download/${SDL3_TAG}/SDL3-devel-${SDL3_VERSION}-VC.zip" -o SDL3-devel.zip
7z x SDL3-devel.zip -oplatforms/windows/dependencies
mv platforms/windows/dependencies/SDL3-${SDL3_VERSION} platforms/windows/dependencies/SDL3
- name: Get build number
shell: bash
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: msbuild
run: msbuild ${{ env.NAME_UPPER }}.sln /t:Clean,Build /p:EmulatorBuild="${{ env.BUILD_NUMBER }}" /p:Configuration=Release /p:Platform=${{ matrix.architecture }}
working-directory: platforms/windows
- name: Prepare artifact directory
run: |
mkdir -p artifact/mcp
cp platforms/shared/README.txt artifact
cp platforms/shared/gamecontrollerdb.txt artifact
cp platforms/windows/dependencies/SDL3/lib/${{ matrix.architecture }}/SDL3.dll artifact
cp platforms/windows/release/${{ env.NAME_UPPER }}.exe artifact
cp -r platforms/shared/desktop/mcp/resources artifact/mcp/
- name: Archive binary
uses: actions/upload-artifact@v7
with:
name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-desktop-windows-${{ matrix.architecture }}
path: artifact/*
bsd:
name: BSD
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get build number
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: Run FreeBSD and gmake
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: pkg install -y git gmake pkgconf sdl3 lang/gcc
run: |
cd platforms/bsd
gmake
- name: Prepare artifact directory
run: |
mkdir -p artifact/mcp
cp platforms/shared/README.txt artifact
cp platforms/shared/gamecontrollerdb.txt artifact
cp platforms/bsd/${{ env.NAME_LOWER }} artifact
cp -r platforms/shared/desktop/mcp/resources artifact/mcp/
- name: Archive binary
uses: actions/upload-artifact@v7
with:
name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-desktop-bsd-x64
path: artifact/*
mcpb:
name: MCPB
needs: [macos, windows, linux]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
variant:
- { platform: darwin, arch: arm64, os: macos-15, architecture: arm }
- { platform: darwin, arch: x64, os: macos-15-intel, architecture: intel }
- { platform: win32, arch: arm64, os: windows-latest, architecture: arm64 }
- { platform: win32, arch: x64, os: windows-latest, architecture: x64 }
- { platform: linux, arch: x64, os: ubuntu-24.04, artifact_name: ubuntu24.04-x64 }
- { platform: linux, arch: arm64, os: ubuntu-24.04-arm, artifact_name: ubuntu24.04-arm64 }
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get build number
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v8
with:
name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-desktop-${{ matrix.variant.platform == 'darwin' && format('macos-{0}', matrix.variant.architecture == 'arm' && 'arm64' || 'intel') || matrix.variant.platform == 'linux' && matrix.variant.artifact_name || format('windows-{0}', matrix.variant.architecture) }}
path: download
- name: Prepare MCPB structure
run: |
mkdir -p mcpb/server
mkdir -p mcpb/mcp/resources
cp platforms/shared/desktop/mcp/icon.png mcpb/icon.png
if [ "${{ matrix.variant.platform }}" = "darwin" ]; then
cd download
unzip -q ${{ env.NAME_UPPER }}.app.zip
cd ..
cp download/${{ env.NAME_UPPER }}.app/Contents/MacOS/${{ env.NAME_LOWER }} mcpb/server/
cp platforms/shared/gamecontrollerdb.txt mcpb/
cp -r platforms/shared/desktop/mcp/resources/* mcpb/mcp/resources/
elif [ "${{ matrix.variant.platform }}" = "win32" ]; then
cp download/${{ env.NAME_UPPER }}.exe mcpb/server/
cp download/SDL3.dll mcpb/server/
cp download/gamecontrollerdb.txt mcpb/
cp -r download/mcp/resources/* mcpb/mcp/resources/
else
cp download/${{ env.NAME_LOWER }} mcpb/server/
cp download/gamecontrollerdb.txt mcpb/
cp -r download/mcp/resources/* mcpb/mcp/resources/
fi
- name: Create manifest.json
run: |
# Determine binary name based on platform
if [ "${{ matrix.variant.platform }}" = "win32" ]; then
BINARY_NAME="${{ env.NAME_UPPER }}.exe"
else
BINARY_NAME="${{ env.NAME_LOWER }}"
fi
# Copy template and replace placeholders
cp platforms/shared/desktop/mcp/manifest.json.template mcpb/manifest.json
sed -i "s/{{NAME_LOWER}}/${{ env.NAME_LOWER }}/g" mcpb/manifest.json
sed -i "s/{{NAME_UPPER}}/${{ env.NAME_UPPER }}/g" mcpb/manifest.json
sed -i "s/{{VERSION}}/${{ env.BUILD_NUMBER }}/g" mcpb/manifest.json
sed -i "s/{{PLATFORM}}/${{ matrix.variant.platform }}/g" mcpb/manifest.json
sed -i "s/{{ARCH}}/${{ matrix.variant.arch }}/g" mcpb/manifest.json
sed -i "s|{{BINARY_NAME}}|$BINARY_NAME|g" mcpb/manifest.json
- name: Create MCPB package
run: |
cd mcpb
# Use friendly names for file naming
PLATFORM_NAME="${{ matrix.variant.platform }}"
if [ "$PLATFORM_NAME" = "darwin" ]; then
PLATFORM_NAME="macos"
elif [ "$PLATFORM_NAME" = "win32" ]; then
PLATFORM_NAME="windows"
fi
zip -r ../${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-mcpb-${PLATFORM_NAME}-${{ matrix.variant.arch }}.mcpb *
- name: Archive MCPB
uses: actions/upload-artifact@v7
with:
name: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-mcpb-${{ matrix.variant.platform == 'darwin' && 'macos' || matrix.variant.platform == 'win32' && 'windows' || matrix.variant.platform }}-${{ matrix.variant.arch }}
path: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-mcpb-${{ matrix.variant.platform == 'darwin' && 'macos' || matrix.variant.platform == 'win32' && 'windows' || matrix.variant.platform }}-${{ matrix.variant.arch }}.mcpb
release:
name: Release
needs: [linux, macos, windows, bsd, mcpb]
if: github.event_name != 'pull_request' && startswith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get build number
run: |
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
- name: Prepare release directory
run: |
mkdir -p release
- name: Download artifacts
uses: actions/download-artifact@v8
with:
pattern: ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-*
path: release
- name: Zip directories (non-MCPB)
run: |
cd release
for f in *; do
if [ -d "$f" ] && [[ ! "$f" =~ mcpb ]]; then
cd $f
echo "Compressing $f"
zip -r $f.zip *
mv $f.zip ../
cd ..
fi
done
- name: Move MCPB packages
run: |
cd release
for f in *-mcpb-*; do
if [ -d "$f" ]; then
mv $f/*.mcpb ./
fi
done
- name: Create release
run: |
gh release create ${{ github.ref_name }} ./release/*.zip ./release/*.mcpb \
--title "${{ env.NAME_UPPER }} ${{ github.ref_name }}" \
--draft \
--generate-notes
env:
GITHUB_TOKEN: ${{ github.TOKEN }}