forked from mstan/MetroidPrimeHuntersRecomp
-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (162 loc) · 6.89 KB
/
Copy pathbuild-linux.yml
File metadata and controls
179 lines (162 loc) · 6.89 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
name: Build Linux
on:
workflow_call:
workflow_dispatch:
permissions:
contents: read
jobs:
linux:
name: Linux ROM-free build
runs-on: ubuntu-24.04
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 750M
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
steps:
- name: Check out title sources
uses: actions/checkout@v4
- name: Install build dependencies
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake ninja-build git curl ca-certificates ccache \
libsdl2-dev libgl1-mesa-dev libx11-dev libxext-dev libxrandr-dev \
libxcursor-dev libxi-dev libxinerama-dev libwayland-dev
- name: Restore compiler cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.ccache
key: >-
mph-linux-x86_64-ccache-v1-${{ hashFiles(
'ndsrecomp.pin',
'config/mph_rom_profiles.json',
'tools/patch_ndsrecomp_mph_runtime.py',
'tools/patch_ndsrecomp_rom_free_release.py'
) }}
restore-keys: |
mph-linux-x86_64-ccache-v1-
- name: Configure compiler cache
run: |
set -euo pipefail
ccache --version
ccache --set-config=max_size="$CCACHE_MAXSIZE"
ccache --zero-stats
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Fetch pinned ndsrecomp
run: |
set -euo pipefail
nds_pin="$(tr -d '\r\n' < ndsrecomp.pin)"
git clone --filter=blob:none https://github.com/mstan/ndsrecomp.git ../ndsrecomp
git -C ../ndsrecomp checkout --detach "$nds_pin"
git -C ../ndsrecomp submodule update --init --recursive
test "$(git -C ../ndsrecomp rev-parse HEAD)" = "$nds_pin"
- name: Apply MPH and ROM-free runner integration
run: |
set -euo pipefail
python tools/patch_ndsrecomp_mph_runtime.py \
--framework-root ../ndsrecomp \
--profiles config/mph_rom_profiles.json
python tools/patch_ndsrecomp_rom_free_release.py \
--framework-root ../ndsrecomp
python tools/patch_ndsrecomp_mph_runtime.py \
--framework-root ../ndsrecomp \
--profiles config/mph_rom_profiles.json
python tools/patch_ndsrecomp_rom_free_release.py \
--framework-root ../ndsrecomp
- name: Generate redistributable FreeBIOS banks
run: |
set -euo pipefail
python tools/ci/prepare_freebios_banks.py \
--framework-root ../ndsrecomp \
--build-dir ../ndsrecomp/build-freebios-recompiler
test ! -e ../ndsrecomp/generated/arm9_bios.c
test ! -e ../ndsrecomp/generated/arm7_bios.c
- name: Build ROM-free runner
run: |
set -euo pipefail
cmake -S ../ndsrecomp/runner -B ../ndsrecomp/runner/build-mph-nightly \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DNDS_BOOTSTRAP_FIRMWARE=ON \
-DNDS_RETAIL_BIOS_BANKS=OFF \
-DNDS_ENABLE_COMPUTE_RENDERER=ON
cmake --build ../ndsrecomp/runner/build-mph-nightly
test -x ../ndsrecomp/runner/build-mph-nightly/nds_runner
if grep -a -E -q 'g_dispatch_mph_arm(9|7)|mph_arm9_fmv_runtime' \
../ndsrecomp/runner/build-mph-nightly/nds_runner; then
echo 'ROM-derived MPH title bank leaked into ROM-free runner' >&2
exit 1
fi
- name: Smoke-test generic frontend config
run: |
set -euo pipefail
mkdir -p /tmp/mph-generic-config-smoke
set +e
output="$(../ndsrecomp/runner/build-mph-nightly/nds_runner \
/tmp/mph-generic-config-smoke \
--rom /tmp/mph-generic-config-smoke/missing.nds \
--config "$PWD/game.toml" \
--freebios --generated-firmware --boot direct 2>&1)"
status=$?
set -e
printf '%s\n' "$output"
test "$status" -ne 0
if grep -q 'invalid frontend config' <<<"$output"; then
echo 'Generic game.toml was rejected by the runner frontend parser' >&2
exit 1
fi
grep -q 'cartridge image is missing or truncated' <<<"$output"
grep -q 'MPH_MULTIROM_RUNTIME_ADAPTIVE_CAPABILITY' \
../ndsrecomp/runner/src/main.cpp
- name: Install pinned AppImage packaging tools
run: |
set -euo pipefail
mkdir -p .ci-tools
curl -fL --retry 3 \
https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-x86_64.AppImage \
-o .ci-tools/appimagetool
echo 'ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0 .ci-tools/appimagetool' | sha256sum -c -
curl -fL --retry 3 \
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \
-o .ci-tools/linuxdeploy
echo '421ca71d5c69ea97c6309276232990d43df1dcece0edfaa26bbf926ff96ed12e .ci-tools/linuxdeploy' | sha256sum -c -
chmod +x .ci-tools/appimagetool .ci-tools/linuxdeploy
- name: Package Linux Nightly payload
run: |
set -euo pipefail
version="$(sed -n 's/^project(MetroidPrimeHuntersRecomp VERSION \([0-9.]*\).*/\1/p' CMakeLists.txt)"
test -n "$version"
bash tools/package-linux-appimage.sh \
--version "$version" \
--runner ../ndsrecomp/runner/build-mph-nightly/nds_runner \
--appimage-tool "$PWD/.ci-tools/appimagetool" \
--linuxdeploy "$PWD/.ci-tools/linuxdeploy"
image="release-stage/MetroidPrimeHuntersRecomp-linux-v${version}-x86_64.AppImage"
test -s "$image"
mkdir -p /tmp/mph-appimage-audit
(cd /tmp/mph-appimage-audit && "$GITHUB_WORKSPACE/$image" --appimage-extract >/dev/null)
if find /tmp/mph-appimage-audit/squashfs-root -type f \( \
-iname '*.nds' -o -iname '*.sav' -o -iname '*.dsv' -o \
-iname 'biosnds9.rom' -o -iname 'biosnds7.rom' -o -iname 'firmware.bin' \
\) -print -quit | grep -q .; then
echo 'Forbidden ROM/save/BIOS/firmware material found inside AppImage' >&2
exit 1
fi
- name: Show compiler cache stats
if: always()
run: |
if command -v ccache >/dev/null 2>&1; then
ccache --show-stats || true
fi
- name: Upload Linux Nightly payload
uses: actions/upload-artifact@v4
with:
name: mph-nightly-linux
path: release-stage/MetroidPrimeHuntersRecomp-linux-v*-x86_64.AppImage
if-no-files-found: error
retention-days: 14