photom 0.4.0

Rust library for loading, structuring and querying astronomical observation datasets — with trajectory grouping, multi-observer support, and efficient lookups.
Documentation
name: CI

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

permissions:
  contents: read

jobs:
  fmt:
    name: Format check
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust (stable)
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt

      - name: cargo fmt
        run: cargo fmt --all -- --check

  ci:
    name: ${{ matrix.command }} (${{ matrix.features }})
    runs-on: ubuntu-latest
    if: github.event_name != 'push'
    strategy:
      fail-fast: false
      matrix:
        features:
          - no-features
          - polars
          - parallel
          - ades
          - mpc_80_col
          - datafusion-large-test-fixtures
          - serde
          - polars-parallel-ades-mpc_80_col-datafusion-large-test-fixtures-serde
        command: [clippy, check]
        include:
          - features: no-features
            cargo_flags: --no-default-features
          - features: polars
            cargo_flags: --no-default-features --features polars
          - features: parallel
            cargo_flags: --no-default-features --features parallel
          - features: ades
            cargo_flags: --no-default-features --features ades
          - features: mpc_80_col
            cargo_flags: --no-default-features --features mpc_80_col
          - features: datafusion,large-test-fixtures
            cargo_flags: --no-default-features --features datafusion,large-test-fixtures
          - features: serde
            cargo_flags: --no-default-features --features serde
          - features: polars-parallel-ades-mpc_80_col-datafusion-large-test-fixtures-serde
            cargo_flags: --no-default-features --features polars,parallel,ades,mpc_80_col,datafusion,large-test-fixtures,serde
          - command: clippy
            components: clippy
          - command: check
            components: ""
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust (stable)
        uses: dtolnay/rust-toolchain@stable
        with:
          components: ${{ matrix.components }}

      - name: Cache Rust
        uses: Swatinem/rust-cache@v2
        with:
          cache-on-failure: true
          key: ${{ matrix.features }}-${{ matrix.command }}

      - name: cargo clippy
        if: matrix.command == 'clippy'
        run: cargo clippy --all-targets ${{ matrix.cargo_flags }} -- -D warnings

      - name: cargo check
        if: matrix.command == 'check'
        run: cargo check --all-targets ${{ matrix.cargo_flags }}

  doc:
    name: doc (all-features)
    runs-on: ubuntu-latest
    if: github.event_name != 'push'
    steps:
      - name: Checkout
        uses: actions/checkout@v4

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

      - name: Cache Rust
        uses: Swatinem/rust-cache@v2
        with:
          cache-on-failure: true

      - name: cargo doc
        run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features

  semver:
    name: SemVer check
    runs-on: ubuntu-latest
    if: github.event_name != 'push'
    steps:
      - name: Checkout
        uses: actions/checkout@v4

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

      - name: Cache Rust
        uses: Swatinem/rust-cache@v2
        with:
          cache-on-failure: true
          key: semver

      - name: Install cargo-semver-checks
        uses: taiki-e/install-action@cargo-semver-checks

      - name: cargo semver-checks
        run: cargo semver-checks --all-features

  coverage:
    name: Coverage (all features)
    runs-on: ubuntu-latest
    needs:
      - fmt
      - ci
      - doc
      - semver
    if: |
      always() && (
        (github.event_name == 'push' && github.ref == 'refs/heads/main') ||
        (github.event_name != 'push' &&
          needs.fmt.result == 'success' &&
          needs.ci.result  == 'success' &&
          needs.doc.result == 'success' &&
          needs.semver.result == 'success')
      )
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust stable + llvm-tools
        uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools-preview

      - name: Cache Rust
        uses: Swatinem/rust-cache@v2
        with:
          cache-on-failure: true
          key: coverage-all-features

      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Clean coverage artifacts
        run: cargo llvm-cov clean --workspace

      - name: Generate coverage (lcov, all features)
        env:
          RAYON_NUM_THREADS: 2
          RUST_TEST_THREADS: 1
        run: |
          cargo llvm-cov \
            --all-features \
            --lcov --output-path lcov.info

      - name: Upload to Codecov
        uses: codecov/codecov-action@v4
        with:
          files: lcov.info
          flags: rust
          fail_ci_if_error: false
          token: ${{ secrets.CODECOV_TOKEN }}