4jcraft/.github/workflows/build-linux.yml

85 lines
2.3 KiB
YAML

name: Build (Linux, x86-64)
on:
push:
paths: &workflow_paths
- '**.cpp'
- '**.h'
- '**.c'
- '**.cc'
- '**.cxx'
- '**.hh'
- '**.hpp'
- '**.hxx'
- '**.inl'
- "**meson.build"
- "flake.nix"
- '.github/workflows/build-linux.yml'
pull_request:
paths: *workflow_paths
workflow_dispatch:
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Restore .git folder
uses: actions/cache@v5
with:
path: .git
key: ${{ runner.os }}-git-${{ github.sha }}
restore-keys: ${{ runner.os }}-git-
- name: Checkout repository
uses: actions/checkout@v6
- name: Install system dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: build-essential ccache meson ninja-build libsdl2-dev libgl-dev libglu1-mesa-dev libpthread-stubs0-dev libglm-dev
version: 1.0
- name: Install LLVM + libc++
run: |
wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 20
sudo apt-get install -y libc++-20-dev libc++abi-20-dev
- name: Restore ccache
uses: actions/cache@v5
with:
path: ${{ runner.temp }}/ccache
key: ${{ runner.os }}-ccache-${{ hashFiles('**/meson.build') }}
restore-keys: ${{ runner.os }}-ccache-
- name: Configure Meson
env:
CC: "ccache clang"
CXX: "ccache clang++"
CC_LD: lld
CXX_LD: lld
run: |
meson setup build --native-file=scripts/llvm_native.txt -Dunity=off --wipe
meson setup build_unity --native-file=scripts/llvm_native.txt -Dunity=on -Dunity_size=99999 --wipe
- name: Compile (-Dunity=on)
env:
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
meson compile -C build_unity -j $(nproc) -v Minecraft.Client
- name: Compile (-Dunity=off)
env:
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
meson compile -C build -j $(nproc) -v Minecraft.Client
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: minecraft-client-linux-${{ github.sha }}
path: build/targets/app/Minecraft.Client
retention-days: 7