bxcan 0.8.0

STM32 bxCAN peripheral driver
Documentation
name: CI

on:
  push:
    branches:
    - master
    - staging
    - trying
  pull_request:
    branches:
    - master

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    strategy:
      matrix:
        rust:
          - stable
          - nightly
        os:
          - ubuntu-latest
          - macOS-latest
          - windows-latest
    runs-on: ${{ matrix.os }}
    env:
      RUSTFLAGS: "--deny warnings"
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        profile: minimal
        toolchain: ${{ matrix.rust }}
        override: true
    - name: Build
      run: cargo build --all-targets
    - name: Build All Features
      # defmt 0.3 doesn't build when targeting windows
      if: ${{ matrix.os != 'windows-latest' }}
      run: cargo build --all-targets --all-features
    - name: Run tests
      run: cargo test

  no-std:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        profile: minimal
        toolchain: stable
        override: true
    - name: Install embedded targets
      run: rustup target add thumbv6m-none-eabi thumbv7m-none-eabi
    - name: Install flip-link
      run: cargo install flip-link
    - name: Build bxcan for thumbv6m
      run: cargo build --target thumbv6m-none-eabi
    - name: Build testsuite for thumbv7m
      working-directory: testsuite
      run: cargo test --no-run --verbose --no-default-features --target thumbv7m-none-eabi

  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

  # I haven't found a good way to host the runner, and don't really have time to fix infra issues
  # at the moment, so the HIL suite is currently skipped.
  hil:
    runs-on: ubuntu-latest
    # The secrets are not supplied for 'pull_request' events, so don't run for those.
    if: github.event_name == 'push' && false
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0  # everything
    - name: Install SSH key
      uses: shimataro/ssh-key-action@v2
      with:
        key: ${{ secrets.SSH_KEY }}
        known_hosts: not needed
    - name: Push changes to CI repository
      run: |
        git checkout -b bxcan-ci-master
        git remote add ci git@github.com:jonas-schievink/bxcan-ci.git
        git push -u ci -f
        sleep 5
    - name: Trigger and wait for HIL workflow
      uses: jonas-schievink/workflow-proxy@v1
      with:
        workflow: HIL
        ref: bxcan-ci-master
        repo: jonas-schievink/bxcan-ci
        token: ${{ secrets.PRIVATE_CI_PERSONAL_ACCESS_TOKEN }}
        repost-logs: true

  ci:
    if: ${{ success() }}
    # all new jobs must be added to this list
    needs: [test, no-std, lint]
    runs-on: ubuntu-latest
    steps:
      - name: CI succeeded
        run: exit 0