forked from Lime3DS/lime3ds-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build ".nro" Nintendo Switch homebrew.
- Loading branch information
Showing
1 changed file
with
56 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,272 +1,66 @@ | ||
name: lime-build | ||
name: Build Lime3DS | ||
|
||
on: | ||
push: | ||
branches: [ "*" ] | ||
tags: [ "*" ] | ||
branches: | ||
- main | ||
pull_request: | ||
branches: [ master ] | ||
branches: | ||
- main | ||
|
||
jobs: | ||
source: | ||
if: ${{ !github.head_ref }} | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Pack | ||
run: ./.ci/source.sh | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: source | ||
path: artifacts/ | ||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: ["appimage", "fresh"] | ||
container: | ||
image: opensauce04/lime3ds-build:latest | ||
options: -u 1001 | ||
env: | ||
CCACHE_DIR: ${{ github.workspace }}/.ccache | ||
CCACHE_COMPILERCHECK: content | ||
CCACHE_SLOPPINESS: time_macros | ||
OS: linux | ||
TARGET: ${{ matrix.target }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Set up cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.CCACHE_DIR }} | ||
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.target }}- | ||
- name: Build | ||
run: ./.ci/linux.sh | ||
- name: Pack | ||
run: ./.ci/pack.sh | ||
if: ${{ matrix.target == 'appimage' }} | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ matrix.target == 'appimage' }} | ||
with: | ||
name: ${{ env.OS }}-${{ env.TARGET }} | ||
path: artifacts/ | ||
macos: | ||
runs-on: ${{ (matrix.target == 'x86_64' && 'macos-13') || 'macos-14' }} | ||
strategy: | ||
matrix: | ||
target: ["x86_64", "arm64"] | ||
env: | ||
CCACHE_DIR: ${{ github.workspace }}/.ccache | ||
CCACHE_COMPILERCHECK: content | ||
CCACHE_SLOPPINESS: time_macros | ||
OS: macos | ||
TARGET: ${{ matrix.target }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Set up cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.CCACHE_DIR }} | ||
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.target }}- | ||
- name: Setup XCode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: latest-stable | ||
- name: Install tools | ||
run: brew install ccache ninja spirv-tools | ||
- name: Build | ||
run: ./.ci/macos.sh | ||
- name: Prepare outputs for caching | ||
run: mv build/bundle $OS-$TARGET | ||
- name: Cache outputs for universal build | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ${{ env.OS }}-${{ env.TARGET }} | ||
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
macos-universal: | ||
runs-on: macos-14 | ||
needs: macos | ||
env: | ||
OS: macos | ||
TARGET: universal | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download x86_64 build from cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ${{ env.OS }}-x86_64 | ||
key: ${{ runner.os }}-x86_64-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
fail-on-cache-miss: true | ||
- name: Download ARM64 build from cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ${{ env.OS }}-arm64 | ||
key: ${{ runner.os }}-arm64-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
fail-on-cache-miss: true | ||
- name: Create universal app | ||
run: ./.ci/macos-universal.sh | ||
env: | ||
ARTIFACTS: ${{ env.OS }}-x86_64 ${{ env.OS }}-arm64 | ||
- name: Pack | ||
run: ./.ci/pack.sh | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.OS }}-${{ env.TARGET }} | ||
path: artifacts/ | ||
windows: | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
target: ["msvc", "msys2"] | ||
defaults: | ||
run: | ||
shell: ${{ (matrix.target == 'msys2' && 'msys2') || 'bash' }} {0} | ||
env: | ||
CCACHE_DIR: ${{ github.workspace }}/.ccache | ||
CCACHE_COMPILERCHECK: content | ||
CCACHE_SLOPPINESS: time_macros | ||
OS: windows | ||
TARGET: ${{ matrix.target }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Set up cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.CCACHE_DIR }} | ||
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.target }}- | ||
- name: Set up MSVC | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
if: ${{ matrix.target == 'msvc' }} | ||
- name: Install extra tools (MSVC) | ||
run: choco install ccache ninja wget | ||
if: ${{ matrix.target == 'msvc' }} | ||
- name: Set up Vulkan SDK (MSVC) | ||
uses: humbletim/[email protected] | ||
if: ${{ matrix.target == 'msvc' }} | ||
with: | ||
vulkan-query-version: latest | ||
vulkan-components: SPIRV-Tools | ||
vulkan-use-cache: true | ||
- name: Set up MSYS2 | ||
uses: msys2/setup-msys2@v2 | ||
if: ${{ matrix.target == 'msys2' }} | ||
with: | ||
msystem: clang64 | ||
update: true | ||
install: git make p7zip | ||
pacboy: >- | ||
toolchain:p ccache:p cmake:p ninja:p spirv-tools:p | ||
qt6-base:p qt6-multimedia:p qt6-multimedia-wmf:p qt6-tools:p qt6-translations:p | ||
- name: Install NSIS | ||
run: | | ||
Invoke-WebRequest https://deac-riga.dl.sourceforge.net/project/nsis/NSIS%203/3.10/nsis-3.10-setup.exe?viasf=1 -OutFile C:\WINDOWS\Temp\nsis-3.10-setup.exe | ||
Invoke-Expression "& C:\WINDOWS\Temp\nsis-3.10-setup.exe \S" | ||
shell: pwsh | ||
- name: Disable line ending translation | ||
run: git config --global core.autocrlf input | ||
- name: Build | ||
run: ./.ci/windows.sh | ||
- name: Generate installer | ||
if: ${{ github.ref_type == 'tag' }} | ||
run: | | ||
cd src\installer | ||
"C:\Program Files (x86)\NSIS\makensis.exe" /DPRODUCT_VARIANT=${{ matrix.target }} /DPRODUCT_VERSION=${{ github.ref_name }} lime3ds.nsi | ||
mkdir bin | ||
move /y *.exe bin\ | ||
shell: cmd | ||
- name: Pack | ||
run: ./.ci/pack.sh | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.OS }}-${{ env.TARGET }} | ||
path: artifacts/ | ||
android: | ||
runs-on: ubuntu-latest | ||
env: | ||
CCACHE_DIR: ${{ github.workspace }}/.ccache | ||
CCACHE_COMPILERCHECK: content | ||
CCACHE_SLOPPINESS: time_macros | ||
OS: android | ||
TARGET: universal | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Set up cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
${{ env.CCACHE_DIR }} | ||
key: ${{ runner.os }}-android-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-android- | ||
- name: Set tag name | ||
run: | | ||
if [[ "$GITHUB_REF_TYPE" == "tag" ]]; then | ||
echo "GIT_TAG_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV | ||
fi | ||
echo $GIT_TAG_NAME | ||
- name: Deps | ||
run: | | ||
sudo add-apt-repository -y ppa:theofficialgman/gpu-tools | ||
sudo apt-get update -y | ||
sudo apt-get install ccache apksigner -y | ||
- name: Build | ||
run: JAVA_HOME=$JAVA_HOME_17_X64 ./.ci/android.sh | ||
env: | ||
ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }} | ||
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | ||
ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }} | ||
- name: Pack | ||
run: ../../../.ci/pack.sh | ||
working-directory: src/android/app | ||
env: | ||
UNPACKED: 1 | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.OS }}-${{ env.TARGET }} | ||
path: src/android/app/artifacts/ | ||
release: | ||
permissions: | ||
contents: write | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Build Lime3DS | ||
run: | | ||
mkdir -p build | ||
cd build | ||
cmake .. | ||
make | ||
- name: Upload Lime3DS artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: lime3ds | ||
path: build/lime3ds | ||
|
||
switch-build: | ||
runs-on: ubuntu-latest | ||
needs: [windows, linux, macos-universal, android, source] | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
|
||
steps: | ||
- uses: actions/download-artifact@v4 | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: ${{ github.ref_name }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload artifacts | ||
uses: alexellis/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
asset_paths: '["./**/*.tar.*","./**/*.AppImage","./**/*.zip","./**/*.apk","./**/*.aab","./**/*.exe"]' | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up DevkitPro | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y devkitpro-pacman | ||
sudo dkp-pacman -S switch-dev | ||
- name: Build Nintendo Switch Homebrew | ||
run: | | ||
export DEVKITPRO=/opt/devkitpro | ||
export DEVKITARM=$DEVKITPRO/devkitARM | ||
export PATH=$PATH:$DEVKITARM/bin | ||
make -f Makefile.switch | ||
- name: Upload Nintendo Switch Homebrew artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: lime3ds-switch | ||
path: build/lime3ds.nro |