atfits-rs 1.0.4

Shared low-level cfitsio helpers (pixel I/O, header editing, image creation) for the at*-rs FITS tools
Documentation
name: CI

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
      - main

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

env:
  FORCE_COLOR: 3
  CARGO_TERM_COLOR: always
  # cfitsio is compiled from source via the crate's `fitsio-src` feature, so
  # the only build requirement is a C compiler, which every runner provides.
  # No system libcfitsio-dev needed.
  CARGO_FEATURES: --features fitsio-src

jobs:
  lint:
    name: Lint & format
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - uses: Swatinem/rust-cache@v2

      # prek is a fast Rust reimplementation of pre-commit; it runs the hooks in
      # .pre-commit-config.yaml (generic checks + cargo fmt/clippy).
      - name: Install prek
        uses: taiki-e/install-action@v2
        with:
          tool: prek

      - name: Run pre-commit hooks (prek)
        run: prek run --all-files --show-diff-on-failure

  test:
    name: Test (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    needs: [lint]
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-14]
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - name: Build
        run: cargo build --all-targets ${{ env.CARGO_FEATURES }}

      - name: Test
        run: cargo test ${{ env.CARGO_FEATURES }}

  docs:
    name: Docs build
    runs-on: ubuntu-latest
    needs: [lint]
    env:
      # Mirror docs.rs: fail the build on broken intra-doc links.
      RUSTDOCFLAGS: -D warnings
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - name: Build docs
        run: cargo doc --no-deps ${{ env.CARGO_FEATURES }}