Linux bundling with the jar (#413)

This commit is contained in:
Uriel authored and GitHub committed 2022-12-25 03:06:28 +03:00
1 parent b912e0003a
commit f4e13f837b
6 files changed
+88 -21

No files matched your search

+7 -14
View File
@@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.os }}
@@ -31,7 +31,7 @@ jobs:
with:
submodules: recursive
- if: matrix.os == 'ubuntu-latest'
- if: matrix.os == 'ubuntu-20.04'
name: Set up Linux dependencies
run: |
sudo apt-get update
@@ -39,6 +39,8 @@ jobs:
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "tauri"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
@@ -49,7 +51,7 @@ jobs:
- name: Build
run: |
npm ci
npm run tauri build
npm run skipbundler
- if: matrix.os == 'windows-latest'
name: Upload a Build Artifact
@@ -65,15 +67,6 @@ jobs:
uses: actions/[email protected]
with:
# Artifact name
name: SlimeVR-GUI-Deb
name: SlimeVR-GUI-Linux
# A file, directory or wildcard pattern that describes what to upload
path: target/release/bundle/deb/slimevr*.deb
- if: matrix.os == 'ubuntu-latest'
name: Upload a Build Artifact
uses: actions/[email protected]
with:
# Artifact name
name: SlimeVR-GUI-AppImage
# A file, directory or wildcard pattern that describes what to upload
path: target/release/bundle/appimage/slimevr*.AppImage
path: target/release/slimevr
+59
View File
@@ -59,3 +59,62 @@ jobs:
name: "SlimeVR-Server" # optional, default is artifact
# A file, directory or wildcard pattern that describes what to upload
path: server/build/libs/*
bundle:
runs-on: ubuntu-20.04
needs: build
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: "SlimeVR-Server"
path: server/build/libs/
- name: Set up Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf libfuse2
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "tauri"
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Build
run: |
npm ci
npm run tauri build
- uses: actions/[email protected]
with:
name: SlimeVR-GUI-Deb
path: target/release/bundle/deb/slimevr*.deb
- name: Install appimage-builder
run: |
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod a+x appimagetool-x86_64.AppImage
sudo mv appimagetool-x86_64.AppImage /usr/local/bin/appimagetool
- name: Modify and Build AppImage
run: |
cd target/release/bundle/appimage
chmod a+x slimevr*.AppImage
./slimevr*.AppImage --appimage-extract
cp $( git rev-parse --show-toplevel )/server/build/libs/slimevr.jar squashfs-root/slimevr.jar
chmod 644 squashfs-root/slimevr.jar
appimagetool squashfs-root slimevr*.AppImage
- uses: actions/[email protected]
with:
name: SlimeVR-GUI-AppImage
path: target/release/bundle/appimage/slimevr*.AppImage
+1
View File
@@ -41,6 +41,7 @@
"start": "vite --force",
"build": "vite build",
"dev": "tauri dev",
"skipbundler": "tauri build -b none",
"tauri": "tauri",
"lint": "eslint src/**/*.{js,jsx,ts,tsx,json}",
"lint:fix": "eslint --fix src/**/*.{js,jsx,ts,tsx,json}",
+16 -6
View File
@@ -54,10 +54,7 @@ struct Cli {
}
fn is_valid_path(path: &PathBuf) -> bool {
// Might need to be changed in the future, at least for linux
let server_path = path.join("slimevr.jar");
return server_path.exists();
path.join("slimevr.jar").exists()
}
fn get_launch_path(cli: Cli) -> Option<PathBuf> {
@@ -67,16 +64,29 @@ fn get_launch_path(cli: Cli) -> Option<PathBuf> {
}
}
let mut path = env::current_dir().unwrap();
let path = env::current_dir().unwrap();
if is_valid_path(&path) {
return Some(path);
}
path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
if is_valid_path(&path) {
return Some(path);
}
let path = PathBuf::from("/usr/share/slimevr/");
if is_valid_path(&path) {
return Some(path);
}
// This is only for AppImage
if let Some(appimage) = env::var_os("APPDIR") {
let path = PathBuf::from(appimage);
if is_valid_path(&path) {
return Some(path);
}
}
None
}
+4 -1
View File
@@ -22,7 +22,10 @@
"shortDescription": "",
"longDescription": "",
"deb": {
"depends": []
"depends": ["openjdk-17-jre-headless"],
"files": {
"/usr/share/slimevr/slimevr.jar": "../../server/build/libs/slimevr.jar"
}
},
"macOS": {
"frameworks": [],
+1
View File
@@ -9,6 +9,7 @@
"scripts": {
"gui": "npm run update-solarxr && cd gui && npm run tauri dev",
"tauri": "cd gui && npm run tauri",
"skipbundler": "cd gui && npm run skipbundler",
"build": "npm run tauri build",
"update-solarxr": "cd solarxr-protocol && npm run build",
"prepare": "husky install && npm run update-solarxr && patch-package"