76 lines
2.0 KiB
YAML
76 lines
2.0 KiB
YAML
name: build-service
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
image: ubuntu:22.04
|
|
|
|
steps:
|
|
# =========================
|
|
# 1. system dependencies
|
|
# =========================
|
|
- name: install system deps
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y \
|
|
git curl ca-certificates build-essential
|
|
|
|
# =========================
|
|
# 2. install Rust (user-space, correct PATH)
|
|
# =========================
|
|
- name: install rust
|
|
run: |
|
|
curl https://sh.rustup.rs -sSf | sh -s -- -y
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
. "$HOME/.cargo/env"
|
|
rustc --version
|
|
cargo --version
|
|
|
|
# =========================
|
|
# 3. checkout (NOW works because git exists)
|
|
# =========================
|
|
- name: checkout
|
|
uses: actions/checkout@v4
|
|
|
|
# =========================
|
|
# 4. install cross
|
|
# =========================
|
|
- name: install cross
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
cargo install cross --locked
|
|
|
|
# =========================
|
|
# 5. build x86_64
|
|
# =========================
|
|
- name: build x86_64
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
cargo build --release --target x86_64-unknown-linux-gnu
|
|
|
|
# =========================
|
|
# 6. build ARM64 via cross
|
|
# =========================
|
|
- name: build arm64
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
cross build --release --target aarch64-unknown-linux-gnu
|
|
|
|
# =========================
|
|
# 7. upload artifacts
|
|
# =========================
|
|
- 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
|