Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

Add CI on GitHub and a one-command release script

Rafael Abud Ferreiraa8bde20a980f
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..e081a22
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+# Every push and pull request: the desktop build with its unit tests, and a
+# scan of the changes for account data. The PS5 build needs the PS5_Vulkan
+# toolchain, which isn't here: tools/release.sh checks it before a release.
+name: CI
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: recursive
+
+ - name: Tools
+ run: sudo apt-get update -q && sudo apt-get install -y -q cmake ninja-build clang llvm nasm
+
+ # FFmpeg is configured and built by tools/build-ffmpeg.sh the first
+ # time CMake runs (minutes): kept between runs while its source and
+ # the script stay the same.
+ - name: FFmpeg cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/xcloud-ps5
+ key: ffmpeg-host-${{ hashFiles('.git/modules/deps/ffmpeg/HEAD', 'tools/build-ffmpeg.sh') }}
+
+ - name: Configure
+ env:
+ CC: clang
+ CXX: clang++
+ run: cmake -S . -B build-host -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
+
+ - name: Build
+ run: ninja -C build-host
+
+ - name: Unit tests
+ run: ctest --test-dir build-host --output-on-failure
+
+ account-data:
+ if: github.event_name == 'pull_request'
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ # Tokens look like JWTs (eyJ...), refresh tokens or XBL3.0 headers; the
+ # sign-in file, logs and captures never belong in the repository.
+ - name: No account data in the changes
+ run: |
+ base=${{ github.event.pull_request.base.sha }}
+ if git diff "$base"...HEAD | grep -nE '^\+.*(eyJ[A-Za-z0-9_-]{20,}|refresh_token"? *[:=] *"[A-Za-z0-9]|XBL3\.0 x=[0-9])'; then
+ echo "::error::A token or sign-in data in the changes"; exit 1
+ fi
+ if git diff --name-only --diff-filter=AM "$base"...HEAD | grep -nE '(^|/)account\.json$|\.log$|\.ppm$|\.aus$|\.h264$|(^|/)autoplay\.txt$'; then
+ echo "::error::A file that must not be committed"; exit 1
+ fi
+ echo "clean"
diff --git a/README.md b/README.md
index 11fa5bb..0d71a32 100644
--- a/README.md
+++ b/README.md
@@ -91,6 +91,9 @@ tools/ps5/link.sh build-ps5 # -> build-ps5/eboot.bin
tools/ps5/package.sh build-ps5 # -> build-ps5/pkg/PPSA99810/
```
+A release is built and checked with `tools/release.sh <X.Y.Z>` (see the
+script's header); it publishes nothing.
+
## License
GPL-3.0-or-later; see `LICENSE`. The PS5 binary statically links the PS5 app
diff --git a/ROADMAP.md b/ROADMAP.md
index f3cc510..22a10cd 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -94,6 +94,16 @@ library"), and a GET with no answer is retried once. Host stress test
(`xcloud-cli tls-stress`): 960 parallel requests, 0 failures (before: 2
runs in 3 failed).
+### Safer changes and releases — done
+- CI (`.github/workflows/ci.yml`): the desktop build and unit tests on
+ every push and pull request, and a scan of each pull request for tokens
+ and private files.
+- `tools/release.sh <X.Y.Z> [out] [--console]`: checks the version,
+ contentVersion, tag and changes, builds and packages without the
+ account, checks inside the zip and eboot.bin, optionally streams on the
+ console, and prints the publish commands and the catalog record. It
+ publishes nothing.
+
## Next
| Item | Why | Size |
@@ -101,8 +111,6 @@ runs in 3 failed).
| Voice chat (microphone) | xCloud has a chat channel; needs PS5 audio capture | large |
| USB keyboard and mouse | Some xCloud games accept them | medium |
| Split `ps5_main.cpp` | 1,100+ lines mixing the stream screen, autoplay and settings | medium |
-| CI on GitHub | Host build and unit tests on every PR | small |
-| One-command release | Package, checksums, release and catalog record, with the secret scan | small |
## Dropped (and why)
diff --git a/tools/release.sh b/tools/release.sh
new file mode 100755
index 0000000..16ca534
--- /dev/null
+++ b/tools/release.sh
@@ -0,0 +1,108 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-3.0-or-later
+# Copyright (C) 2026 RafaelNGP
+# Builds and checks a release, the same way every time; publishes nothing.
+#
+# tools/release.sh <X.Y.Z> [out-dir] [--console]
+#
+# Stops at the first problem. Before building: a clean tree, the version in
+# CMakeLists.txt and ps5/sce_sys/param.json (contentVersion 0X.YZZ.000, above
+# the last release's), no tag yet, and no token or private file in the
+# changes since the last release. Then: PS5 build -> link -> package WITHOUT
+# the account -> zip + sha256, and checks inside the zip (no private files,
+# README.txt and param.json at this version, no token in eboot.bin, the
+# version compiled in, the licenses). With --console (PS5_HOST set), a cloud
+# and an own-Xbox stream on the console. Last, it prints the commands that
+# publish the release and the catalog record.
+set -euo pipefail
+root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
+cd "$root"
+
+version=${1:?usage: tools/release.sh <X.Y.Z> [out-dir] [--console]}
+shift
+out=""
+console=0
+for a in "$@"; do
+ case $a in
+ --console) console=1 ;;
+ *) out=$a ;;
+ esac
+done
+out=${out:-$root/build-ps5/release-v$version}
+tag=v$version
+fail() { echo "release: $*" >&2; exit 1; }
+ok() { echo " ok $*"; }
+
+[[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]] || fail "version must be X.Y.Z"
+major=${BASH_REMATCH[1]} minor=${BASH_REMATCH[2]} patch=${BASH_REMATCH[3]}
+content=$(printf '%02d.%d%02d.000' "$major" "$minor" "$patch")
+tokens='eyJ[A-Za-z0-9_-]{20,}|refresh_token"? *[:=] *"[A-Za-z0-9]|XBL3\.0 x=[0-9]'
+private='(^|/)account\.json$|\.log$|\.ppm$|\.aus$|\.h264$|(^|/)autoplay\.txt$|(^|/)settings\.json$|(^|/)library\.json$|(^|/)prices\.json$'
+
+echo "== checks before building $tag"
+[[ -z $(git status --porcelain) ]] || fail "uncommitted changes (commit or stash them first)"
+ok "clean tree on $(git rev-parse --abbrev-ref HEAD) at $(git rev-parse --short HEAD)"
+grep -q "project(xcloud_ps5 VERSION $version " CMakeLists.txt || fail "CMakeLists.txt is not at VERSION $version"
+grep -q "\"contentVersion\": \"$content\"" ps5/sce_sys/param.json || fail "param.json contentVersion is not $content"
+ok "version $version, contentVersion $content"
+git rev-parse -q --verify "refs/tags/$tag" >/dev/null && fail "tag $tag exists already"
+git ls-remote --exit-code --tags origin "$tag" >/dev/null 2>&1 && fail "tag $tag exists on origin already"
+last=$(git describe --tags --abbrev=0 2>/dev/null || true)
+if [[ -n $last ]]; then
+ prev=$(git show "$last:ps5/sce_sys/param.json" | grep -o '"contentVersion": "[^"]*"' | cut -d'"' -f4)
+ [[ $content > $prev ]] || fail "contentVersion $content is not above $last's $prev"
+ ok "above $last ($prev)"
+ if git diff "$last"..HEAD | grep -nE "^\+.*($tokens)"; then fail "a token in the changes since $last"; fi
+ ok "no token in the changes since $last"
+fi
+if git ls-files | grep -nE "$private"; then fail "private files are tracked"; fi
+ok "no private file tracked"
+
+echo "== build"
+buildlog=$(mktemp)
+cmake --build build-ps5 -j"$(nproc)" >"$buildlog" 2>&1 || { cat "$buildlog"; fail "the PS5 build failed"; }
+tools/ps5/link.sh build-ps5 >"$buildlog" 2>&1 || { cat "$buildlog"; fail "linking eboot.bin failed"; }
+rm -f "$buildlog"
+ok "PS5 build linked"
+rm -rf "$out"
+mkdir -p "$out"
+env -u XC_INCLUDE_ACCOUNT XC_VERSION="$tag" tools/ps5/package.sh build-ps5 "$out" >/dev/null
+(cd "$out" && zip -qr PPSA99810.zip PPSA99810 && sha256sum PPSA99810.zip > PPSA99810.zip.sha256)
+sha=$(cut -d' ' -f1 "$out/PPSA99810.zip.sha256")
+ok "$out/PPSA99810.zip ($(du -h "$out/PPSA99810.zip" | cut -f1)), sha256 $sha"
+
+echo "== checks in the package"
+zip=$out/PPSA99810.zip
+if unzip -Z1 "$zip" | grep -nE "$private"; then fail "a private file in the zip"; fi
+ok "no private file ($(unzip -Z1 "$zip" | grep -vc '/$') files)"
+unzip -p "$zip" PPSA99810/README.txt | head -1 | grep -q "version $tag" || fail "README.txt is not at $tag"
+unzip -p "$zip" PPSA99810/sce_sys/param.json | grep -q "\"contentVersion\": \"$content\"" || fail "the packaged param.json is not $content"
+ok "README.txt $tag, param.json $content"
+eboot=$out/PPSA99810/eboot.bin
+if grep -aqE "$tokens" "$eboot"; then fail "eboot.bin holds something like a token"; fi
+grep -aq "$version" "$eboot" || fail "eboot.bin doesn't carry version $version (stale build?)"
+ok "eboot.bin: no token, version $version compiled in"
+for f in assets/cacert.pem licenses/THIRD_PARTY_NOTICES.md licenses/FFmpeg-LGPL-2.1.txt licenses/Anime4K-MIT.txt LICENSE; do
+ unzip -Z1 "$zip" | grep -qx "PPSA99810/$f" || fail "missing PPSA99810/$f"
+done
+ok "certificates and licenses in place"
+
+if [[ $console == 1 ]]; then
+ echo "== console (${PS5_HOST:?set PS5_HOST for --console})"
+ for run in "FORTNITE 25" "XHOME 25"; do
+ result=$(tools/ps5/autotest.sh $run 2>&1 || true) # whole output first: grep -q would cut it short
+ grep -q 'RESULT: finished' <<<"$result" || { echo "$result" | tail -5; fail "console run '$run' didn't finish"; }
+ log=build-ps5/autotest/xcloud.log
+ grep -q 'first frame presented' "$log" || fail "console run '$run': no picture"
+ grep -q 'TLS handshake' "$log" && fail "console run '$run': TLS errors"
+ ok "console: $run streamed ($(grep -o '[0-9]* frames shown' "$log" | tail -1))"
+ done
+fi
+
+echo "== all checks passed; to publish (with release notes in notes.md):"
+echo " gh release create $tag \"$zip\" \"$out/PPSA99810.zip.sha256\" --target $(git rev-parse HEAD) --title \"PSBox Cloud Gaming $tag\" --notes-file notes.md"
+echo "== catalog record (apps/PPSA99810.json):"
+echo " \"version\": \"$version\","
+echo " \"artifact_url\": \"https://github.com/RafaelNGP/xbox-cloud-gaming-ps5/releases/download/$tag/PPSA99810.zip\","
+echo " \"sha256\": \"$sha\","
+echo " \"icon_url\": \"https://raw.githubusercontent.com/RafaelNGP/xbox-cloud-gaming-ps5/$tag/ps5/sce_sys/icon0.png\""