Skip to content

Commit

Permalink
ci: nswitch: add autobuilds
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed Nov 16, 2024
1 parent 3d8f63d commit 7969d84
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,41 @@ jobs:
path: bin/
retention-days: 0

build-arm64-switch:
runs-on: ubuntu-latest
steps:
- name: Install host dependencies
run: |
sudo apt-get update
sudo apt-get install git make cmake curl
- name: Install devkitA64 docker image
run: sudo docker pull devkitpro/devkita64:latest
- name: Checkout repository
uses: actions/checkout@v4
- name: Build pd.arm64.nro
run: sudo docker run --name pd --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./tools/buildscripts/nswitch_docker.sh build
- name: Build pd.pal.arm64.nro
run: sudo docker run --name pd --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./tools/buildscripts/nswitch_docker.sh build_pal -DROMID=pal-final
- name: Build pd.jpn.arm64.nro
run: sudo docker run --name pd --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./tools/buildscripts/nswitch_docker.sh build_jpn -DROMID=jpn-final
- name: Prepare artifact for packaging
run: |
mkdir -p bin/perfectdark/data
mkdir -p bin/perfectdark_pal/data
mkdir -p bin/perfectdark_jpn/data
cp build/pd.arm64.nro bin/
cp build_pal/pd.pal.arm64.nro bin/
cp build_jpn/pd.jpn.arm64.nro bin/
touch bin/perfectdark/data/put_your_rom_here.txt
touch bin/perfectdark_pal/data/put_your_rom_here.txt
touch bin/perfectdark_jpn/data/put_your_rom_here.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pd-arm64-nswitch
path: bin/
retention-days: 0

build-flatpak-bundle:
name: "Build flatpak bundle"
runs-on: ubuntu-latest
Expand Down
32 changes: 32 additions & 0 deletions tools/buildscripts/nswitch_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

git config --global --add safe.directory '*'

echo "Setting up environment..."

# we can't actually download dkp-toolchain-vars even from here, so
export PORTLIBS_ROOT=${DEVKITPRO}/portlibs
export PATH=${DEVKITPRO}/tools/bin:${DEVKITPRO}/devkitA64/bin:$PATH
export TOOL_PREFIX=aarch64-none-elf-
export CC=${TOOL_PREFIX}gcc
export CXX=${TOOL_PREFIX}g++
export AR=${TOOL_PREFIX}gcc-ar
export RANLIB=${TOOL_PREFIX}gcc-ranlib
export PORTLIBS_PREFIX=${DEVKITPRO}/portlibs/switch
export PATH=$PORTLIBS_PREFIX/bin:$PATH
export ARCH="-march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec"
export CFLAGS="${ARCH} -O2 -ffunction-sections -fdata-sections"
export CXXFLAGS="${CFLAGS}"
export CPPFLAGS="-D__SWITCH__ -I${PORTLIBS_PREFIX}/include -isystem ${DEVKITPRO}/libnx/include"
export LDFLAGS="${ARCH} -L${PORTLIBS_PREFIX}/lib -L${DEVKITPRO}/libnx/lib"
export LIBS="-lnx"

echo "Configuring..."

aarch64-none-elf-cmake -G"Unix Makefiles" -B$1 $2 $3 $4 $5 . || exit 1

echo "Building..."

pushd $1 || exit 1
make -j4 || exit 1
popd || exit 1

0 comments on commit 7969d84

Please sign in to comment.