Skip to content

Create rust.yml

Create rust.yml #1

Workflow file for this run

name: Rust-Cross-Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
# Linux config
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
command: cargo
# Android config
- name: android-arm
runner: ubuntu-latest
target: aarch64-linux-android
command: cross
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
# Only install cross if we need it
# Install via cargo-binstall which I found faster
- name: Install Cross
if: matrix.command == 'cross'
shell: bash
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm cross
- name: Build Binary
run: ${{ matrix.command }} build --verbose --locked --release --target ${{ matrix.target }}