Skip to content

Commit bca57a8

Browse files
committed
CI: PS5 + Switch build/test scripts and workflow jobs
1 parent b61b1a6 commit bca57a8

10 files changed

Lines changed: 429 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,50 @@ jobs:
776776
./build_all_and_pack_gcc.sh
777777
778778
779+
#PS5
780+
build_ps5_lib:
781+
runs-on: ubuntu-22.04
782+
needs: extract_version
783+
container:
784+
image: ghcr.io/pippocao/bqlog/debian:ps5-sdk
785+
steps:
786+
- name: Checkout repository
787+
uses: actions/checkout@v5
788+
789+
- name: Build for PS5
790+
run: |
791+
cd build/lib/ps5
792+
chmod +x *.sh
793+
./build_all_and_pack.sh
794+
795+
- name: Upload Artifacts
796+
uses: actions/upload-artifact@v6
797+
with:
798+
name: ps5_libs_${{ needs.extract_version.outputs.version }}
799+
path: ${{ github.workspace }}/dist
800+
801+
#Switch
802+
build_switch_lib:
803+
runs-on: ubuntu-22.04
804+
needs: extract_version
805+
container:
806+
image: ghcr.io/pippocao/bqlog/debian:switch-devkita64
807+
steps:
808+
- name: Checkout repository
809+
uses: actions/checkout@v5
810+
811+
- name: Build for Switch
812+
run: |
813+
cd build/lib/switch
814+
chmod +x *.sh
815+
./build_all_and_pack.sh
816+
817+
- name: Upload Artifacts
818+
uses: actions/upload-artifact@v6
819+
with:
820+
name: switch_libs_${{ needs.extract_version.outputs.version }}
821+
path: ${{ github.workspace }}/dist
822+
779823
#Mac
780824
build_mac_lib:
781825
runs-on: macos-latest

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,51 @@ jobs:
320320
chmod +x *.sh
321321
./run_test_${{ matrix.cc }}.sh ${{ matrix.cpp_ver }}
322322
323+
#PS5 (compile+link only; binaries require real hardware)
324+
ps5:
325+
runs-on: ubuntu-latest
326+
container:
327+
image: ghcr.io/pippocao/bqlog/debian:ps5-sdk
328+
steps:
329+
- name: Checkout repository
330+
uses: actions/checkout@v5
331+
332+
- name: Build for PS5
333+
run: |
334+
cd build/test/ps5
335+
chmod +x *.sh
336+
./run_test.sh 17
337+
338+
#Switch (devkitPro/libnx; compile+link only, binaries require real hardware)
339+
switch:
340+
runs-on: ubuntu-latest
341+
container:
342+
image: ghcr.io/pippocao/bqlog/debian:switch-devkita64
343+
steps:
344+
- name: Checkout repository
345+
uses: actions/checkout@v5
346+
347+
- name: Build for Switch
348+
run: |
349+
cd build/test/switch
350+
chmod +x *.sh
351+
./run_test.sh 17
352+
353+
#Switch (official Nintendo SDK nn:: syntax check against public nnheaders)
354+
switch_official_sdk_syntax:
355+
runs-on: ubuntu-latest
356+
container:
357+
image: ghcr.io/pippocao/bqlog/debian:switch-devkita64
358+
steps:
359+
- name: Checkout repository
360+
uses: actions/checkout@v5
361+
362+
- name: Run official SDK (nn) syntax check
363+
run: |
364+
cd build/test/switch_nn
365+
chmod +x *.sh
366+
./run_syntax_check.sh
367+
323368
#Mac
324369
mac_silicon:
325370
name: mac_silicon(arm64 cpp${{matrix.cpp_ver}} ${{ matrix.asan.label != ' ' && ', ' || '' }}${{ matrix.asan.label }})

build/lib/ps5/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cmake_build/
2+
pack/
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
# ------------------------------------------------------------
4+
# PS5 (Prospero) static library build + pack driver for BqLog.
5+
#
6+
# Usage:
7+
# build_all_and_pack.sh [ignored...]
8+
#
9+
# Unlike Linux (arch/compiler/java/node/python), the PS5 build needs no
10+
# parameters; extra arguments are accepted and ignored so that the CI
11+
# invocation keeps the same shape as the other platforms.
12+
#
13+
# Must be run inside the PS5 toolchain container
14+
# (ghcr.io/pippocao/bqlog/debian:ps5-sdk), which provides the
15+
# PS5_PAYLOAD_SDK environment variable plus clang-18/cmake/ninja.
16+
# ------------------------------------------------------------
17+
18+
if [[ -z "${PS5_PAYLOAD_SDK:-}" ]]; then
19+
echo "Environment variable PS5_PAYLOAD_SDK is not found! Build cancelled!"
20+
exit 1
21+
fi
22+
23+
# Only support Linux
24+
uname_s="$(uname -s)"
25+
if [[ "$uname_s" != "Linux" ]]; then
26+
echo "This script is for Linux only. Current OS: $uname_s"
27+
exit 1
28+
fi
29+
30+
TOOLCHAIN_FILE="$PS5_PAYLOAD_SDK/toolchain/prospero.cmake"
31+
if [[ ! -f "$TOOLCHAIN_FILE" ]]; then
32+
echo "Toolchain file not found: $TOOLCHAIN_FILE"
33+
exit 1
34+
fi
35+
36+
# Detect number of CPU cores for parallel build
37+
PARALLEL_JOBS="${PARALLEL_JOBS:-$(command -v nproc >/dev/null 2>&1 && nproc || echo 8)}"
38+
39+
BUILD_CONFIGS=(Debug MinSizeRel RelWithDebInfo Release)
40+
41+
echo "PS5 SDK: $PS5_PAYLOAD_SDK"
42+
echo "Toolchain: $TOOLCHAIN_FILE"
43+
echo "Parallel jobs: $PARALLEL_JOBS"
44+
45+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
46+
cd "$SCRIPT_DIR"
47+
48+
rm -rf "../../../artifacts"
49+
rm -rf "../../../install"
50+
51+
# PS5 supports static_lib only (src/CMakeLists.txt rejects dynamic_lib).
52+
for build_config in "${BUILD_CONFIGS[@]}"; do
53+
echo "== Configure/Build for CONFIG=${build_config} (static_lib) =="
54+
rm -rf "cmake_build"
55+
mkdir -p "cmake_build"
56+
pushd "cmake_build" >/dev/null
57+
cmake ../../../../src \
58+
-G Ninja \
59+
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \
60+
-DTARGET_PLATFORM:STRING=ps5 \
61+
-DBUILD_LIB_TYPE=static_lib \
62+
-DCMAKE_BUILD_TYPE="$build_config"
63+
64+
# Build and install
65+
cmake --build . -- -j"${PARALLEL_JOBS}"
66+
cmake --build . --target install
67+
popd >/dev/null
68+
done
69+
70+
# The pack step configures a small host-side CMake project; the PS5 toolchain
71+
# image only ships versioned clang (clang++-18, no generic c++/g++), so point
72+
# CMake at an available host compiler explicitly.
73+
if ! command -v c++ >/dev/null 2>&1 && [[ -z "${CXX:-}" ]]; then
74+
for candidate in g++ clang++ clang++-18; do
75+
if command -v "$candidate" >/dev/null 2>&1; then
76+
export CXX="$candidate"
77+
break
78+
fi
79+
done
80+
fi
81+
82+
# Package the library
83+
rm -rf pack
84+
mkdir -p pack
85+
pushd "pack" >/dev/null
86+
cmake ../../../../pack -DTARGET_PLATFORM:STRING=ps5 -DPACKAGE_NAME:STRING=bqlog-lib
87+
cmake --build . --target package
88+
popd >/dev/null
89+
90+
echo "---------"
91+
echo "Finished!"
92+
echo "---------"

build/lib/switch/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cmake_build/
2+
pack/
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
# ------------------------------------------------------------
4+
# Nintendo Switch (devkitPro/libnx) static library build + pack driver
5+
# for BqLog.
6+
#
7+
# Usage:
8+
# build_all_and_pack.sh [ignored...]
9+
#
10+
# Unlike Linux (arch/compiler/java/node/python), the Switch build needs no
11+
# parameters; extra arguments are accepted and ignored so that the CI
12+
# invocation keeps the same shape as the other platforms.
13+
#
14+
# Must be run inside the devkitA64 toolchain container
15+
# (ghcr.io/pippocao/bqlog/debian:switch-devkita64), which provides the
16+
# DEVKITPRO environment variable plus cmake/ninja.
17+
# ------------------------------------------------------------
18+
19+
if [[ -z "${DEVKITPRO:-}" ]]; then
20+
echo "Environment variable DEVKITPRO is not found! Build cancelled!"
21+
exit 1
22+
fi
23+
24+
# Only support Linux
25+
uname_s="$(uname -s)"
26+
if [[ "$uname_s" != "Linux" ]]; then
27+
echo "This script is for Linux only. Current OS: $uname_s"
28+
exit 1
29+
fi
30+
31+
TOOLCHAIN_FILE="$DEVKITPRO/cmake/Switch.cmake"
32+
if [[ ! -f "$TOOLCHAIN_FILE" ]]; then
33+
echo "Toolchain file not found: $TOOLCHAIN_FILE"
34+
exit 1
35+
fi
36+
37+
# Detect number of CPU cores for parallel build
38+
PARALLEL_JOBS="${PARALLEL_JOBS:-$(command -v nproc >/dev/null 2>&1 && nproc || echo 8)}"
39+
40+
BUILD_CONFIGS=(Debug MinSizeRel RelWithDebInfo Release)
41+
42+
echo "DEVKITPRO: $DEVKITPRO"
43+
echo "Toolchain: $TOOLCHAIN_FILE"
44+
echo "Parallel jobs: $PARALLEL_JOBS"
45+
46+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
47+
cd "$SCRIPT_DIR"
48+
49+
rm -rf "../../../artifacts"
50+
rm -rf "../../../install"
51+
52+
# Switch supports static_lib only (src/CMakeLists.txt rejects dynamic_lib).
53+
for build_config in "${BUILD_CONFIGS[@]}"; do
54+
echo "== Configure/Build for CONFIG=${build_config} (static_lib) =="
55+
rm -rf "cmake_build"
56+
mkdir -p "cmake_build"
57+
pushd "cmake_build" >/dev/null
58+
cmake ../../../../src \
59+
-G Ninja \
60+
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \
61+
-DTARGET_PLATFORM:STRING=switch \
62+
-DBUILD_LIB_TYPE=static_lib \
63+
-DCMAKE_BUILD_TYPE="$build_config"
64+
65+
# Build and install
66+
cmake --build . -- -j"${PARALLEL_JOBS}"
67+
cmake --build . --target install
68+
popd >/dev/null
69+
done
70+
71+
# Package the library
72+
rm -rf pack
73+
mkdir -p pack
74+
pushd "pack" >/dev/null
75+
cmake ../../../../pack -DTARGET_PLATFORM:STRING=switch -DPACKAGE_NAME:STRING=bqlog-lib
76+
cmake --build . --target package
77+
popd >/dev/null
78+
79+
echo "---------"
80+
echo "Finished!"
81+
echo "---------"

build/test/ps5/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CMakeFiles/

build/test/ps5/run_test.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
# PS5 (Prospero) unit-test build for BqLog.
3+
#
4+
# Usage (mirrors build/test/linux/run_test_gcc.sh):
5+
# ./run_test.sh [cpp_ver] # default: 17
6+
#
7+
# Must be run inside the PS5 toolchain container
8+
# (ghcr.io/pippocao/bqlog/debian:ps5-sdk), which provides the
9+
# PS5_PAYLOAD_SDK environment variable plus clang-18/cmake/ninja.
10+
#
11+
# The resulting BqLogUnitTest ELF only runs on real PS5 hardware, so this
12+
# script stops at compile+link: a successfully linked ELF is the CI pass
13+
# criterion.
14+
set -e
15+
16+
if [ -z "${PS5_PAYLOAD_SDK:-}" ]; then
17+
echo "Environment variable PS5_PAYLOAD_SDK is not found! Build cancelled!"
18+
exit 1
19+
fi
20+
21+
TOOLCHAIN_FILE="$PS5_PAYLOAD_SDK/toolchain/prospero.cmake"
22+
if [ ! -f "$TOOLCHAIN_FILE" ]; then
23+
echo "Toolchain file not found: $TOOLCHAIN_FILE"
24+
exit 1
25+
fi
26+
27+
CPP_VER_PARAM=${1:-17}
28+
29+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
30+
cd "$SCRIPT_DIR"
31+
mkdir -p CMakeFiles
32+
cd CMakeFiles
33+
34+
# The Prospero toolchain produces a plain ELF named BqLogUnitTest.
35+
verify_elf() {
36+
local cfg="$1"
37+
local elf=""
38+
for candidate in BqLogUnitTest BqLogUnitTest.elf; do
39+
if [ -f "$candidate" ]; then
40+
elf="$candidate"
41+
break
42+
fi
43+
done
44+
if [ -z "$elf" ]; then
45+
echo "Test failed: BqLogUnitTest ELF was not produced for $cfg."
46+
exit 1
47+
fi
48+
echo "Test succeeded: $cfg ELF linked: $(pwd)/$elf"
49+
echo "SKIP-RUN: ps5 binaries require real hardware; compile+link is the CI pass criterion"
50+
}
51+
52+
# 1) Debug
53+
cmake -G Ninja \
54+
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \
55+
-DTARGET_PLATFORM:STRING=ps5 \
56+
-DCMAKE_BUILD_TYPE=Debug \
57+
-DCPP_VER="$CPP_VER_PARAM" \
58+
../../../../test/cpp
59+
cmake --build . -- -j"$(nproc)"
60+
verify_elf Debug
61+
62+
# 2) RelWithDebInfo
63+
cmake -G Ninja \
64+
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \
65+
-DTARGET_PLATFORM:STRING=ps5 \
66+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
67+
-DCPP_VER="$CPP_VER_PARAM" \
68+
../../../../test/cpp
69+
cmake --build . -- -j"$(nproc)"
70+
verify_elf RelWithDebInfo
71+
72+
cd ..
73+
echo "Test succeeded."

build/test/switch/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CMakeFiles/

0 commit comments

Comments
 (0)