mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-05 18:01:56 +02:00
391 lines
12 KiB
YAML
391 lines
12 KiB
YAML
# This workflow will build a Java project with Gradle
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
|
|
|
name: SlimeVR Server
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
create:
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Get tags
|
|
run: git fetch --tags origin --recurse-submodules=no --force
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'adopt'
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4
|
|
|
|
- run: mkdir ./gui/dist && touch ./gui/dist/somefile
|
|
shell: bash
|
|
|
|
- name: Check code formatting
|
|
run: ./gradlew spotlessCheck
|
|
|
|
- name: Test with Gradle
|
|
run: ./gradlew test
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Get tags
|
|
run: git fetch --tags origin --recurse-submodules=no --force
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'adopt'
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4
|
|
|
|
- name: Build with Gradle
|
|
run: ./gradlew shadowJar
|
|
|
|
- name: Upload the Server JAR as a Build Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
# Artifact name
|
|
name: 'SlimeVR-Server' # optional, default is artifact
|
|
# A file, directory or wildcard pattern that describes what to upload
|
|
path: server/desktop/build/libs/slimevr.jar
|
|
|
|
- name: Upload to draft release
|
|
uses: softprops/action-gh-release@v2
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
draft: true
|
|
generate_release_notes: true
|
|
files: |
|
|
server/desktop/build/libs/slimevr.jar
|
|
|
|
bundle-android:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Get tags
|
|
run: git fetch --tags origin --recurse-submodules=no --force
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'adopt'
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.node-version'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
|
|
- name: Build
|
|
env:
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
run: cd gui && pnpm run build
|
|
|
|
- name: Build with Gradle
|
|
run: ./gradlew :server:android:assembleDebug
|
|
|
|
- name: Upload the Android Build Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
# Artifact name
|
|
name: 'SlimeVR-Android' # optional, default is artifact
|
|
# A file, directory or wildcard pattern that describes what to upload
|
|
path: server/android/build/outputs/apk/*
|
|
|
|
- name: Prepare for release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
cp server/android/build/outputs/apk/debug/android-debug.apk ./SlimeVR-android.apk
|
|
|
|
- name: Upload to draft release
|
|
uses: softprops/action-gh-release@v2
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
draft: true
|
|
generate_release_notes: true
|
|
files: |
|
|
./SlimeVR-android.apk
|
|
|
|
bundle-linux:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, ubuntu-24.04-arm]
|
|
runs-on: ${{ matrix.os }}
|
|
needs: [build, test]
|
|
if: contains(fromJSON('["workflow_dispatch", "create"]'), github.event_name)
|
|
|
|
env:
|
|
BUILD_ARCH: ${{ endsWith(matrix.os, 'arm') && 'aarch64' || 'amd64' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: 'SlimeVR-Server'
|
|
path: server/desktop/build/libs/
|
|
|
|
- name: Set up Linux dependencies
|
|
uses: awalsh128/cache-apt-pkgs-action@v1.5.0
|
|
with:
|
|
packages: |
|
|
build-essential curl wget file libssl-dev libgtk-3-dev libappindicator3-dev librsvg2-dev
|
|
# Increment to invalidate the cache
|
|
version: ${{ format('v1.0-{0}', env.BUILD_ARCH) }}
|
|
# Enables a workaround to attempt to run pre and post install scripts
|
|
execute_install_scripts: true
|
|
# Disables uploading logs as a build artifact
|
|
debug: false
|
|
|
|
- name: Set up specific Linux versioned dependencies
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install -y \
|
|
libwebkit2gtk-4.1-0=2.44.0-2 \
|
|
libwebkit2gtk-4.1-dev=2.44.0-2 \
|
|
libjavascriptcoregtk-4.1-0=2.44.0-2 \
|
|
libjavascriptcoregtk-4.1-dev=2.44.0-2 \
|
|
gir1.2-javascriptcoregtk-4.1=2.44.0-2 \
|
|
gir1.2-webkit2-4.1=2.44.0-2;
|
|
|
|
- name: Cache cargo dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.node-version'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
|
|
- name: Build
|
|
env:
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
run: pnpm run tauri build --config $( ./gui/scripts/gitversion.mjs )
|
|
|
|
- name: Make GUI tarball
|
|
run: |
|
|
tar czf slimevr-gui-dist.tar.gz -C gui/dist/ .
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: matrix.os == 'ubuntu-latest'
|
|
with:
|
|
name: SlimeVR-GUI-Dist
|
|
path: ./slimevr-gui-dist.tar.gz
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ format('SlimeVR-GUI-Deb-{0}', env.BUILD_ARCH) }}
|
|
path: target/release/bundle/deb/slimevr*.deb
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ format('SlimeVR-GUI-AppImage-{0}', env.BUILD_ARCH) }}
|
|
path: target/release/bundle/appimage/slimevr*.AppImage
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ format('SlimeVR-GUI-RPM-{0}', env.BUILD_ARCH) }}
|
|
path: target/release/bundle/rpm/slimevr*.rpm
|
|
|
|
- name: Prepare for release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
cp target/release/bundle/appimage/slimevr*.AppImage "./SlimeVR-$BUILD_ARCH.appimage"
|
|
cp target/release/bundle/deb/slimevr*.deb "./SlimeVR-$BUILD_ARCH.deb"
|
|
cp target/release/bundle/rpm/slimevr*.rpm "./SlimeVR-$BUILD_ARCH.rpm"
|
|
|
|
- name: Upload to draft release
|
|
uses: softprops/action-gh-release@v2
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
draft: true
|
|
generate_release_notes: true
|
|
files: |
|
|
./slimevr-gui-dist.tar.gz
|
|
./SlimeVR-*.appimage
|
|
./SlimeVR-*.deb
|
|
./SlimeVR-*.rpm
|
|
|
|
bundle-mac:
|
|
runs-on: macos-latest
|
|
needs: [build, test]
|
|
if: contains(fromJSON('["workflow_dispatch", "create"]'), github.event_name)
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: 'SlimeVR-Server'
|
|
path: server/desktop/build/libs/
|
|
|
|
- name: Cache cargo dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.node-version'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
rustup target add x86_64-apple-darwin
|
|
pnpm i
|
|
|
|
- name: Build
|
|
env:
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
NODE_OPTIONS: --max-old-space-size=4096
|
|
run: pnpm run tauri build --target universal-apple-darwin --config $( ./gui/scripts/gitversion.mjs )
|
|
|
|
- name: Modify Application
|
|
run: |
|
|
cd target/universal-apple-darwin/release/bundle/macos/slimevr.app/Contents/MacOS
|
|
cp $( git rev-parse --show-toplevel )/server/desktop/build/libs/slimevr.jar ./
|
|
cd ../../../
|
|
/usr/libexec/PlistBuddy -c "Set :CFBundleDisplayName SlimeVR" slimevr.app/Contents/Info.plist
|
|
/usr/libexec/PlistBuddy -c "Set :CFBundleName SlimeVR" slimevr.app/Contents/Info.plist
|
|
codesign --sign - --deep --force slimevr.app
|
|
mv slimevr.app SlimeVR.app
|
|
cd ../dmg/
|
|
./bundle_dmg.sh --volname SlimeVR --icon slimevr 180 170 --app-drop-link 480 170 \
|
|
--window-size 660 400 --hide-extension ../macos/SlimeVR.app \
|
|
--volicon ../macos/SlimeVR.app/Contents/Resources/icon.icns --skip-jenkins \
|
|
--eula ../../../../../LICENSE-MIT slimevr.dmg ../macos/SlimeVR.app
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: SlimeVR-GUI-MacApp
|
|
path: target/universal-apple-darwin/release/bundle/macos/SlimeVR*.app
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: SlimeVR-GUI-MacDmg
|
|
path: target/universal-apple-darwin/release/bundle/dmg/slimevr.dmg
|
|
|
|
- name: Prepare for release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
cp target/universal-apple-darwin/release/bundle/dmg/slimevr.dmg ./SlimeVR-mac.dmg
|
|
|
|
- name: Upload to draft release
|
|
uses: softprops/action-gh-release@v2
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
draft: true
|
|
generate_release_notes: true
|
|
files: |
|
|
./SlimeVR-mac.dmg
|
|
|
|
bundle-windows:
|
|
strategy:
|
|
matrix:
|
|
os: [windows-latest, windows-11-arm]
|
|
runs-on: ${{ matrix.os }}
|
|
needs: [build, test]
|
|
if: contains(fromJSON('["workflow_dispatch", "create"]'), github.event_name)
|
|
|
|
env:
|
|
BUILD_ARCH: ${{ endsWith(matrix.os, 'arm') && 'win-aarch64' || 'win64' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: 'SlimeVR-Server'
|
|
path: server/desktop/build/libs/
|
|
|
|
- if: matrix.os == 'windows-11-arm'
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
cache: false
|
|
|
|
- name: Cache cargo dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.node-version'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
shell: bash
|
|
run: pnpm i
|
|
|
|
- name: Build
|
|
shell: bash
|
|
env:
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
run: pnpm run skipbundler --config $( ./gui/scripts/gitversion.mjs )
|
|
|
|
- name: Bundle to zips
|
|
shell: bash
|
|
run: |
|
|
mkdir SlimeVR
|
|
cp gui/src-tauri/icons/icon.ico ./SlimeVR/run.ico
|
|
cp server/desktop/build/libs/slimevr.jar ./SlimeVR/slimevr.jar
|
|
cp server/core/resources/* ./SlimeVR/
|
|
cp target/release/slimevr.exe ./SlimeVR/
|
|
7z a -tzip "SlimeVR-$BUILD_ARCH.zip" ./SlimeVR/
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ format('SlimeVR-GUI-Windows-{0}', env.BUILD_ARCH) }}
|
|
path: ./SlimeVR*.zip
|
|
|
|
- name: Upload to draft release
|
|
uses: softprops/action-gh-release@v2
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
draft: true
|
|
generate_release_notes: true
|
|
files: ./SlimeVR-*.zip
|