Skip to content

refactor: rename api model #915

refactor: rename api model

refactor: rename api model #915

Workflow file for this run

name: build
on:
push:
tags-ignore:
- switch-portlibs
- mingw-packages
- macos-dylib
paths-ignore:
- scripts/mingw64/*/*
- scripts/switch/*/*
- scripts/l4t/*
- images/*
- CHANGELOG.md
- README.md
branches: [ dev ]
pull_request:
paths-ignore:
- scripts/mingw64/*/*
- scripts/switch/*/*
branches: [ dev ]
workflow_dispatch:
inputs:
nx:
description: build nintendo switch
type: boolean
ps4:
description: build playstation 4
type: boolean
macos:
description: build macos dmg
type: boolean
arm_flatpak:
description: build flatpak (aarch64)
type: boolean
deb:
description: build ubuntu deb
type: boolean
mingw64:
description: build win64 mingw64
type: boolean
msvc:
description: build win64 msvc
type: boolean
permissions:
contents: write
jobs:
upload-release:
needs: [ build-mingw, build-nx, build-macos, build-flatpak ]
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/*
done
- 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-deko3d-*/*.nro
Switchfin-linux-*/*.flatpak
body: |
![download](https://img.shields.io/github/downloads/${{ github.repository }}/${{ github.ref_name }}/total?label=Downloads)
build-nx:
runs-on: ubuntu-latest
if: ${{ inputs.nx || github.event_name != 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
include:
- { driver: opengl }
- { driver: deko3d, cmake: "-DUSE_DEKO3D=ON" }
driver: [opengl, deko3d]
container:
image: devkitpro/devkita64:20240324
env:
BASE_URL: https://github.com/dragonflylee/switchfin/releases/download/switch-portlibs
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set workspace permissions
run: |
chown $(id -u):$(id -g) -R "$GITHUB_WORKSPACE"
git config --system --add safe.directory '*'
- name: Update dependencies
run: |
dkp-pacman --noconfirm -U $BASE_URL/hacBrewPack-3.05-1-any.pkg.tar.zst
dkp-pacman --noconfirm -U $BASE_URL/libnx-4.7.0-1-any.pkg.tar.zst
for pkg in curl-8.7.1-1 libass-0.17.2-1 dav1d-1.4.3-1 ffmpeg-7.0.1-1 nspmini-main-1; do
dkp-pacman --noconfirm -U $BASE_URL/switch-${pkg}-any.pkg.tar.zst
done
dkp-pacman --noconfirm -R switch-libmpv
- name: Update mpv opengl
if: ${{ matrix.driver == 'opengl' }}
run: |
for pkg in switch-libmpv-0.36.0-5; do
dkp-pacman --noconfirm -U $BASE_URL/${pkg}-any.pkg.tar.zst
done
- name: Update mpv deko3d
if: ${{ matrix.driver == 'deko3d' }}
run: |
for pkg in libuam-master-1 switch-libmpv-deko3d-0.36.0-6; do
dkp-pacman --noconfirm -U $BASE_URL/${pkg}-any.pkg.tar.zst
done
- name: Build nro
run: |
cp /etc/ssl/certs/ca-certificates.crt resources/ca-bundle.crt
cmake -B build_switch -DCMAKE_BUILD_TYPE=Release -DPLATFORM_SWITCH=ON -DBUILTIN_NSP=ON -DVERSION_BUILD=${{ github.run_number }} ${{ matrix.cmake }}
make -C build_switch Switchfin.nro -j$(nproc)
- name: Set outputs
id: vars
run: echo "sha_short=${{ matrix.driver }}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-${{ steps.vars.outputs.sha_short }}
path: |
build_switch/Switchfin.nro
build_switch/Switchfin.elf
build-ps4:
runs-on: ubuntu-latest
if: ${{ inputs.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_ps4 -DPLATFORM_PS4=ON -DVERSION_BUILD=${{ github.run_number }} && \
make -C build_ps4 -j$(nproc)"
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-ps4-${{ steps.vars.outputs.sha_short }}
path: |
build_ps4/Switchfin.oelf
build_ps4/*.pkg
build-flatpak:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [ x86_64, aarch64 ]
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-22.08
options: --privileged
if: ${{ inputs.arm_flatpak || github.event_name != 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
if: ${{ matrix.arch == 'x86_64' || (matrix.arch == 'aarch64' && inputs.arm_flatpak) }}
with:
submodules: recursive
- name: Install docker
if: ${{ matrix.arch == 'aarch64' && inputs.arm_flatpak }}
run: dnf -y install docker
- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' && inputs.arm_flatpak }}
uses: docker/setup-qemu-action@v3
- name: Set workspace permissions
run: git config --system --add safe.directory '*'
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
if: ${{ matrix.arch == 'x86_64' || (matrix.arch == 'aarch64' && inputs.arm_flatpak) }}
with:
bundle: Switchfin-linux-${{ steps.vars.outputs.sha_short }}.flatpak
manifest-path: scripts/flatpak.yaml
cache-key: flatpak-builder-${{ hashFiles('scripts/flatpak.yaml') }}
verbose: true
arch: ${{ matrix.arch }}
build-deb:
strategy:
fail-fast: false
matrix:
release: [ switchroot-bionic, ubuntu-focal, kylin-v10 ]
runs-on: ubuntu-latest
if: ${{ inputs.deb }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
if: ${{ matrix.release != 'ubuntu-focal' }}
uses: docker/setup-qemu-action@v3
- name: Download deps
run: curl -sSL https://github.com/dragonflylee/switchfin/releases/download/switch-portlibs/${{ matrix.release }}.tar.gz | tar zxf -
- name: Build deb
run: docker run --rm -u $(id -u):$(id -g) -v $PWD:/opt -w /opt -e VERSION_BUILD=${{ github.run_number }} dragonflylee/build:${{ matrix.release }} bash scripts/deb/${{ matrix.release }}/build.sh
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-${{ matrix.release }}-${{ steps.vars.outputs.sha_short }}
path: Switchfin-*.deb
build-macos:
runs-on: macos-12
if: ${{ inputs.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.11"
cmake: -DUSE_BOOST_FILESYSTEM=ON
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-ffmpeg7-mpv36-${{ matrix.tag }}.tar.gz | tar zxf - -C /tmp
- name: Build App
env:
DYLD_LIBRARY_PATH: /tmp/lib
run: |
cmake -B build ${{ matrix.cmake }} \
-DCMAKE_PREFIX_PATH=/tmp \
-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
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 }}.dmg "dist/"
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-macos-${{ matrix.tag }}-${{ steps.vars.outputs.sha_short }}
path: Switchfin-*.dmg
build-mingw:
if: ${{ inputs.mingw64 == true || github.event_name != 'workflow_dispatch'}}
strategy:
fail-fast: false
matrix:
include:
- { arch: x64, driver: d3d11, msystem: MINGW64, cmake: "-DUSE_D3D11=ON" }
- { arch: x86, driver: opengl, msystem: MINGW32, cmake: "-DUSE_GL2=ON" }
arch: [ x64, x86 ]
runs-on: windows-latest
env:
MSYSTEM: ${{ matrix.msystem }}
MSYS2_PATH_TYPE: inherit
defaults:
run:
shell: C:\shells\msys2bash.cmd {0}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependency
run: |
for pkg in glfw-3.5.0-1 curl-8.7.1-1 mpv-0.36.0-4 libwebp-1.4.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
pacman -S --needed --noconfirm \
${MINGW_PACKAGE_PREFIX}-cc \
${MINGW_PACKAGE_PREFIX}-ninja unzip
curl -sLO https://github.com/rainers/cv2pdb/releases/download/v0.52/cv2pdb-0.52.zip
unzip cv2pdb-0.52.zip cv2pdb64.exe -d /usr/bin
- if: matrix.arch == 'x86'
name: Config Editbin
shell: powershell
run: |
$vcvarsall_path = vswhere.exe -latest -products * -find "VC\Auxiliary\Build\vcvarsall.bat"
$cc1_path = Get-ChildItem -Path "C:\msys64\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
run: |
cmake -B build_mingw -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPLATFORM_DESKTOP=ON \
-DWIN32_TERMINAL=OFF \
-DZLIB_USE_STATIC_LIBS=ON \
-DUSE_SYSTEM_GLFW=ON \
-DUSE_LIBROMFS=ON \
-DVERSION_BUILD=${{ github.run_number }} ${{ matrix.cmake }}
cmake --build build_mingw
cv2pdb64 build_mingw/Switchfin.exe
cp -a README.md ${MINGW_PREFIX}/bin/libmpv-2.dll build_mingw
- name: Set outputs
id: vars
run: echo "sha_short=${{ matrix.arch }}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-windows-${{ steps.vars.outputs.sha_short }}
path: |
build_mingw/Switchfin.exe
build_mingw/Switchfin.pdb
build_mingw/libmpv-2.dll
build_mingw/README.md
build-msvc:
runs-on: windows-latest
if: ${{ inputs.msvc }}
strategy:
fail-fast: false
matrix:
arch: [ x64 ]
steps:
- name: Install xmake
shell: powershell
run: |
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache xmake packages
uses: actions/cache@v3
with:
key: ${{ runner.os }}-{{ matrix.arch }}-xmake
path: |
${{ runner.temp }}/.xmake/packages
- name: Build
shell: powershell
run: |
$env:path+=";$env:USERPROFILE\xmake"
$env:XMAKE_GLOBALDIR="${{ runner.temp }}"
xmake config -c -y -a ${{ matrix.arch }}
xmake build -y
cd build\windows\${{ matrix.arch }}\release
7z a -mx=9 "$env:GITHUB_WORKSPACE\Switchfin-${{ matrix.arch }}-msvc.7z" *
- name: Set outputs
id: vars
shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: actions/upload-artifact@v4
with:
name: Switchfin-msvc-${{ matrix.arch }}-${{ steps.vars.outputs.sha_short }}
path: Switchfin-*.7z