Skip to content

Merge pull request #6 from miguelandres/dependabot/cargo/rand-tw-0.9 #33

Merge pull request #6 from miguelandres/dependabot/cargo/rand-tw-0.9

Merge pull request #6 from miguelandres/dependabot/cargo/rand-tw-0.9 #33

name: Rust Unit Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
build-and-test:
name: ${{ matrix.make.name }} (${{ matrix.target.name }})
runs-on: ${{ matrix.target.gh_env }}
strategy:
fail-fast: false
matrix:
rust: [nightly]
target:
- name: x86_64-unknown-linux-gnu
gh_env: ubuntu-latest
- name: aarch64-unknown-linux-gnu
gh_env: ubuntu-latest
linker: gcc-aarch64-linux-gnu
- name: armv7-unknown-linux-gnueabihf
gh_env: ubuntu-latest
linker: gcc-arm-linux-gnueabihf
- name: aarch64-apple-darwin
gh_env: macos-latest
- name: x86_64-apple-darwin
gh_env: macos-latest
include:
- target:
name: x86_64-unknown-linux-gnu
cross: false
run_tests: true
- target:
name: aarch64-unknown-linux-gnu
linker: gcc-aarch64-linux-gnu
cross: true
run_tests: false
- target:
name: armv7-unknown-linux-gnueabihf
linker: gcc-arm-linux-gnueabihf
cross: true
run_tests: false
- target:
name: aarch64-apple-darwin
cross: false
run_tests: false
- target:
name: x86_64-apple-darwin
cross: false
run_tests: true
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
steps:
- uses: actions/checkout@v4
# When rustup is updated, it tries to replace its binary, which on Windows is somehow locked.
# This can result in the CI failure, see: https://github.com/rust-lang/rustup/issues/3029
- name: Setup rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust}}
target: ${{ matrix.target.name }}
- name: Install Linker
if: matrix.cross
run: |
sudo apt update
sudo apt install ${{ matrix.linker }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.target.name }}--branch--${{ github.ref }}
- name: Build
run: cargo build --target ${{ matrix.target.name }}
- name: Run tests
# cannot run arm or aarch64 at all on github actions :(
if: matrix.run_tests
run: cargo test --target ${{ matrix.target.name }}