Files
Horizon-OC/.github/workflows/build.yml
2026-02-01 14:28:37 -03:00

137 lines
5.0 KiB
YAML

name: Build Horizon OC Zeus
on:
push:
branches: [ develop, main, master ]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
# Minimal devkitA64 container, apparently dkp-toolchain isn't needed?
container:
image: devkitpro/devkita64:latest
steps:
- name: Checkout repository and submodules # why are we doing this? I don't think we use submodules but memory doesn't serve so let's keep it
uses: actions/checkout@v4
with:
submodules: recursive
# -------------------------------------------------
# Fix PATH for devkitA64 and devkitARM
# -------------------------------------------------
- name: Set devkitPro PATH
run: |
echo "DEVKITPRO=/opt/devkitpro" >> $GITHUB_ENV
echo "DEVKITA64=/opt/devkitpro/devkitA64" >> $GITHUB_ENV
echo "DEVKITARM=/opt/devkitpro/devkitARM" >> $GITHUB_ENV
echo "PATH=/opt/devkitpro/devkitA64/bin:/opt/devkitpro/devkitARM/bin:$PATH" >> $GITHUB_ENV
shell: bash
- name: I do not know why this doesn't work on the previous part
run: |
aarch64-none-elf-gcc --version
arm-none-eabi-gcc --version
shell: bash # is this even needed? but for consistency let's keep using it
- name: Install ccache
run: |
apt-get update
apt-get install -y ccache
shell: bash
# -------------------------------------------------
# Get short commit SHA
# -------------------------------------------------
- name: Set commit SHA
id: vars
run: echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
# -------------------------------------------------
# Clone Atmosphère
# -------------------------------------------------
- name: Clone Atmosphere
run: git clone https://github.com/Atmosphere-NX/Atmosphere.git atmosphere -b $(cat ams_ver.txt)
# -------------------------------------------------
# Clone Horizon OC (develop branch) kinda suspicious for now, shouldn't it just already be cloned on the actions runner?
# -------------------------------------------------
#- name: Clone Horizon OC
# run: git clone -b develop --single-branch https://github.com/Horizon-OC/Horizon-OC.git horizon-oc
# -------------------------------------------------
# Prepare build folder
# -------------------------------------------------
- name: Prepare build folder
run: |
mkdir -p build
cp -r atmosphere/* build/
# -------------------------------------------------
# Override loader source
# -------------------------------------------------
- name: Override ldr_process_creation.cpp
run: |
cp -f Source/Atmosphere/stratosphere/loader/source/ldr_process_creation.cpp \
build/stratosphere/loader/source/ldr_process_creation.cpp
# -------------------------------------------------
# Build Horizon OC Zeus (trying ccache, directly invoking make instead, hacky)
# -------------------------------------------------
#- name: Build Horizon OC Zeus
# working-directory: horizon-oc
# run: |
# chmod +x build.sh
# ./build.sh
- name: Cache ccache
uses: actions/cache@v4
with:
path: /root/.cache/ccache
key: ccache-${{ runner.os }}-devkitpro-${{ hashFiles('**/Makefile', '**/*.mk') }}
restore-keys: |
ccache-${{ runner.os }}-devkitpro-
- name: Configure ccache
run: |
export CCACHE_DIR=/root/.cache/ccache
echo "CCACHE_DIR=/root/.cache/ccache" >> $GITHUB_ENV
ccache --set-config=max_size=10G
ccache --set-config=compiler_check=content
ccache --zero-stats
- name: Build (try)
working-directory: build/stratosphere/loader
run: | # I forgot what dkp uses
export CC="ccache aarch64-none-elf-gcc"
export CXX="ccache aarch64-none-elf-g++"
make -j$(($(nproc) * 2)) CXX="ccache aarch64-none-elf-g++" CC="ccache aarch64-none-elf-gcc"
hactool -t kip1 out/nintendo_nx_arm64_armv8a/release/loader.kip --uncompress=hoc.kip
cp build/stratosphere/loader/hoc.kip dist/atmosphere/kips/hoc.kip
- name: ccache stats
run: ccache --show-stats
# -------------------------------------------------
# Package dist folder as ZIP with commit SHA
# -------------------------------------------------
- name: Package dist
# working-directory: horizon-oc
run: |
ZIP_NAME="horizon-oc-zeus-dist-${SHORT_SHA}.zip"
zip -r "$ZIP_NAME" dist
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV
# -------------------------------------------------
# Upload ZIP artifact
# -------------------------------------------------
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: horizon-oc-zeus-dist
path: horizon-oc/${{ env.ZIP_NAME }}