rust-jpl 0.0.1

Rust library for NASA JPL DE441 ephemeris: precise planetary positions for astronomy, astrophysics, and astrology applications
Documentation
name: Rust CI

on:
  # Run on push to any branch
  push:
    branches: ["*"]
  # Run on pull requests targeting main or dev
  pull_request:
    branches:
      - main
      - dev

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1 # Helpful for debugging panics

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      # 1️⃣ Checkout repository
      - name: Checkout repository
        uses: actions/checkout@v3

      # 2️⃣ Set up Rust toolchain using latest supported action
      - name: Set up Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      # 3️⃣ Cache cargo registry and git dependencies for faster builds
      - name: Cache cargo registry and git
        uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-

      # 4️⃣ Create temporary config.toml to ensure tests pass
      - name: Create temporary config.toml
        run: |
          mkdir -p assets
          cat <<EOT > config.toml
          [paths]
          nasa_jpl_de441 = "assets/linux_m13000p17000.441.bsp"
          header_441 = "assets/header.441"
          initial_data_dat = "assets/Initial_data.dat"
          EOT

      # 5️⃣ Build the project
      - name: Build
        run: cargo build --verbose

      # 6️⃣ Run unit tests
      - name: Run unit tests
        run: cargo test --verbose

      # 7️⃣ Run doctests
      - name: Run doctests
        run: cargo test --doc --verbose

      # 8️⃣ Run Clippy linter
      - name: Run Clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      # 9️⃣ Check code formatting
      - name: Check formatting
        run: cargo fmt --all -- --check