molcrafts-molpack 0.1.0

Faithful Rust port of Packmol molecular packing (split off from molrs)
Documentation
name: CI

on:
  push:
    branches: [master, main]
  pull_request:
  workflow_call:
  workflow_dispatch:

# CI is a tests-only gate. Formatting and linting (cargo fmt + clippy,
# ruff-format + ruff, ty) are enforced by the pre-commit hooks in
# `.pre-commit-config.yaml`, which use first-party registry-hosted tooling.
# Keeping CI focused on the test suites avoids duplicating those checks here.

jobs:
  test:
    name: rust tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          repository: MolCrafts/molrs
          path: molrs
      - uses: actions/checkout@v6
        with:
          path: molpack
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
        with:
          workspaces: molpack
      - name: Cache test data
        uses: actions/cache@v5
        with:
          path: molrs/molrs-core/target/tests-data
          key: ${{ runner.os }}-test-data-${{ hashFiles('molrs/scripts/fetch-test-data.sh') }}
      - name: Fetch test data
        run: bash scripts/fetch-test-data.sh
        working-directory: molrs
      - name: Test (library + integration + examples)
        # `io` is on so the example programs and the io-gated integration tests
        # (incl. the `examples_batch` regression harness, which only *runs* under
        # `--ignored`) are compiled here — without it they are silently skipped.
        run: cargo test --features io --lib --tests --examples
        working-directory: molpack
      - name: Test CLI (cli feature)
        run: cargo test --test cli --features cli
        working-directory: molpack
      - name: Feature-gate checks (no-default-features / rayon / ff)
        run: |
          cargo check --no-default-features
          cargo check --features rayon
          cargo check --features ff
        working-directory: molpack
      # Compile-check the criterion regression benches on every PR (the full
      # timed run happens on canonical pushes in bench.yml). The benches
      # synthesize their own geometry, so no `io` feature is needed.
      - name: Build benches (rot guard)
        run: cargo build --benches
        working-directory: molpack

  # Packmol regression suite — expensive (runs all five example workloads to
  # convergence, up to ~1h for the spherical case), so it is skipped on pull
  # requests and runs on master pushes, the release gate (workflow_call), and
  # manual dispatch. CONTRIBUTING requires it green for restraint/objective work.
  regression:
    name: packmol regression
    runs-on: ubuntu-latest
    if: github.event_name != 'pull_request'
    steps:
      - uses: actions/checkout@v6
        with:
          repository: MolCrafts/molrs
          path: molrs
      - uses: actions/checkout@v6
        with:
          path: molpack
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
        with:
          workspaces: molpack
      - name: Run examples_batch (--ignored)
        run: cargo test --release --features io --test examples_batch -- --ignored
        working-directory: molpack

  python:
    name: python tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          repository: MolCrafts/molrs
          path: molrs
      - uses: actions/checkout@v6
        with:
          path: molpack
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
        with:
          workspaces: molpack
      - uses: actions/setup-python@v6
        with:
          python-version: "3.12"
      - uses: astral-sh/setup-uv@v6
      - name: Build + test Python bindings
        run: |
          uv venv
          source .venv/bin/activate
          uv pip install --group dev
          maturin develop --release
          pytest -v
        working-directory: molpack/python