mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-06 05:03:36 +00:00
93 lines
2.8 KiB
YAML
93 lines
2.8 KiB
YAML
name: Build Linux Release
|
|
|
|
on:
|
|
push: {}
|
|
pull_request: {}
|
|
|
|
jobs:
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
concurrency:
|
|
group: build-linux-${{ 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 ccache
|
|
# Set a reasonable ccache size
|
|
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 (pip)
|
|
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-${{ 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"
|
|
export CCACHE_DIR="$CCACHE_DIR"
|
|
meson setup build_meson --wipe --buildtype=release
|
|
|
|
- name: Build with Ninja
|
|
env:
|
|
CC: "ccache clang"
|
|
CXX: "ccache clang++"
|
|
CCACHE_DIR: ${{ runner.temp }}/ccache
|
|
run: |
|
|
export CCACHE_DIR="${{ runner.temp }}/ccache"
|
|
# Use all available cores for faster parallel builds
|
|
ninja -C build_meson -j$(nproc) -v
|
|
|
|
- name: Package Linux executable as gzip
|
|
env:
|
|
GITHUB_SHA: ${{ github.sha }}
|
|
run: |
|
|
mkdir -p out
|
|
SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-8)
|
|
EXE_PATH=build_meson/Minecraft.Client/Minecraft.Client
|
|
if [ -f "$EXE_PATH" ]; then
|
|
tar -czf out/minecraft-client-linux-${SHORT_SHA}.tar.gz -C build_meson Minecraft.Client/Minecraft.Client
|
|
echo "packaged: out/minecraft-client-linux-${SHORT_SHA}.tar.gz"
|
|
else
|
|
echo "ERROR: expected executable at $EXE_PATH" >&2
|
|
ls -la build_meson || true
|
|
exit 1
|
|
fi
|
|
|
|
- name: Upload artifact (.tar.gz)
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: minecraft-client-linux-${{ github.sha }}
|
|
path: out/*.tar.gz
|