Sync server constants with firmware #4848
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
# 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@v3 | |
- 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@v3 | |
- 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/* | |
- 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/* | |
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@v3 | |
- uses: pnpm/action-setup@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.node-version' | |
cache: 'pnpm' | |
- name: Build GUI | |
run: | | |
pnpm i | |
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: | |
runs-on: ubuntu-22.04 | |
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: Set up Linux dependencies | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: libgtk-3-dev webkit2gtk-4.1 libappindicator3-dev librsvg2-dev patchelf libfuse2 | |
# Increment to invalidate the cache | |
version: 1.0 | |
# 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: Cache cargo dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "ubuntu-22.04" | |
- uses: pnpm/action-setup@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.node-version' | |
cache: 'pnpm' | |
- name: Build | |
run: | | |
pnpm i | |
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 | |
with: | |
name: SlimeVR-GUI-Dist | |
path: ./slimevr-gui-dist.tar.gz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: SlimeVR-GUI-Deb | |
path: target/release/bundle/deb/slimevr*.deb | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: SlimeVR-GUI-AppImage | |
path: target/release/bundle/appimage/slimevr*.AppImage | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: SlimeVR-GUI-RPM | |
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-amd64.appimage | |
cp target/release/bundle/deb/slimevr*.deb ./SlimeVR-amd64.deb | |
cp target/release/bundle/rpm/slimevr*.rpm ./SlimeVR-amd64.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-amd64.appimage | |
./SlimeVR-amd64.deb | |
./SlimeVR-amd64.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 | |
with: | |
shared-key: "macos-latest" | |
- uses: pnpm/action-setup@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.node-version' | |
cache: 'pnpm' | |
- name: Build | |
run: | | |
rustup target add x86_64-apple-darwin | |
pnpm i | |
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: | |
runs-on: windows-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 | |
with: | |
shared-key: "windows-latest" | |
- uses: pnpm/action-setup@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.node-version' | |
cache: 'pnpm' | |
- name: Build | |
shell: bash | |
run: | | |
pnpm i | |
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-win64.zip ./SlimeVR/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: SlimeVR-GUI-Windows | |
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-win64.zip |