Skip to content

Update rust.yml

Update rust.yml #165

Workflow file for this run

name: Rust
on:
push:
pull_request:
release:
types: [released]
jobs:
test_pc:
strategy:
matrix:
os: [ubuntu, windows]
name: "test ${{ matrix.os }}"
continue-on-error: true
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
id: "rust-toolchain"
- name: Install alsa, libudev
if: ${{ matrix.os == 'ubuntu' }}
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- uses: actions/cache@v3
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: "PC ${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} Lock ${{hashFiles('Cargo.lock')}}"
- run: cargo test --all-features -p m3-models
env:
RUST_BACKTRACE: 1
- run: cargo test --all-features -p m3-map
env:
RUST_BACKTRACE: 1
- run: cargo test --all-features -p m3-pc
env:
RUST_BACKTRACE: 1
check_pybadge:
runs-on: ubuntu-latest
name: "check pybadge"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
id: "rust-toolchain"
with:
targets: thumbv7em-none-eabihf
- uses: actions/cache@v3
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: "Pybadge ${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} Lock ${{hashFiles('Cargo.lock')}}"
- name: cargo check models
run: cargo check --all-features --target thumbv7em-none-eabihf -p m3-models
env:
RUST_BACKTRACE: 1
- name: cargo check pybadge
run: cargo check --all-features -p m3-pybadge
working-directory: pybadge
env:
RUST_BACKTRACE: 1
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check
cargo_publish:
if: ${{ github.event_name == 'release' }}
needs: [test_pc, check_pybadge]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install SDL2
run: sudo apt-get update && sudo apt-get install -y libsdl2-dev
- uses: dtolnay/rust-toolchain@stable
- uses: msrd0/cargo-publish-action@v1
with:
packages: TODO
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}