Skip to content

build

build #1784

Workflow file for this run

name: build
on:
push:
tags-ignore:
- switch-portlibs
- vita-packages
- mingw-packages
- macos-dylib
paths-ignore:
- scripts/**
- debian/*
- images/*
- CHANGELOG.md
- README.md
branches: [ dev ]
pull_request:
paths-ignore:
- scripts/**
branches: [ dev ]
workflow_dispatch:
inputs:
platform:
description: which platform to build
type: choice
options:
- mingw64
- macos
- nx
- psvita
- ps4
- flatpak
- aur
- deb
disable_builtin_nsp:
description: disable builtin NSP
type: boolean
permissions:
contents: write
jobs:
upload-release:
needs: [ build-mingw, build-nx, build-macos, build-flatpak, build-aur, build-ps4, build-vita ]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Assets
uses: actions/download-artifact@v4
- name: Package Assets
run: |
for p in Switchfin-windows-*; do
[[ -d $p ]] && 7z a -mx=9 $p.7z ./$p/* && rm -rf $p
done
tree
- name: Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
name: Switchfin ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
generate_release_notes: true
draft: true
files: |
Switchfin-windows-*.7z
Switchfin-macOS-*/*.dmg
Switchfin-NintendoSwitch-deko3d-*/*.nro
Switchfin-PS4-*/*.pkg
Switchfin-Vita-*/*.vpk
Switchfin-Flatpak-*/*.flatpak
Switchfin-Archlinux-*/*.pkg.tar.*
body: |
![download](https://img.shields.io/github/downloads/${{ github.repository }}/${{ github.ref_name }}/total?label=Downloads)
build-nx:
runs-on: ubuntu-latest
if: ${{ inputs.platform == 'nx' || github.event_name != 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
include:
- { driver: opengl }
- { driver: deko3d, cmake: "-DUSE_DEKO3D=ON", shuffix: "-deko3d" }
driver: [opengl, deko3d]
container:
image: devkitpro/devkita64:20241023
env:
BASE_URL: https://github.com/dragonflylee/switchfin/releases/download/switch-portlibs
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Update deko3d dependencies
if: ${{ matrix.driver == 'deko3d' }}
run: |
dkp-pacman --noconfirm -R switch-libmpv
dkp-pacman --noconfirm -U $BASE_URL/libuam-master-1-any.pkg.tar.zst
- name: Update dependencies
run: |
dkp-pacman --noconfirm -U $BASE_URL/hacBrewPack-3.05-1-x86_64.pkg.tar.zst
dkp-pacman --noconfirm -U $BASE_URL/libnx-4.9.0-1-any.pkg.tar.zst
for pkg in mbedtls-3.6.4-1 libssh2-1.11.1-1 curl-8.14.1-2 ffmpeg-7.1.2-5 libmpv${{ matrix.shuffix }}-0.36.0-5 nspmini-main-1; do
dkp-pacman --noconfirm -U $BASE_URL/switch-${pkg}-any.pkg.tar.zst
done
git config --system --add safe.directory $GITHUB_WORKSPACE
- name: Build libusbhsfs
run: |
git clone https://github.com/DarkMatterCore/libusbhsfs.git --depth=1
make -C libusbhsfs BUILD_TYPE=GPL install -j$(nproc)
- name: Build nro
run: |
cmake -B build ${{ matrix.cmake }} \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM_SWITCH=ON \
-DUSE_LIBUSBHSFS=ON \
-DBUILTIN_NSP=${{ github.event.inputs.disable_builtin_nsp && 'OFF' || 'ON' }} \
-DVERSION_BUILD=${{ github.run_number }}
make -C build Switchfin.nro -j$(nproc)
- name: Upload nro
uses: actions/upload-artifact@v4
with:
name: Switchfin-NintendoSwitch${{ matrix.shuffix }}-${{ github.run_number }}
path: build/Switchfin.nro
- name: Upload elf
uses: actions/upload-artifact@v4
with:
name: ns-dev-elf-${{ matrix.driver }}-${{ github.run_number }}
path: build/Switchfin.elf
build-ps4:
runs-on: ubuntu-latest
if: ${{ inputs.platform == 'ps4' || github.event_name != 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build
run: |
docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) xfangfang/wiliwili_ps4_builder \
"cmake -B build -DPLATFORM_PS4=ON -DVERSION_BUILD=${{ github.run_number }} && \
make -C build -j$(nproc)"
- name: Upload pkg
uses: actions/upload-artifact@v4
with:
name: Switchfin-PS4-${{ github.run_number }}
path: build/*.pkg
- name: Upload oelf
uses: actions/upload-artifact@v4
with:
name: ps4-dev-oelf-${{ github.run_number }}
path: build/Switchfin.oelf
build-vita:
runs-on: ubuntu-latest
if: ${{ inputs.platform == 'psvita' || github.event_name != 'workflow_dispatch' }}
container:
image: vitasdk/vitasdk:latest
steps:
- name: Install build requirements
run: |
apk update
apk add cmake ninja git zstd tar pkgconf
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Update dependencies
env:
BASE_URL: https://github.com/dragonflylee/switchfin/releases/download/vita-packages
run: |
for pkg in mbedtls-3.4.1-1 curl-8.14.1-2 ffmpeg-n6.0-3 mpv-0.36.0-3; do
wget $BASE_URL/${pkg}-arm.tar.xz
done
vdpm libass harfbuzz fribidi freetype libpng libwebp $PWD/*-arm.tar.xz
git config --system --add safe.directory $GITHUB_WORKSPACE
- name: Build
run: |
cmake -B build -G Ninja -DPLATFORM_PSV=ON -DUSE_GXM=ON \
-DUSE_VITA_SHARK=OFF -DVERSION_BUILD=${{ github.run_number }}
cmake --build build
- name: Upload vpk
uses: actions/upload-artifact@v4
with:
name: Switchfin-Vita-${{ github.run_number }}
path: build/Switchfin.vpk
- name: Upload velf
uses: actions/upload-artifact@v4
with:
name: psv-dev-velf-${{ github.run_number }}
path: build/Switchfin.velf
build-flatpak:
strategy:
fail-fast: false
matrix:
include:
- { arch: x86_64, runner: ubuntu-24.04 }
- { arch: aarch64, runner: ubuntu-24.04-arm }
exclude:
- { arch: x86_64, driver: gles2 }
arch: [ x86_64, aarch64 ]
driver: [ gl, gles2 ]
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-24.08
options: --privileged
runs-on: ${{ matrix.runner }}
if: ${{ inputs.platform == 'flatpak' || github.event_name != 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set workspace permissions
run: git config --system --add safe.directory $GITHUB_WORKSPACE
- name: Add OpenGL ES 2.0 build option
if: matrix.driver == 'gles2'
run: sed -i 's/USE_GLES2=OFF/USE_GLES2=ON/' scripts/flatpak.yaml
- name: Build flatpak
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.5
with:
bundle: Switchfin-Linux-${{ matrix.arch }}-${{ matrix.driver }}-${{ github.run_number }}.flatpak
manifest-path: scripts/flatpak.yaml
cache-key: flatpak-${{ matrix.driver }}-${{ hashFiles('scripts/flatpak.yaml') }}
upload-artifact: false
arch: ${{ matrix.arch }}
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-Flatpak-${{ matrix.arch }}-${{ matrix.driver }}-${{ github.run_number }}
path: Switchfin-*.flatpak
if-no-files-found: error
build-deb:
strategy:
fail-fast: false
matrix:
include:
- { img: ubuntu, tag: noble }
- { img: debian, tag: bookworm }
- { arch: x86_64, runner: ubuntu-24.04 }
- { arch: aarch64, runner: ubuntu-24.04-arm }
arch: [ x86_64, aarch64 ]
tag: [ noble, bookworm ]
runs-on: ${{ matrix.runner }}
container:
image: ${{ matrix.img }}:${{ matrix.tag }}
if: ${{ inputs.platform == 'deb' }}
steps:
- name: Install dependency
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
apt-get install -y --no-install-recommends debhelper cmake build-essential \
ninja-build git wget ca-certificates xorg-dev libdbus-1-dev libssl-dev \
libwayland-dev libxkbcommon-dev libwebp-dev libmpv-dev
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build deb
env:
DH_QUIET: "1"
run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
dpkg-buildpackage -b -nc
mv ../switchfin_*.deb $GITHUB_WORKSPACE
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-${{ matrix.img }}-${{ matrix.tag }}-${{ matrix.arch }}-${{ github.run_number }}
path: switchfin_*.deb
build-aur:
runs-on: ubuntu-latest
if: ${{ inputs.platform == 'aur' || github.event_name != 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build aur
run: docker run --rm --tty --network host -v $PWD:/work -e PUID=$(id -u) -w /work/scripts/aur archlinux bash entrypoint.sh
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-Archlinux-${{ github.run_number }}
path: scripts/aur/*.pkg.tar.*
build-macos:
runs-on: macos-latest
if: ${{ inputs.platform == 'macos' || github.event_name != 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
include:
- { tag: Silicon, arch: arm64, target: "11.0" }
- { tag: Intel, arch: x86_64, target: "10.15" }
tag: [ Silicon, Intel ]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install deps
run: |
brew install create-dmg dylibbundler
curl -sSL https://github.com/dragonflylee/switchfin/releases/download/macos-dylib/dylib-ffmpeg8-mpv40-${{ matrix.tag }}.tar.gz | tar zxf - -C ${{ runner.temp }}
- name: Build App
env:
DYLD_LIBRARY_PATH: ${{ runner.temp }}/lib
run: |
cmake -B build -DCMAKE_PREFIX_PATH=${{ runner.temp }} \
-DCMAKE_BUILD_TYPE=Release \
-DPLATFORM_DESKTOP=ON \
-DUSE_SYSTEM_GLFW=ON \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.target }} \
-DVERSION_BUILD=${{ github.run_number }}
make -C build -j$(sysctl -n hw.ncpu)
- name: Create DMG
run: |
mkdir -p dist
mv build/Switchfin.app dist/
cp README.md dist
dist/Switchfin.app/Contents/MacOS/Switchfin -version
create-dmg --window-pos 200 120 --window-size 800 400 \
--icon-size 100 --icon "Switchfin.app" 200 190 \
--icon "README.md" 400 100 --hide-extension "Switchfin.app" \
--app-drop-link 600 185 --volicon ./scripts/macos/dmg.icns \
--volname "Switchfin" Switchfin-macOS-${{ matrix.tag }}-${{ github.run_number }}.dmg "dist/"
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-macOS-${{ matrix.tag }}-${{ github.run_number }}
path: Switchfin-*.dmg
build-mingw:
if: ${{ inputs.platform == 'mingw64' || github.event_name != 'workflow_dispatch'}}
strategy:
fail-fast: false
matrix:
include:
- { arch: x64, sys: mingw64, env: x86_64 }
- { arch: x86, sys: mingw32, env: i686 }
- { arch: arm64, sys: clangarm64, env: clang-aarch64 }
arch: [ x64, x86, arm64 ]
runs-on: ${{ contains(matrix.sys, 'arm64') && 'windows-11-arm' || 'windows-latest' }}
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
id: msys2
with:
msystem: ${{ matrix.sys }}
path-type: inherit
cache: false
release: ${{ contains(matrix.sys, 'arm64') }}
install: >-
mingw-w64-${{ matrix.env }}-ninja
mingw-w64-${{ matrix.env }}-cc
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependency
run: |
for pkg in glfw-3.5.0-1 curl-8.14.1-1 mpv-0.40.0-1 libwebp-1.6.0-1; do
curl -sLO https://github.com/dragonflylee/switchfin/releases/download/mingw-packages/${MINGW_PACKAGE_PREFIX}-${pkg}-any.pkg.tar.zst
done
pacman -U --noconfirm *.pkg.tar.zst
curl -sLO https://github.com/rainers/cv2pdb/releases/download/v0.54/cv2pdb-0.54.zip
unzip cv2pdb-0.54.zip cv2pdb64.exe -d /usr/bin
- if: matrix.sys == 'mingw32'
name: Config Editbin
shell: powershell
run: |
$vcvarsall_path = vswhere.exe -latest -products * -find "VC\Auxiliary\Build\vcvarsall.bat"
$cc1_path = Get-ChildItem -Path "${{ steps.msys2.outputs.msys2-location }}\mingw32\lib\gcc" -Filter cc1plus.exe -Recurse -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName }
cmd.exe /c "call ""$vcvarsall_path"" x86_amd64 && editbin /LARGEADDRESSAWARE $cc1_path"
- name: Build
env:
MSYS2_PATH_TYPE: inherit
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPLATFORM_DESKTOP=ON \
-DWIN32_TERMINAL=OFF \
-DZLIB_USE_STATIC_LIBS=ON \
-DUSE_SYSTEM_GLFW=ON \
-DUSE_D3D11=ON \
-DUSE_LIBROMFS=ON \
-DVERSION_BUILD=${{ github.run_number }}
cmake --build build
cv2pdb64 build/Switchfin.exe
cp -a README.md ${MINGW_PREFIX}/bin/libmpv-2.dll build
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-windows-${{ matrix.arch }}-${{ github.run_number }}
path: |
build/Switchfin.exe
build/Switchfin.pdb
build/libmpv-2.dll
build/README.md