Skip to content

Commit

Permalink
Add rust workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
thienandangthanh committed Nov 8, 2023
1 parent 47d750d commit e542a30
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Rust

on:
push:
branches: [ "master", "dev" ]
paths-ignore:
- "ui/**"
- "docs/**"
pull_request:
branches: [ "master", "dev" ]
paths-ignore:
- "ui/**"
- "docs/**"

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
steps:
- uses: actions/checkout@v4

- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Install Cross
run: which cross || cargo install cross
- name: Build
run: cross build --release --target=${{ matrix.target }}
- name: Test
run: cross test --release --target=${{ matrix.target }}
- name: Format
run: cargo fmt --all -- --check

0 comments on commit e542a30

Please sign in to comment.