211 lines8.5 KBYAML
1name: PS3 build
2
3on:
4 push:
5 pull_request:
6 workflow_dispatch:
7
8permissions:
9 contents: read
10
11env:
12 # The same toolchain as Resonant-PS3, nzp-ps3 and thug-ps3 (pinned: the cache
13 # only rebuilds when these are bumped on purpose).
14 PS3TOOLCHAIN_REF: de85d7d5d11dc0a99d823ece3d440eea46c34d0f
15 PSL1GHT_REF: f649a08fd536a9e27c08c7db2d93a2d7ee4c3bbe
16 TOOLCHAIN_CACHE_KEY: ps3dev-v1-de85d7d5-f649a08f
17
18jobs:
19 # http_ps3.c and the same Mbed TLS build, on the runner, against dl.ps3.world:
20 # the handshake and certificate chain, Range resume, 404s, a bad certificate,
21 # catalog.json parsed by catalog.c, and download.c to disk (resume, checksum,
22 # disk full, cancel). Results are annotations on the run (fast; no PS3 toolchain)
23 https:
24 name: HTTPS test (dl.ps3.world)
25 runs-on: ubuntu-24.04
26 steps:
27 - uses: actions/checkout@v4
28 - name: Mbed TLS (host) and root certificates
29 run: |
30 sh tools/build-mbedtls.sh "$RUNNER_TEMP/mbedtls" gcc ar "-O2"
31 python3 tools/make-ca-bundle.py src/ps3/ca_bundle.h
32 - name: Build
33 run: |
34 M="$RUNNER_TEMP/mbedtls"
35 gcc -O1 -g -Wall -Wno-pointer-sign -DCJSON_NESTING_LIMIT=16 -Itools/hostshim -Isrc -Isrc/ps3 -I"$M/include" -o https_test \
36 tools/https_test.c src/ps3/http_ps3.c src/http_common.c src/catalog.c src/download.c src/lang.c src/thirdparty/cJSON.c \
37 -L"$M/library" -lmbedtls -lmbedx509 -lmbedcrypto -lpthread
38 - name: Run
39 run: ./https_test tests/sample
40
41 toolchain:
42 name: PS3 toolchain (cached)
43 runs-on: ubuntu-24.04
44 timeout-minutes: 360
45 steps:
46 - name: Look for the cached toolchain
47 id: cache
48 uses: actions/cache/restore@v4
49 with:
50 path: ${{ runner.temp }}/ps3dev
51 key: ${{ env.TOOLCHAIN_CACHE_KEY }}
52 lookup-only: true
53
54 - name: Install build requirements
55 if: steps.cache.outputs.cache-hit != 'true'
56 run: |
57 sudo apt-get update
58 sudo apt-get -y install \
59 autoconf automake bison flex gcc g++ libelf-dev make texinfo \
60 libncurses-dev patch python3 python-is-python3 python3-dev \
61 wget zlib1g-dev libtool-bin bzip2 libgmp-dev pkg-config libssl-dev
62
63 - name: Fetch ps3toolchain and PSL1GHT
64 if: steps.cache.outputs.cache-hit != 'true'
65 run: |
66 git clone https://github.com/ps3dev/ps3toolchain "$RUNNER_TEMP/ps3toolchain"
67 git -C "$RUNNER_TEMP/ps3toolchain" checkout "$PS3TOOLCHAIN_REF"
68 git clone https://github.com/ps3dev/PSL1GHT "$RUNNER_TEMP/psl1ght"
69 git -C "$RUNNER_TEMP/psl1ght" checkout "$PSL1GHT_REF"
70
71 - name: Set up environment
72 if: steps.cache.outputs.cache-hit != 'true'
73 run: |
74 echo "PS3DEV=$RUNNER_TEMP/ps3dev" >> "$GITHUB_ENV"
75 echo "PSL1GHT=$RUNNER_TEMP/ps3dev" >> "$GITHUB_ENV"
76 echo "BUILD_PS3TOOLCHAIN_ONLY=1" >> "$GITHUB_ENV"
77 echo "NO_SAVANNAH=1" >> "$GITHUB_ENV"
78 echo "$RUNNER_TEMP/ps3dev/bin" >> "$GITHUB_PATH"
79 echo "$RUNNER_TEMP/ps3dev/ppu/bin" >> "$GITHUB_PATH"
80 echo "$RUNNER_TEMP/ps3dev/spu/bin" >> "$GITHUB_PATH"
81 mkdir -p "$RUNNER_TEMP/ps3dev"
82
83 - name: Download toolchain sources
84 if: steps.cache.outputs.cache-hit != 'true'
85 working-directory: ${{ runner.temp }}/ps3toolchain
86 run: mkdir -p build && cd build && ../download.sh
87
88 - name: Binutils (PPU)
89 if: steps.cache.outputs.cache-hit != 'true'
90 working-directory: ${{ runner.temp }}/ps3toolchain
91 run: ./toolchain.sh 001
92 - name: GCC + newlib (PPU)
93 if: steps.cache.outputs.cache-hit != 'true'
94 working-directory: ${{ runner.temp }}/ps3toolchain
95 run: ./toolchain.sh 002
96 - name: Symlinks (PPU)
97 if: steps.cache.outputs.cache-hit != 'true'
98 working-directory: ${{ runner.temp }}/ps3toolchain
99 run: ./toolchain.sh 004
100 - name: Binutils (SPU)
101 if: steps.cache.outputs.cache-hit != 'true'
102 working-directory: ${{ runner.temp }}/ps3toolchain
103 run: ./toolchain.sh 005
104 - name: GCC + newlib (SPU)
105 if: steps.cache.outputs.cache-hit != 'true'
106 working-directory: ${{ runner.temp }}/ps3toolchain
107 run: ./toolchain.sh 006
108
109 - name: PSL1GHT
110 if: steps.cache.outputs.cache-hit != 'true'
111 working-directory: ${{ runner.temp }}/psl1ght
112 run: make install-ctrl && make && make install
113
114 - name: Save toolchain to cache
115 if: steps.cache.outputs.cache-hit != 'true'
116 uses: actions/cache/save@v4
117 with:
118 path: ${{ runner.temp }}/ps3dev
119 key: ${{ env.TOOLCHAIN_CACHE_KEY }}
120
121 app:
122 name: PS3 World EBOOT + PKG
123 needs: toolchain
124 runs-on: ubuntu-24.04
125 steps:
126 - uses: actions/checkout@v4
127
128 - name: Restore toolchain
129 uses: actions/cache/restore@v4
130 with:
131 path: ${{ runner.temp }}/ps3dev
132 key: ${{ env.TOOLCHAIN_CACHE_KEY }}
133 fail-on-cache-miss: true
134
135 - name: Set up environment
136 run: |
137 sudo apt-get update && sudo apt-get -y install libelf-dev python3
138 echo "PS3DEV=$RUNNER_TEMP/ps3dev" >> "$GITHUB_ENV"
139 echo "PSL1GHT=$RUNNER_TEMP/ps3dev" >> "$GITHUB_ENV"
140 echo "$RUNNER_TEMP/ps3dev/bin" >> "$GITHUB_PATH"
141 echo "$RUNNER_TEMP/ps3dev/ppu/bin" >> "$GITHUB_PATH"
142
143 - name: PSL1GHT's pkg.py
144 run: |
145 git clone -q https://github.com/ps3dev/PSL1GHT "$RUNNER_TEMP/psl1ght-py"
146 git -C "$RUNNER_TEMP/psl1ght-py" checkout -q "$PSL1GHT_REF"
147 pip install --quiet setuptools
148 cd "$RUNNER_TEMP/psl1ght-py/tools/ps3py"
149 python3 setup.py build -q
150 cp build/lib.*/pkgcrypt*.so .
151 python3 -c "import sys; sys.path.insert(0, '.'); import pkgcrypt"
152 echo "PS3PY_DIR=$RUNNER_TEMP/psl1ght-py/tools/ps3py" >> "$GITHUB_ENV"
153
154 # librsx calls the command-buffer wrap callback through an asm trampoline
155 # that declares almost no clobbers; at -O2 GCC's IPA register allocation
156 # trusts that (nzp-ps3's RSX hang). Rebuilt with -fno-ipa-ra.
157 - name: librsx without IPA-RA
158 run: |
159 cd "$RUNNER_TEMP/psl1ght-py/ppu/librsx"
160 sed -i 's/-O2 -mregnames/-O2 -fno-ipa-ra -mregnames/' Makefile
161 grep -q fno-ipa-ra Makefile || { echo "::error::librsx's Makefile changed: the -fno-ipa-ra patch didn't apply"; exit 1; }
162 make -s install
163
164 # HTTPS (dl.ps3.world): the PS3's own cellHttps is too old (see tools/build-mbedtls.sh)
165 - name: Mbed TLS (PPU) and root certificates
166 run: |
167 sh tools/build-mbedtls.sh "$RUNNER_TEMP/mbedtls" ppu-gcc ppu-ar \
168 "-O2 -mcpu=cell -mtune=cell -mno-altivec -mminimal-toc -fno-strict-aliasing -I$PSL1GHT/ppu/include -I$PS3DEV/ppu/include"
169 echo "MBEDTLS_DIR=$RUNNER_TEMP/mbedtls" >> "$GITHUB_ENV"
170 python3 tools/make-ca-bundle.py src/ps3/ca_bundle.h
171
172 - name: Build
173 run: |
174 set -o pipefail
175 ppu-gcc --version | head -1
176 make -f Makefile.ps3 MBEDTLS_DIR="$MBEDTLS_DIR" -k -j"$(nproc)" self 2>&1 | tee build.log
177
178 - name: Report errors
179 if: failure()
180 run: |
181 grep -E 'error|undefined reference|multiple definition|No rule|Error [0-9]' build.log \
182 | grep -v '^\s*|' | awk '!seen[$0]++' | head -120 > errors.txt || true
183 for part in 0 1 2 3; do
184 chunk=$(sed -n "$((part*30+1)),$((part*30+30))p" errors.txt)
185 [ -n "$chunk" ] || break
186 printf '::error title=build errors %d::%s\n' "$part" \
187 "$(printf '%s' "$chunk" | sed -e 's/%/%25/g' | awk '{printf "%s%%0A", $0}')"
188 done
189
190 - name: Link checks
191 run: |
192 elf=build/ps3/ps3world.elf
193 echo "::notice title=r2off TOC-split stubs (must be 0)::$(ppu-nm $elf | grep -c r2off || true)"
194 ppu-size $elf
195
196 - name: PKG
197 run: |
198 make -f Makefile.ps3 MBEDTLS_DIR="$MBEDTLS_DIR" PS3PY_DIR="$PS3PY_DIR" pkg
199 ls -la build/ps3/*.pkg
200 for f in USRDIR/EBOOT.BIN USRDIR/data/fonts/Poppins-Regular.ttf USRDIR/data/logo.png USRDIR/data/backdrop.png USRDIR/data/licenses/GPL-2.0.txt PIC1.PNG ICON0.PNG; do
201 [ -e "build/ps3/package/pkg/$f" ] || { echo "::error title=missing from PKG::$f"; exit 1; }
202 done
203 cp build/ps3/ps3world.gnpdrm.pkg PS3World.pkg
204
205 - name: Upload
206 uses: actions/upload-artifact@v4
207 with:
208 name: PS3World
209 retention-days: 7
210 path: PS3World.pkg
211 if-no-files-found: error