ci: implement gitea actions pipeline and makefile
All checks were successful
build-service / compile-binaries (push) Successful in 2m40s
All checks were successful
build-service / compile-binaries (push) Successful in 2m40s
This commit is contained in:
36
.gitea/workflows/build.yml
Normal file
36
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
name: build-service
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
|
||||
jobs:
|
||||
compile-binaries:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: install-rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-unknown-linux-gnu, x86_64-unknown-linux-gnu
|
||||
|
||||
- name: build-x86
|
||||
run: cargo build --release --target x86_64-unknown-linux-gnu
|
||||
|
||||
- name: build-arm64
|
||||
# Note: For ARM64 cross-compiling on x86, we use 'cross' or a linker
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
||||
cargo build --release --target aarch64-unknown-linux-gnu
|
||||
|
||||
- name: upload-artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: escape-room-binaries
|
||||
path: |
|
||||
target/x86_64-unknown-linux-gnu/release/escape_room_server
|
||||
target/aarch64-unknown-linux-gnu/release/escape_room_server
|
||||
21
Makefile
Normal file
21
Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
BIN_NAME := escape_room_server
|
||||
OUT_DIR := ./dist
|
||||
|
||||
.PHONY: all clean build-x86 build-arm64
|
||||
|
||||
all: build-x86 build-arm64
|
||||
|
||||
prep:
|
||||
mkdir -p $(OUT_DIR)
|
||||
|
||||
build-x86: prep
|
||||
cargo build --release --target x86_64-unknown-linux-gnu
|
||||
cp target/x86_64-unknown-linux-gnu/release/$(BIN_NAME) $(OUT_DIR)/$(BIN_NAME)-x86_64
|
||||
|
||||
build-arm64: prep
|
||||
cross build --release --target aarch64-unknown-linux-gnu
|
||||
cp target/aarch64-unknown-linux-gnu/release/$(BIN_NAME) $(OUT_DIR)/$(BIN_NAME)-arm64
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
rm -rf $(OUT_DIR)
|
||||
Reference in New Issue
Block a user