name: Build
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_call:
env:
CARGO_TERM_COLOR: always
jobs:
build-packages:
name: Build (${{ matrix.platform.name }})
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- name: x86_64
runner: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- name: aarch64
runner: ubuntu-22.04-arm
target: aarch64-unknown-linux-gnu
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Install Rust
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7
- name: Cache cargo registry
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 with:
path: ~/.cargo/registry/index
key: ${{ runner.os }}-${{ matrix.platform.name }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.platform.name }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 with:
path: target
key: ${{ runner.os }}-${{ matrix.platform.name }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.platform.name }}-cargo-build-
- name: Build release binary
run: cargo build --release
- name: Strip binary
run: strip target/release/edgefirst-imu
- name: Create package
run: |
mkdir -p packages
cp target/release/edgefirst-imu packages/edgefirst-imu-${{ matrix.platform.name }}
- name: Upload package artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with:
name: packages-${{ matrix.platform.name }}
path: packages/
retention-days: 90