Add CI #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Cache Cargo Dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: build | |
run: cargo build | |
- name: test | |
run: cargo test | |
test_other_archs: | |
# github actions does not support 32-bit or big endian systems directly, but | |
# it does support QEMU. so we install qemu, then build and run the tests in | |
# an emulated system. NOTE: you can also use this approach to test for big | |
# endian locally. | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [powerpc-unknown-linux-gnu, i686-unknown-linux-gnu] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install or use cached cross-rs/cross | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cross | |
- name: Cache Cargo Dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
key: ${{ matrix.arch }} | |
- name: Start Docker (required for cross-rs) | |
run: sudo systemctl start docker | |
- name: Cross-Run Tests using QEMU | |
run: cross test --target ${{ matrix.arch }} | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Run rustfmt check | |
run: cargo fmt -- --check | |
cargo-deny: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: EmbarkStudios/cargo-deny-action@v1 |