forked from pcm720/PlayStation2-Basic-BootLoader
-
Notifications
You must be signed in to change notification settings - Fork 0
298 lines (268 loc) · 10.3 KB
/
Copy pathcl.yml
File metadata and controls
298 lines (268 loc) · 10.3 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
name: cl
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
workflow_dispatch:
inputs:
release_name:
description: Release name string for prerelease body
required: true
default: manual
jobs:
matrix:
runs-on: ubuntu-latest
container: ps2dev/ps2dev:latest
outputs:
variants: ${{ steps.variants.outputs.matrix }}
variant_count: ${{ steps.variants.outputs.variant_count }}
steps:
- name: Install dependencies
run: apk add --no-cache build-base git p7zip python3
- uses: actions/checkout@v4
- name: Configure git
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git fetch --prune --unshallow || true
- name: Generate variant matrix
id: variants
run: |
set -euo pipefail
cat <<'PY' | sed 's/^ //' | python3 > matrix.json
import json
# MMCE+MX4SIO is unsupported (embedded IRX conflict); omit any variant with both.
labels = [
"hdd-normal",
"mmce-normal",
"mx4sio-normal",
"usb-normal",
"xfrom-normal",
"hdd-normal+mmce-normal",
"hdd-normal+mx4sio-normal",
"hdd-normal+usb-normal",
"hdd-normal+xfrom-normal",
"mmce-normal+mx4sio-normal",
"mmce-normal+usb-normal",
"mmce-normal+xfrom-normal",
"mx4sio-normal+usb-normal",
"mx4sio-normal+xfrom-normal",
"usb-normal+xfrom-normal",
"hdd-normal+mmce-normal+mx4sio-normal",
"hdd-normal+mmce-normal+usb-normal",
"hdd-normal+mmce-normal+xfrom-normal",
"hdd-normal+mx4sio-normal+usb-normal",
"hdd-normal+mx4sio-normal+xfrom-normal",
"hdd-normal+usb-normal+xfrom-normal",
"mmce-normal+mx4sio-normal+usb-normal",
"mmce-normal+mx4sio-normal+xfrom-normal",
"mmce-normal+usb-normal+xfrom-normal",
"mx4sio-normal+usb-normal+xfrom-normal",
"hdd-normal+mmce-normal+mx4sio-normal+usb-normal",
"hdd-normal+mmce-normal+mx4sio-normal+xfrom-normal",
"hdd-normal+mmce-normal+usb-normal+xfrom-normal",
"hdd-normal+mx4sio-normal+usb-normal+xfrom-normal",
"mmce-normal+mx4sio-normal+usb-normal+xfrom-normal",
"hdd-normal+mmce-normal+mx4sio-normal+usb-normal+xfrom-normal",
]
device_map = {
"hdd": "HDD",
"mmce": "MMCE",
"mx4sio": "MX4SIO",
"usb": "USB",
"xfrom": "XFROM",
}
flag_order = ["HDD", "MMCE", "MX4SIO", "USB", "XFROM"]
variants = []
for label in labels:
if "mmce-normal" in label and "mx4sio-normal" in label:
continue
flags = {}
for part in label.split("+"):
device, mode = part.split("-", 1)
if mode != "normal":
raise SystemExit(f"Unsupported mode in label: {label}")
if device not in device_map:
raise SystemExit(f"Unknown device in label: {label}")
flags[device_map[device]] = 1
flag_string = " ".join(f"{key}=1" for key in flag_order if key in flags)
variants.append({"name": label, "flags": flag_string})
print(json.dumps({"include": variants}, sort_keys=False))
with open("count.txt", "w", encoding="utf-8") as fh:
fh.write(str(len(variants)))
PY
echo "variant_count=$(cat count.txt)" >> "$GITHUB_OUTPUT"
echo "matrix<<EOF" >> "$GITHUB_OUTPUT"
cat matrix.json >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
build:
needs: matrix
runs-on: ubuntu-latest
container: ps2dev/ps2dev:latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.variants) }}
steps:
- name: Install dependencies
run: apk add --no-cache build-base git p7zip python3 nodejs npm
- uses: actions/checkout@v4
- name: Configure git
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git fetch --prune --unshallow || true
- name: Compute metadata
id: meta
run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Build ${{ matrix.name }}
env:
VARIANT_NAME: ${{ matrix.name }}
VARIANT_FLAGS: ${{ matrix.flags }}
SHORT_SHA: ${{ steps.meta.outputs.short_sha }}
run: |
set -euo pipefail
python3 - <<'PY'
import os
import shlex
import subprocess
name = os.environ["VARIANT_NAME"]
flags = os.environ.get("VARIANT_FLAGS", "").strip()
short_sha = os.environ["SHORT_SHA"]
outdir = os.path.join("build", "variants", name)
base = ["make", f"VARIANT={name}", f"OUTDIR={outdir}", f"COMMIT_HASH={short_sha}"]
if flags:
base += shlex.split(flags)
subprocess.run(base + ["clean"], check=True)
subprocess.run(base + ["all"], check=True)
cfg = os.path.join(outdir, "BUILD_CONFIG.txt")
if not os.path.isfile(cfg):
raise SystemExit(f"Missing BUILD_CONFIG.txt for {name}")
PY
- name: Stage built ELF for ${{ matrix.name }}
run: |
set -euo pipefail
mkdir -p staged-elves
variant_dir="build/variants/${{ matrix.name }}"
elf_path="$variant_dir/PS2BBL.ELF"
if [ ! -f "$elf_path" ]; then
echo "Missing ELF for ${{ matrix.name }} at $elf_path" >&2
exit 1
fi
mkdir -p "staged-elves/${{ matrix.name }}"
cp "$elf_path" "staged-elves/${{ matrix.name }}/PS2BBLE.ELF"
- name: Upload staged ELF for ${{ matrix.name }}
uses: actions/upload-artifact@v4
with:
name: built-elf-${{ matrix.name }}
path: staged-elves/${{ matrix.name }}/PS2BBLE.ELF
if-no-files-found: error
- name: Package ${{ matrix.name }}
run: |
set -euo pipefail
mkdir -p artifacts
tar -czf "artifacts/${{ matrix.name }}.tar.gz" -C "build/variants/${{ matrix.name }}" .
- name: Upload ${{ matrix.name }}
uses: actions/upload-artifact@v4
with:
name: ps2bbl-${{ matrix.name }}-${{ steps.meta.outputs.short_sha }}
path: artifacts/*.tar.gz
if-no-files-found: error
package-elves:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download staged ELFs
uses: actions/download-artifact@v4
with:
pattern: built-elf-*
path: dist
merge-multiple: false
- name: Normalize dist layout
run: |
set -euo pipefail
shopt -s nullglob
for artifact_dir in dist/built-elf-*; do
[ -d "$artifact_dir" ] || continue
name="${artifact_dir##*/built-elf-}"
elf_path="$artifact_dir/PS2BBLE.ELF"
if [ ! -f "$elf_path" ]; then
echo "Missing PS2BBLE.ELF for $name in $artifact_dir" >&2
exit 1
fi
mkdir -p "dist/$name"
cp "$elf_path" "dist/$name/PS2BBLE.ELF"
done
for leftover in dist/built-elf-*; do
[ -d "$leftover" ] || continue
rm -rf "$leftover"
done
- name: Show dist tree
run: |
set -euo pipefail
find dist -maxdepth 3 -print
- name: Zip staged ELFs
run: |
set -euo pipefail
if [ ! -d dist ]; then
echo "dist directory not found" >&2
exit 1
fi
zip -r PS2BBLE.zip dist
- name: Upload PS2BBLE zip
uses: actions/upload-artifact@v4
with:
name: ps2bble-zip-${{ github.sha }}
path: PS2BBLE.zip
if-no-files-found: error
prerelease:
needs: package-elves
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Install GitHub CLI
run: |
sudo apt-get update
sudo apt-get install -y gh
- name: Checkout repository
uses: actions/checkout@v4
- name: Resolve release name
id: release_name
run: |
set -euo pipefail
if [ -n "${{ github.event.inputs.release_name }}" ]; then
echo "value=${{ github.event.inputs.release_name }}" >> "$GITHUB_OUTPUT"
else
tag_name="${GITHUB_REF_NAME}"
echo "value=${tag_name}" >> "$GITHUB_OUTPUT"
fi
- name: Download PS2BBLE zip
uses: actions/download-artifact@v4
with:
name: ps2bble-zip-${{ github.sha }}
path: release-artifacts
- name: Verify PS2BBLE.zip
run: |
set -euo pipefail
if [ ! -f release-artifacts/PS2BBLE.zip ]; then
echo "PS2BBLE.zip not found in release-artifacts" >&2
exit 1
fi
- name: Publish prerelease
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
with:
tag_name: cl-${{ github.sha }}
name: CL prerelease ${{ github.sha }}
body: |
Automated CL prerelease for `${{ steps.release_name.outputs.value }}`
<img width="1536" height="394" alt="logo" src="https://github.com/user-attachments/assets/e536e2cd-4287-413e-9695-8e2aec3d25fb" />
Check the [readme.md](https://github.com/NathanNeurotic/PlayStation2-Basic-BootLoader-Extended#documentation)
Test Sheet: https://github.com/NathanNeurotic/PlayStation2-Basic-BootLoader-Extended/blob/main/BETA_TEST_CHECKLIST.md
### PS2BBLE.zip contains all versions
Note: MMCE + MX4SIO combined variants are intentionally omitted (unsupported in embedded IRX mode).
prerelease: true
files: release-artifacts/PS2BBLE.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}