smon 0.1.3

Minimalistic TUI serial monitor
name: CI

on:
  push:
    branches: [master]
  pull_request:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  fmt:
    name: Format
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      # The style in .rustfmt.toml uses options stable rustfmt rejects outright,
      # so this needs nightly. rust-toolchain.toml still pins the build, which is
      # why the check names its toolchain rather than relying on the default.
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt
      - run: cargo +nightly fmt --check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: Swatinem/rust-cache@v2
      # serialport reads the port list through libudev on a gnu target. The
      # musl release build drops that dependency, but this job builds gnu.
      - name: Install libudev
        run: sudo apt-get update && sudo apt-get install -y libudev-dev
      - run: cargo clippy --all-targets -- -D warnings

  test:
    name: Test ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    steps:
      - uses: actions/checkout@v7
      - uses: Swatinem/rust-cache@v2
      - name: Install libudev
        if: runner.os == 'Linux'
        run: sudo apt-get update && sudo apt-get install -y libudev-dev
      - run: cargo test