rdlfmt 0.1.1

A formatter for SystemRDL
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:

# A newer push to the same branch makes the in-flight run irrelevant.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -D warnings

jobs:
  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: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo test --locked --all-features

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

  clippy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy --locked --all-targets --all-features

  docs:
    name: rustdoc
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      # Catches broken intra-doc links, which the module docs lean on heavily.
      - run: cargo doc --locked --no-deps --all-features
        env:
          RUSTDOCFLAGS: -D warnings

  # The library half must not need the CLI dependencies. Nothing else in this
  # workflow would notice if a `clap` import leaked into it.
  no-default-features:
    name: lib without cli feature
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo check --locked --no-default-features --lib

  # `rust-version` in Cargo.toml is a promise to anyone running `cargo install`.
  # Without this job it silently rots the first time a newer feature is used.
  msrv:
    name: msrv (1.88)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@1.88
      - uses: Swatinem/rust-cache@v2
      - run: cargo check --locked --all-targets --all-features

  # A publish is irreversible, so verify the tarball builds on every push
  # rather than discovering a bad manifest at release time.
  package:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo package --locked