netspeed-cli 0.3.0

Command-line interface for testing internet bandwidth using speedtest.net
name: CI

on:
  push:
    branches: [master, main]
  pull_request:
    branches: [master, main]

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Cache dependencies
        uses: Swatinem/rust-cache@v2
      - name: Run tests
        run: cargo test --verbose
      - name: Build release
        run: cargo build --release

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - name: Cache dependencies
        uses: Swatinem/rust-cache@v2
      - name: Run clippy
        run: cargo clippy -- -D warnings

  fmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - name: Check formatting
        run: cargo fmt -- --check

  brew-audit:
    name: Homebrew Audit
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4
      - name: Audit formula
        run: |
          TAP_DIR="$(brew --repository)/Library/Taps/mapledevjs/homebrew-netspeed-cli"
          mkdir -p "$TAP_DIR"
          cp netspeed-cli.rb "$TAP_DIR/"
          cd "$TAP_DIR"
          git init
          git add netspeed-cli.rb
          git commit -m "audit"
          brew install --build-from-source mapledevjs/netspeed-cli/netspeed-cli
          brew audit --strict --online mapledevjs/netspeed-cli/netspeed-cli