jamjam 0.3.0

Handles JAM, PCBOARD message bases & QWK packets.
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:
  schedule:
    - cron: "0 4 * * 1"
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        toolchain: [stable, beta]
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.toolchain }}
          components: clippy, rustfmt
      - uses: Swatinem/rust-cache@v2
      - name: Check formatting
        run: cargo fmt --all --check
      - name: Clippy
        run: cargo clippy --all-targets --all-features -- -D warnings
      - name: Test
        run: cargo test --all-targets --all-features
      - name: Benchmarks compile
        run: cargo bench --all-features --no-run
      - name: Docs
        run: cargo doc --no-deps --all-features
        env:
          RUSTDOCFLAGS: -D warnings

  # The version promised by rust-version in Cargo.toml.
  msrv:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: "1.89"
      - uses: Swatinem/rust-cache@v2
      - name: Test
        run: cargo test --all-targets --all-features

  # Coverage guided fuzzing needs nightly, so it runs on a schedule instead of
  # gating every pull request. The seeded suite in tests/fuzz.rs covers those.
  fuzz:
    if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@nightly
      - uses: Swatinem/rust-cache@v2
        with:
          workspaces: |
            .
            fuzz
      - name: Install cargo-fuzz
        run: cargo install cargo-fuzz --locked
      - name: Fuzz
        run: |
          for target in jam_header jam_base pcboard_message qwk_message qwk_control qwk_index; do
            cargo fuzz run "$target" -- -max_total_time=60
          done
      - name: Upload findings
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: fuzz-artifacts
          path: fuzz/artifacts