gemini workflow change
This commit is contained in:
@@ -7,69 +7,47 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
name: Build ${{ matrix.target }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
container:
|
# A matrix lets us run the job twice in parallel: once for x86, once for arm.
|
||||||
image: ubuntu:22.04
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: x86_64-unknown-linux-gnu
|
||||||
|
use-cross: false
|
||||||
|
- target: aarch64-unknown-linux-gnu
|
||||||
|
use-cross: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# =========================
|
- name: Checkout repository
|
||||||
# 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
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# =========================
|
# Sets up Rust correctly and caches it
|
||||||
# 4. install cross
|
- name: Install Rust toolchain
|
||||||
# =========================
|
uses: dtolnay/rust-toolchain@stable
|
||||||
- name: install cross
|
with:
|
||||||
run: |
|
targets: ${{ matrix.target }}
|
||||||
. "$HOME/.cargo/env"
|
|
||||||
cargo install cross --locked
|
|
||||||
|
|
||||||
# =========================
|
# Downloads pre-compiled `cross` binary instantly (saves ~3 mins vs cargo install)
|
||||||
# 5. build x86_64
|
- name: Install cross
|
||||||
# =========================
|
if: matrix.use-cross == true
|
||||||
- name: build x86_64
|
uses: taiki-e/install-action@v2
|
||||||
run: |
|
with:
|
||||||
. "$HOME/.cargo/env"
|
tool: cross
|
||||||
cargo build --release --target x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
# =========================
|
# Builds using cargo for x86, and cross for ARM
|
||||||
# 6. build ARM64 via cross
|
- name: Build binary
|
||||||
# =========================
|
|
||||||
- name: build arm64
|
|
||||||
run: |
|
run: |
|
||||||
. "$HOME/.cargo/env"
|
if [ "${{ matrix.use-cross }}" == "true" ]; then
|
||||||
cross build --release --target aarch64-unknown-linux-gnu
|
cross build --release --target ${{ matrix.target }}
|
||||||
|
else
|
||||||
|
cargo build --release --target ${{ matrix.target }}
|
||||||
|
fi
|
||||||
|
|
||||||
# =========================
|
# Uploads the artifact. They will be separated by target name.
|
||||||
# 7. upload artifacts
|
- name: Upload artifacts
|
||||||
# =========================
|
|
||||||
- name: upload artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: escape-room-binaries
|
name: escape-room-server-${{ matrix.target }}
|
||||||
path: |
|
path: target/${{ matrix.target }}/release/escape_room_server
|
||||||
target/x86_64-unknown-linux-gnu/release/escape_room_server
|
|
||||||
target/aarch64-unknown-linux-gnu/release/escape_room_server
|
|
||||||
|
|||||||
Reference in New Issue
Block a user