diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 7d73c103d..e1ff0b0fd 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -1,132 +1,38 @@ -name: Build (Linux, x86_64) +name: Build (Linux, x86-64) on: push: - paths: + paths: &workflow_paths - '**.cpp' - '**.h' - '**.c' - - '**/meson.build' - - 'meson.build' - - '**/CMakeLists.txt' - - 'CMakeLists.txt' + - '**.cc' + - '**.cxx' + - '**.hh' + - '**.hpp' + - '**.hxx' + - '**.inl' + - "**meson.build" + - "flake.nix" - '.github/workflows/build-linux.yml' + pull_request: - paths: - - '**.cpp' - - '**.h' - - '**.c' - - '**/meson.build' - - 'meson.build' - - '**/CMakeLists.txt' - - 'CMakeLists.txt' - - '.github/workflows/build-linux.yml' + paths: *workflow_paths jobs: build-linux: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential ccache python3 python3-pip ninja-build libsdl2-dev libgl-dev libglu1-mesa-dev libpthread-stubs0-dev - python -m pip install meson - # Set a reasonable ccache size - ccache -M 5G || true - - - name: Restore ccache - uses: actions/cache@v4 + - name: Install Nix + uses: cachix/install-nix-action@v31 with: - path: ~/.ccache - key: ${{ runner.os }}-ccache-${{ hashFiles('**/meson.build') }} + nix_path: nixpkgs=channel:nixos-unstable - - name: Restore meson cache - uses: actions/cache@v4 - with: - path: ~/.cache/meson - key: ${{ runner.os }}-meson-${{ hashFiles('**/meson.build') }} + - name: Build + run: nix build --print-build-logs - - 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_release --wipe --buildtype=release --native-file=./scripts/llvm_native.txt - - - name: Build with Meson - 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 - meson compile -C build_release -j $(nproc) -v Minecraft.Client - - - name: Install patchelf - run: sudo apt-get install -y patchelf - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: minecraft-client-linux-release_exe-${{ github.sha }} - path: build_release/Minecraft.Client/Minecraft.Client - retention-days: 7 - build-linux-debug: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential ccache python3 python3-pip ninja-build libsdl2-dev libgl-dev libglu1-mesa-dev libpthread-stubs0-dev - python -m pip install meson - # Set a reasonable ccache size - ccache -M 5G || true - - - 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-debug-${{ hashFiles('**/meson.build') }} - - - 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 --native-file=./scripts/llvm_native.txt - - - name: Build Debug with Meson - 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 - meson compile -C build_debug -j $(nproc) -v Minecraft.Client - - - name: Upload debug executable - uses: actions/upload-artifact@v4 - with: - name: minecraft-client-linux-debug_exe-${{ github.sha }} - path: build_debug/Minecraft.Client/Minecraft.Client - retention-days: 7 + - name: Flake integrity + run: nix flake check diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 4965d4b15..84820ad88 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -1,22 +1,8 @@ -name: Clang Format +name: Format Check on: push: - paths: - - '**.cpp' - - '**.h' - - '**.c' - - '**.cc' - - '**.cxx' - - '**.hh' - - '**.hpp' - - '**.hxx' - - '**.inl' - - '.clang-format' - - '.github/workflows/clang-format.yml' - - '.github/scripts/check-clang-format.sh' - pull_request: - paths: + paths: &workflow_paths - '**.cpp' - '**.h' - '**.c' @@ -30,26 +16,29 @@ on: - '.github/workflows/clang-format.yml' - '.github/scripts/check-clang-format.sh' + pull_request: + paths: *workflow_paths + jobs: clang-format: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest concurrency: group: clang-format-${{ github.ref }} cancel-in-progress: true steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: - fetch-depth: 0 + fetch-depth: 2 - name: Install clang-format - run: | - sudo apt-get update - sudo apt-get install -y clang-format-19 + uses: daaku/gh-action-apt-install@v4 + with: + packages: clang-format - name: Check changed files env: - CLANG_FORMAT_BIN: clang-format-19 + CLANG_FORMAT_BIN: clang-format EVENT_NAME: ${{ github.event_name }} PR_BASE_REF: ${{ github.event.pull_request.base.ref }} PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} diff --git a/flake.nix b/flake.nix index fd8af4473..05ceb4fef 100644 --- a/flake.nix +++ b/flake.nix @@ -54,6 +54,7 @@ version = "0.1.0"; src = ./.; + dontFixup = true; dontUseCmakeConfigure = true; # 4jcraft - Meson expects this subprojects structure @@ -100,6 +101,7 @@ openssl.dev libGL libGLU + glm SDL2 zlib ];