fdcan 0.2.1

STM32 FDCAN peripheral driver
Documentation
on:
  push:
    branches: master
  pull_request:
  merge_group:

name: Continuous integration

env:
  CARGO_TERM_COLOR: always
  TARGET: thumbv7em-none-eabihf

jobs:
  ci:
    name: CI
    runs-on: ubuntu-latest
    needs: [test, lint]
    if: always()
    steps:
      - name: Done
        run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - 1.52.0  # MSRV
          - stable
        device_feature:
          - fdcan_g0_g4_l5
          - fdcan_h7
    steps:
    - uses: actions/checkout@v2
    - name: Cache cargo registry and index
      uses: actions/cache@v2
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
        key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
    - name: Cache cargo build
      uses: actions/cache@v2
      with:
        path: target
        key: ${{ runner.os }}-target-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}
    - uses: actions-rs/toolchain@v1
      with:
        profile: minimal
        toolchain: ${{ matrix.rust }}
        target: ${{ env.TARGET }}
        override: true
    - uses: actions-rs/cargo@v1
      with:
        use-cross: true
        command: build
        args: --verbose --release --target ${{ env.TARGET }} --features ${{ matrix.device_feature }}
    - uses: actions-rs/cargo@v1
      with:
        use-cross: true
        command: test
        args: --verbose --features ${{ matrix.device_feature }}

  lint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        profile: minimal
        toolchain: stable
        override: true
        components: rustfmt
    - name: Check code formatting
      run: cargo fmt -- --check