Add DMG wrapping to CI

This commit is contained in:
DaCool
2022-06-09 15:55:45 +00:00
committed by Sheepit Renderfarm
parent 3c5b3aba99
commit a5cce0ecc6
10 changed files with 89 additions and 1 deletions

2
.gitattributes vendored
View File

@@ -4,3 +4,5 @@
*.png binary
*.sfx binary
*.zip binary
*.tar binary
*.gz binary

View File

@@ -30,7 +30,7 @@ test:
script:
- ./gradlew check
wrap-client:
exe-wrap:
stage: wrap
image: debian:stable-slim
variables:
@@ -52,3 +52,31 @@ wrap-client:
paths:
- ./sheepit-wrapper.exe
expire_in: 1 week
dmg-x64-wrap:
stage: wrap
image: debian:stable-slim
variables:
ARCH: "Intel-x64"
JRETAR: "OpenJDK11U-jre_x64_mac_hotspot_11.0.15_10.tar.gz" # Taken from https://adoptium.net/releases.html?variant=openjdk11&jvmVariant=hotspot
script:
- dmg-wrapper/ci-build-dmg.sh $ARCH $JRETAR
artifacts:
name: "$CI_COMMIT_REF_NAME-sheepit-artifact-$ARCH-dmg"
paths:
- ./dmg-wrapper/SheepIt-$ARCH.dmg
expire_in: 1 week
dmg-arm-wrap:
stage: wrap
image: debian:stable-slim
variables:
ARCH: "Apple-ARM"
JRETAR: "OpenJDK17U-jre_aarch64_mac_hotspot_17.0.2_8.tar.gz" # Taken from https://adoptium.net/de/temurin/releases/?variant=openjdk17&jvmVariant=hotspot
script:
- dmg-wrapper/ci-build-dmg.sh $ARCH $JRETAR
artifacts:
name: "$CI_COMMIT_REF_NAME-sheepit-artifact-$ARCH-dmg"
paths:
- ./dmg-wrapper/SheepIt-$ARCH.dmg
expire_in: 1 week

11
dmg-wrapper/SheepIt-Run.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail # Unofficial strict mode, see http://redsymbol.net/articles/unofficial-bash-strict-mode/
cd "$(dirname "$(readlink -f "$0")")"
# see https://stackoverflow.com/questions/3349105/how-can-i-set-the-current-working-directory-to-the-directory-of-the-script-in-ba
echo "Please only pin the first window - the launcher to the Dock"
echo "============================="
echo "Loading and launching SheepIt"
nohup "$BIN" -Xdock:icon=./$APP.png -Djna.nosys=true -jar "$JAR" &>/dev/null & disown
osascript -e 'tell application "Terminal" to close (every window whose name contains "SheepIt-Run.sh")' &
exit 0

BIN
dmg-wrapper/SheepIt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
dmg-wrapper/SheepIt.tar.gz Normal file

Binary file not shown.

View File

@@ -0,0 +1,11 @@
#!/bin/bash
sudo apt-get install git cmake build-essential zlib1g-dev
git clone https://github.com/fanquake/libdmg-hfsplus.git
cd libdmg-hfsplus
cmake . -B build
make -C build/dmg -j8
mv build/dmg/dmg ..
cd ..
rm -rf libdmg-hfsplus/

36
dmg-wrapper/ci-build-dmg.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
set -euo pipefail # Unofficial strict mode, see http://redsymbol.net/articles/unofficial-bash-strict-mode/
cd "$(dirname "$(readlink -f "$0")")"
# see https://stackoverflow.com/questions/3349105/how-can-i-set-the-current-working-directory-to-the-directory-of-the-script-in-ba
ARCH="$1"
JRETAR="$2"
APP="SheepIt"
DMG="$APP-$ARCH-raw.dmg"
FINAL="$APP-$ARCH.dmg"
BASE="$(pwd)"
BUILD="$BASE/build"
RES="$BUILD/SheepIt.app/Contents/Resources"
CL="$RES/client"
apt-get update
apt-get install -y --no-install-recommends genisoimage # Add dependencies
mkdir "$BUILD"
tar -axf "$APP.tar.gz" -C "$BUILD" # Extract base file structure + Platypus shell exec shim
tar -axf "$BASE/$JRETAR" -C "$RES" # Extracts the JRE into Resources folder
mkdir -p "$CL"
cp ../sheepit-client-all.jar "$CL/$APP.jar" # Copy client artifact to be packaged
cp "$BASE/$APP-Run.sh" "$CL"
cp "$BASE/$APP.png" "$CL"
cd "$CL"
ln -s "$(find ../ -name java)" $APP # We symlink java to make the title appearing in the dock to read "SheepIt", not "java"
cd "$BASE"
genisoimage -D -V $APP -no-pad -r -apple -o "$DMG" "$BUILD"
./dmg "$DMG" "$FINAL" # Use libdmg based dmg tool to compress the dmg (and also make it read-only)

BIN
dmg-wrapper/dmg Executable file

Binary file not shown.