-
-
Notifications
You must be signed in to change notification settings - Fork 21
278 lines (255 loc) · 10.2 KB
/
build.yaml
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
name: Build (Internal)
on:
workflow_call:
secrets:
TESTFILE_REPO_TOKEN:
required: false
TESTFILE_REPO:
required: false
ARM7_BIOS:
required: false
ARM9_BIOS:
required: false
ARM7_DSI_BIOS:
required: false
ARM9_DSI_BIOS:
required: false
NDS_FIRMWARE:
required: false
DSI_FIRMWARE:
required: false
NDS_ROM:
required: false
GBA_ROM:
required: false
GBA_SRAM:
required: false
DSI_NAND_ARCHIVE:
required: false
DSI_NAND:
required: false
inputs:
cmake-args:
description: Additional arguments to pass to CMake.
type: string
required: false
core-name:
description: The name of the core.
type: string
required: false
default: melondsds_libretro
cores-dir:
description: The directory in which to place the built cores.
type: string
required: false
default: cores
info-dir:
description: The directory in which to place the built info files.
type: string
required: false
default: cores
runs-on:
description: The platform on which the workflow will be run. Passed directly to jobs.<job_id>.runs-on.
type: string
required: true
shell:
description: The shell to use for running commands. Passed directly to jobs.<job_id>.defaults.run.shell.
type: string
required: false
default: bash
build-dir:
description: The directory in which to build the project.
type: string
required: false
default: "build"
dist-dir:
description: The directory in which to place the built artifacts.
type: string
required: false
default: "build/dist"
lib-ext:
description: The extension of the library to build.
type: string
required: true
archive-name:
description: The name of the archive to upload.
type: string
required: true
target:
description: The platform target.
type: string
required: true
test-suite:
description: Whether there will be a test suite based on this run's output
type: boolean
required: false
default: false
env:
BUILD_DIR: "${{ github.workspace }}/${{ inputs.build-dir }}"
DIST_DIR: "${{ github.workspace }}/${{ inputs.dist-dir }}"
TESTFILE_DIR: "${{ github.workspace }}/testfiles"
jobs:
build:
strategy:
matrix:
build-type:
- Debug
- Release
- RelWithDebInfo
runs-on: ${{ inputs.runs-on }}
defaults:
run:
shell: ${{ inputs.shell }}
steps:
- name: Check Out Source
uses: actions/checkout@v4
- name: Install GCC Problem Matcher
uses: root-project/gcc-problem-matcher-improved@f570674bcaf59d17ec0e6ae3ee0d03f8d68c1989
if: ${{ runner.os != 'Windows' }} # See https://github.com/root-project/gcc-problem-matcher-improved/issues/3
with:
build-directory: ${{ env.BUILD_DIR }}
- name: Install MSYS2 Dependencies (Windows)
uses: msys2/setup-msys2@v2
if: ${{ runner.os == 'Windows' }}
with:
msystem: MINGW64
update: true
install: git pkgconf mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
- name: Install Mesa
if: ${{ runner.os == 'Windows' }}
uses: ssciwr/setup-mesa-dist-win@v2
- name: Install Dependencies (macOS)
if: ${{ runner.os == 'macOS' }}
shell: bash
run: brew install pkg-config cmake ninja ccache
# Skip this step on act due to https://github.com/nektos/act/issues/1849
- name: Install Dependencies (Linux x86_64/Android)
if: ${{ !env.ACT && runner.os == 'Linux' && !contains(inputs.target, 'aarch64') }}
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
with:
packages: ccache cmake libepoxy-dev libopengl0 libopengl-dev ninja-build p7zip-full x11-xserver-utils xdg-utils xvfb
version: 1.2
- name: Install Dependencies (Linux x86_64/Android + act)
if: ${{ env.ACT && runner.os == 'Linux' && !contains(inputs.target, 'aarch64') }}
shell: bash
run: sudo apt-get update -qy && sudo apt-get install -qy ccache cmake libepoxy-dev libopengl0 libopengl-dev ninja-build p7zip-full x11-xserver-utils xdg-utils xvfb
- name: Install Cross-Compile Support (Linux aarch64)
if: ${{ runner.os == 'Linux' && contains(inputs.target, 'aarch64') }}
uses: cyberjunk/gha-ubuntu-cross@v4
with:
arch: arm64
- name: Install Dependencies (Linux aarch64)
if: ${{ runner.os == 'Linux' && contains(inputs.target, 'aarch64') }}
shell: bash
run: sudo apt-get update -qy && sudo apt-get install -qy cmake ninja-build libepoxy-dev:arm64 libopengl0:arm64 libopengl-dev:arm64 ccache
- name: Install CCache
uses: hendrikmuhs/ccache-action@v1.2.14
with:
key: ${{ inputs.target }}-${{ matrix.build-type }}
variant: ${{ runner.os == 'Windows' && 'sccache' || 'ccache' }} # Equivalent to (runner.os == 'Windows') ? 'sccache' : 'ccache'
# Using sccache on Windows due to https://github.com/hendrikmuhs/ccache-action/issues/112
- name: Install Python
if: ${{ inputs.test-suite }}
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: "${{ github.workspace }}/test/requirements.txt"
- name: Install Python Dependencies
if: ${{ inputs.test-suite }}
shell: bash
run: |
pip install -v -r "${{ github.workspace }}/test/requirements.txt"
- name: Use Cached Test Files
if: ${{ inputs.test-suite }}
id: cache-test-files
uses: actions/cache@v4
with:
path: "${{ github.workspace }}/testfiles"
key: "testfiles"
- name: Download Test Files
if: ${{ inputs.test-suite && steps.cache-test-files.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
repository: "${{ secrets.TESTFILE_REPO }}"
token: "${{ secrets.TESTFILE_REPO_TOKEN }}"
path: "testfiles"
- name: Prepare Test Files
if: ${{ inputs.test-suite && steps.cache-test-files.outputs.cache-hit != 'true' }}
working-directory: "${{ github.workspace }}/testfiles"
shell: bash
run: 7z x "${{ secrets.DSI_NAND_ARCHIVE }}"
- name: Create Build Directory
run: mkdir -vp "${{ env.BUILD_DIR }}"
- name: Configure
working-directory: "${{ env.BUILD_DIR }}"
if: ${{ ! inputs.test-suite }}
run: |
cmake "${{ github.workspace }}" \
-DCMAKE_BUILD_TYPE="${{ matrix.build-type }}" \
-DTRACY_ENABLE="${{ matrix.build-type == 'RelWithDebInfo' && 'ON' || 'OFF' }}" \
${{ inputs.cmake-args }}
- name: Configure (With Test Suite)
working-directory: "${{ env.BUILD_DIR }}"
if: ${{ inputs.test-suite }}
run: |
cmake "${{ github.workspace }}" \
-DCMAKE_BUILD_TYPE="${{ matrix.build-type }}" \
-DTRACY_ENABLE="${{ matrix.build-type == 'RelWithDebInfo' && 'ON' || 'OFF' }}" \
-DBUILD_TESTING=ON \
-DARM7_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM7_BIOS }}" \
-DARM9_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM9_BIOS }}" \
-DARM7_DSI_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM7_DSI_BIOS }}" \
-DARM9_DSI_BIOS="${{ env.TESTFILE_DIR }}/${{ secrets.ARM9_DSI_BIOS }}" \
-DNDS_FIRMWARE="${{ env.TESTFILE_DIR }}/${{ secrets.NDS_FIRMWARE }}" \
-DDSI_FIRMWARE="${{ env.TESTFILE_DIR }}/${{ secrets.DSI_FIRMWARE }}" \
-DDSI_NAND="${{ env.TESTFILE_DIR }}/${{ secrets.DSI_NAND }}" \
-DNDS_ROM="${{ env.TESTFILE_DIR }}/${{ secrets.NDS_ROM }}" \
-DGBA_ROM="${{ env.TESTFILE_DIR }}/${{ secrets.GBA_ROM }}" \
-DGBA_SRAM="${{ env.TESTFILE_DIR }}/${{ secrets.GBA_SRAM }}" \
-DMELONDSDS_INTERNAL_VENV=OFF \
${{ inputs.cmake-args }}
- name: Build
working-directory: "${{ env.BUILD_DIR }}"
run: cmake --build "${{ env.BUILD_DIR }}" --parallel
- name: Prepare Artifact Directory
env:
CORES_PATH: "${{ env.DIST_DIR }}/${{ inputs.cores-dir }}"
INFO_PATH: "${{ env.DIST_DIR }}/${{ inputs.info-dir }}"
run: |
mkdir -vp "$CORES_PATH" "$INFO_PATH"
cp -f "${{ env.BUILD_DIR }}/src/libretro/${{ inputs.core-name }}.${{ inputs.lib-ext }}" "$CORES_PATH"
cp -f "${{ env.BUILD_DIR }}/melondsds_libretro.info" "$INFO_PATH/${{ inputs.core-name }}.info"
cp -f "${{ env.BUILD_DIR }}/melondsds-LICENSE.txt" "$CORES_PATH"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: "${{ inputs.archive-name }}-${{ matrix.build-type }}"
if-no-files-found: error
path: "${{ env.DIST_DIR }}"
- name: Run Test Suite (macOS)
if: ${{ inputs.test-suite && runner.os == 'macOS' }}
working-directory: "${{ env.BUILD_DIR }}"
env:
PYTHONUNBUFFERED: 1
# Defining TRACY_NO_INVARIANT_CHECK fixes test suite failures on the macos-13 runner;
# this is fine because we're not taking traces on the CI anyway.
TRACY_NO_INVARIANT_CHECK: 1
run: ctest --exclude-regex example --output-on-failure
- name: Run Test Suite (Linux)
if: ${{ inputs.test-suite && runner.os == 'Linux' }}
working-directory: "${{ env.BUILD_DIR }}"
env:
PYTHONUNBUFFERED: 1
run: xvfb-run ctest --exclude-regex example --output-on-failure
- name: Run Test Suite (Windows)
if: ${{ inputs.test-suite && runner.os == 'Windows' }}
working-directory: "${{ env.BUILD_DIR }}"
shell: msys2 {0}
env:
PYTHONUNBUFFERED: 1
MESA_DEBUG: 1
D3D12_DEBUG: verbose,debuglayer,gpuvalidator
GLCONTEXT_WIN_LIBGL: "C:/Windows/System32/opengl32.dll"
run: |
ctest --exclude-regex example --output-on-failure