added back build-linux workflow

This commit is contained in:
JuiceyDev 2026-03-10 09:43:30 +01:00
parent 1c67f134b2
commit 71f542a860

View file

@ -1,5 +1,6 @@
name: Build Linux Release name: Build Linux Release
# document this later, while that, put both release & debug in parallel
# debug still always comes second and that's sad.
on: on:
push: push:
paths: paths:
@ -23,10 +24,10 @@ on:
- '.github/workflows/build-linux.yml' - '.github/workflows/build-linux.yml'
jobs: jobs:
build-linux: build-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
concurrency: concurrency:
group: build-linux-${{ github.ref }} group: build-linux-release-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
steps: steps:
- name: Checkout repository - name: Checkout repository
@ -35,8 +36,7 @@ jobs:
- name: Install system dependencies - name: Install system dependencies
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y build-essential python3 python3-pip python3-setuptools libgl1-mesa-dev libglu1-mesa-dev libglfw3-dev libpng-dev pkg-config clang lld ccache libssl-dev sudo apt-get install -y build-essential python3 python3-pip python3-setuptools libgl1-mesa-dev libglu1-mesa-dev libglfw3-dev libpng-dev pkg-config clang lld ccache libssl-dev patchelf
# Set a reasonable ccache size
ccache -M 5G || true ccache -M 5G || true
- name: Setup Python - name: Setup Python
@ -50,7 +50,7 @@ jobs:
path: ~/.cache/pip path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('.github/workflows/build-linux.yml') }} key: ${{ runner.os }}-pip-${{ hashFiles('.github/workflows/build-linux.yml') }}
- name: Install Meson and Ninja (pip) - name: Install Meson and Ninja
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install meson ninja pip install meson ninja
@ -59,7 +59,7 @@ jobs:
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ~/.ccache path: ~/.ccache
key: ${{ runner.os }}-ccache-${{ hashFiles('**/meson.build') }} key: ${{ runner.os }}-ccache-release-${{ hashFiles('**/meson.build') }}
- name: Restore meson cache - name: Restore meson cache
uses: actions/cache@v4 uses: actions/cache@v4
@ -74,19 +74,8 @@ jobs:
CCACHE_DIR: ${{ runner.temp }}/ccache CCACHE_DIR: ${{ runner.temp }}/ccache
run: | run: |
mkdir -p "$CCACHE_DIR" mkdir -p "$CCACHE_DIR"
export CCACHE_DIR="$CCACHE_DIR"
meson setup build_meson --wipe --buildtype=release meson setup build_meson --wipe --buildtype=release
- name: Configure Meson (debug)
env:
CC: "ccache clang"
CXX: "ccache clang++"
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
mkdir -p "$CCACHE_DIR"
export CCACHE_DIR="$CCACHE_DIR"
meson setup build_debug --wipe --buildtype=debug
- name: Build with Ninja - name: Build with Ninja
env: env:
CC: "ccache clang" CC: "ccache clang"
@ -94,21 +83,8 @@ jobs:
CCACHE_DIR: ${{ runner.temp }}/ccache CCACHE_DIR: ${{ runner.temp }}/ccache
run: | run: |
export CCACHE_DIR="${{ runner.temp }}/ccache" export CCACHE_DIR="${{ runner.temp }}/ccache"
# Use all available cores for faster parallel builds
ninja -C build_meson -j$(nproc) -v ninja -C build_meson -j$(nproc) -v
- name: Build Debug with Ninja
env:
CC: "ccache clang"
CXX: "ccache clang++"
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
export CCACHE_DIR="${{ runner.temp }}/ccache"
ninja -C build_debug -j$(nproc) -v
- name: Install patchelf
run: sudo apt-get install -y patchelf
- name: Bundle executable + libraries - name: Bundle executable + libraries
env: env:
GITHUB_SHA: ${{ github.sha }} GITHUB_SHA: ${{ github.sha }}
@ -125,12 +101,8 @@ jobs:
BUNDLE=out/minecraft-client-linux-${SHORT_SHA} BUNDLE=out/minecraft-client-linux-${SHORT_SHA}
mkdir -p "$BUNDLE/lib" mkdir -p "$BUNDLE/lib"
# Copy the binary
cp "$EXE_PATH" "$BUNDLE/Minecraft.Client" cp "$EXE_PATH" "$BUNDLE/Minecraft.Client"
# Collect non-system shared library dependencies and copy them in.
# Exclude glibc/libstdc++/libgcc — these are ABI-specific and must
# come from the user's system, not from the build runner.
ldd "$EXE_PATH" \ ldd "$EXE_PATH" \
| awk '/=>/ { print $3 }' \ | awk '/=>/ { print $3 }' \
| grep -v '^(' \ | grep -v '^(' \
@ -140,18 +112,10 @@ jobs:
[ -f "$lib" ] && cp "$lib" "$BUNDLE/lib/" || true [ -f "$lib" ] && cp "$lib" "$BUNDLE/lib/" || true
done done
# Patch the binary RPATH so it finds libs in ./lib at runtime
patchelf --set-rpath '$ORIGIN/lib' "$BUNDLE/Minecraft.Client" patchelf --set-rpath '$ORIGIN/lib' "$BUNDLE/Minecraft.Client"
# Write a launcher script
cat > "$BUNDLE/run.sh" << 'RUNEOF' cat > "$BUNDLE/run.sh" << 'RUNEOF'
#!/usr/bin/env bash #!/usr/bin/env bash
# 4JCraft Linux launcher
# -------------------------------------------------------------------
# IMPORTANT: Before running, copy the "Common" assets folder from
# https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly
# (LCEWindows64.zip → extract → copy "Common" next to this script)
# -------------------------------------------------------------------
DIR="$(cd "$(dirname "$0")" && pwd)" DIR="$(cd "$(dirname "$0")" && pwd)"
if [ ! -d "$DIR/Common" ]; then if [ ! -d "$DIR/Common" ]; then
echo "ERROR: Missing 'Common' assets folder." echo "ERROR: Missing 'Common' assets folder."
@ -165,7 +129,6 @@ jobs:
RUNEOF RUNEOF
chmod +x "$BUNDLE/run.sh" chmod +x "$BUNDLE/run.sh"
# Write a README
cat > "$BUNDLE/README.txt" << 'EOF' cat > "$BUNDLE/README.txt" << 'EOF'
4JCraft Linux Build 4JCraft Linux Build
=================== ===================
@ -185,6 +148,74 @@ jobs:
echo "Bundle ready: $BUNDLE" echo "Bundle ready: $BUNDLE"
ls -lh "$BUNDLE" "$BUNDLE/lib" ls -lh "$BUNDLE" "$BUNDLE/lib"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: minecraft-client-linux-${{ github.sha }}
path: out/minecraft-client-linux-*/
retention-days: 7
build-debug:
runs-on: ubuntu-latest
concurrency:
group: build-linux-debug-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3 python3-pip python3-setuptools libgl1-mesa-dev libglu1-mesa-dev libglfw3-dev libpng-dev pkg-config clang lld ccache libssl-dev patchelf
ccache -M 5G || true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('.github/workflows/build-linux.yml') }}
- name: Install Meson and Ninja
run: |
python -m pip install --upgrade pip
pip install meson ninja
- name: Restore ccache
uses: actions/cache@v4
with:
path: ~/.ccache
key: ${{ runner.os }}-ccache-debug-${{ hashFiles('**/meson.build') }}
- name: Restore meson cache
uses: actions/cache@v4
with:
path: ~/.cache/meson
key: ${{ runner.os }}-meson-${{ hashFiles('**/meson.build') }}
- name: Configure Meson
env:
CC: "ccache clang"
CXX: "ccache clang++"
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
mkdir -p "$CCACHE_DIR"
meson setup build_debug --wipe --buildtype=debug
- name: Build with Ninja
env:
CC: "ccache clang"
CXX: "ccache clang++"
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
export CCACHE_DIR="${{ runner.temp }}/ccache"
ninja -C build_debug -j$(nproc) -v
- name: Bundle debug executable + libraries - name: Bundle debug executable + libraries
env: env:
GITHUB_SHA: ${{ github.sha }} GITHUB_SHA: ${{ github.sha }}
@ -201,10 +232,8 @@ jobs:
BUNDLE=out/minecraft-client-linux-${SHORT_SHA}-debug BUNDLE=out/minecraft-client-linux-${SHORT_SHA}-debug
mkdir -p "$BUNDLE/lib" mkdir -p "$BUNDLE/lib"
# Copy the binary
cp "$EXE_PATH" "$BUNDLE/Minecraft.Client.debug" cp "$EXE_PATH" "$BUNDLE/Minecraft.Client.debug"
# Collect non-system shared library dependencies and copy them in.
ldd "$EXE_PATH" \ ldd "$EXE_PATH" \
| awk '/=>/ { print $3 }' \ | awk '/=>/ { print $3 }' \
| grep -v '^(' \ | grep -v '^(' \
@ -214,18 +243,14 @@ jobs:
[ -f "$lib" ] && cp "$lib" "$BUNDLE/lib/" || true [ -f "$lib" ] && cp "$lib" "$BUNDLE/lib/" || true
done done
# Patch the binary RPATH so it finds libs in ./lib at runtime
patchelf --set-rpath '$ORIGIN/lib' "$BUNDLE/Minecraft.Client.debug" patchelf --set-rpath '$ORIGIN/lib' "$BUNDLE/Minecraft.Client.debug"
# Keep a copy of the unstripped debug binary (symbols are already present in debug build)
echo "Debug bundle ready: $BUNDLE" echo "Debug bundle ready: $BUNDLE"
ls -lh "$BUNDLE" "$BUNDLE/lib" ls -lh "$BUNDLE" "$BUNDLE/lib"
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: minecraft-client-linux-${{ github.sha }} name: minecraft-client-linux-${{ github.sha }}-debug
path: | path: out/minecraft-client-linux-*-debug/
out/minecraft-client-linux-*/ retention-days: 7
out/minecraft-client-linux-*-debug/
retention-days: 7