name: CI
on: [push]
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: rustup component add clippy rustfmt
run: rustup component add clippy rustfmt
- name: cargo fmt --verbose --all -- --check
run: cargo fmt --verbose --all -- --check
- name: cargo clippy --verbose --all -- -D warnings
run: cargo clippy --verbose --all -- -D warnings
build:
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
name: Build - ${{ matrix.target }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: rust-toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
default: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --target=${{ matrix.target }}
use-cross: true
publish:
name: Publish
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [lint, build]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}