stama 1.1.1

A terminal user interface for monitoring and managing slurm jobs.
name: CI

on:
  push:
    branches: [master]
  pull_request:
  workflow_dispatch:
  schedule:
    # Weekly run to catch breakage from new toolchain releases, new
    # dependency releases (latest-deps job), and advisories.
    - cron: "17 4 * * 1"

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test (fmt, clippy, test)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt
      - uses: Swatinem/rust-cache@v2
      - name: Check formatting
        run: cargo fmt --all --check
      - name: Clippy
        run: cargo clippy --all-targets -- -D warnings
      - name: Run tests
        run: cargo test

  # Verify the minimum supported Rust version still builds.
  # NOTE: the toolchain version below must stay in sync with the
  # `rust-version` field in Cargo.toml (currently 1.88).
  msrv:
    name: MSRV (1.88)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@1.88
      - uses: Swatinem/rust-cache@v2
      - name: Check with MSRV
        run: cargo check --all-targets

  # `cargo install stama` resolves the *newest* semver-compatible versions of
  # every dependency, ignoring Cargo.lock. A new release of e.g. ratatui can
  # therefore break fresh installs while locally-built binaries keep working.
  # This job simulates a fresh install every week: update to the latest
  # compatible dependencies, then build and test.
  latest-deps:
    name: Latest dependencies
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Update to latest compatible dependencies
        run: cargo update --verbose
      - name: Build with latest dependencies
        run: cargo build --all-targets
      - name: Test with latest dependencies
        run: cargo test

  audit:
    name: Security audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: taiki-e/install-action@cargo-audit
      - name: Audit dependencies
        run: cargo audit