probe-run 0.3.9

Runs embedded programs just like native ones
name: CI

on:
  push:
    branches: [ main, staging, trying ]
  pull_request:
    branches: [ main ]

# NOTE if you add, remove or rename a job you'll need to update the list of
# jobs in the `ci` step (at the bottom of this file)
jobs:
  test:
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macOS-latest
          - windows-latest
    runs-on: ${{ matrix.os }}
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v3
      - name: Use the latest stable release
        run: rustup update stable && rustup default stable
      - name: Install C libraries for tooling
        if: matrix.os == 'ubuntu-latest'
        run: sudo apt-get update && sudo apt-get install libudev-dev libusb-1.0-0-dev

      - run: cargo build
      - run: cargo test

  static:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Use the latest stable release
        run: rustup update stable && rustup default stable
      - name: Install C libraries for tooling
        run: sudo apt-get update && sudo apt-get install libudev-dev libusb-1.0-0-dev

      - run: cargo fmt --check
      - run: cargo clippy --all-targets -- -D warnings

  # Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
  # bors.tech integration
  ci:
    if: ${{ success() }}
    needs:
      - test
      - static
    runs-on: ubuntu-latest
    steps:
      - name: CI succeeded
        run: exit 0