From 848ec596c6dc2e57f9501bf1d4116df9b84131fe Mon Sep 17 00:00:00 2001 From: KeshavAnandCode Date: Thu, 14 May 2026 19:39:17 -0500 Subject: [PATCH] uasing cross --- .gitea/workflows/build.yml | 60 ++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 13c3bb1..647d788 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,8 +1,5 @@ name: build-service -permissions: - contents: write - on: push: branches: @@ -10,27 +7,63 @@ on: tags: - "v*" +permissions: + contents: write + jobs: compile-binaries: runs-on: ubuntu-latest steps: + # ----------------------------- + # Checkout + # ----------------------------- - name: checkout uses: actions/checkout@v4 + # ----------------------------- + # Cargo cache (BIG SPEED BOOST) + # ----------------------------- + - name: cache cargo + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + cargo-${{ runner.os }}- + + # ----------------------------- + # Rust toolchain + # ----------------------------- - name: install-rust uses: dtolnay/rust-toolchain@stable with: - targets: aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu + targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu + # ----------------------------- + # Install cross (ARM builds) + # ----------------------------- + - name: install-cross + run: cargo install cross --git https://github.com/cross-rs/cross + + # ----------------------------- + # Build x86_64 (native) + # ----------------------------- - name: build-x86 run: cargo build --release --target x86_64-unknown-linux-gnu + # ----------------------------- + # Build ARM64 (via cross) + # ----------------------------- - name: build-arm64 - env: - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc - run: cargo build --release --target aarch64-unknown-linux-gnu + run: cross build --release --target aarch64-unknown-linux-gnu + # ----------------------------- + # Package outputs + # ----------------------------- - name: prepare-release-files run: | mkdir -p dist @@ -45,18 +78,21 @@ jobs: cd dist - zip escape_room_server-linux-x86_64.zip \ - escape_room_server-linux-x86_64 - - zip escape_room_server-linux-arm64.zip \ - escape_room_server-linux-arm64 + zip escape_room_server-linux-x86_64.zip escape_room_server-linux-x86_64 + zip escape_room_server-linux-arm64.zip escape_room_server-linux-arm64 + # ----------------------------- + # Upload artifacts (CI downloads) + # ----------------------------- - name: upload-artifacts uses: actions/upload-artifact@v4 with: name: escape-room-binaries path: dist/*.zip + # ----------------------------- + # Create Git release on tags + # ----------------------------- - name: create-release if: startsWith(gitea.ref, 'refs/tags/v') uses: softprops/action-gh-release@v2