name: Merge Queue Pipeline

on:
  merge_group:
    types: [checks_requested]
  workflow_dispatch:

env:
  # Force nox to produce colorful logs:
  FORCE_COLOR: "true"

jobs:
  Package:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up runner
        uses: opendp/tumult-tools/actions/setup@6cf847ba14aab81eb8c92b8946e09f92fc4cac99
      - run: uv run --only-group scripting nox -s build
      - name: Archive packaged library
        uses: actions/upload-artifact@v4
        with:
          name: dist
          path: dist
  Lint:
    runs-on: ubuntu-latest
    needs: Package
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up runner
        uses: opendp/tumult-tools/actions/setup@6cf847ba14aab81eb8c92b8946e09f92fc4cac99
      - name: Download dist
        uses: actions/download-artifact@v4
        with:
          name: dist
          path: dist
      - run: uv lock --check
      - run: uv run --only-group scripting nox -t lint
  Test:
    runs-on: ubuntu-latest
    needs: Package
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up runner
        uses: opendp/tumult-tools/actions/setup@6cf847ba14aab81eb8c92b8946e09f92fc4cac99
      - name: Download dist
        uses: actions/download-artifact@v4
        with:
          name: dist
          path: dist
      - run: uv run --only-group scripting nox -s smoketest test-doctest test-fast
  Docs:
    runs-on: ubuntu-latest
    needs: Package
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up runner
        uses: opendp/tumult-tools/actions/setup@6cf847ba14aab81eb8c92b8946e09f92fc4cac99
      - name: Download dist
        uses: actions/download-artifact@v4
        with:
          name: dist
          path: dist
      - run: uv run --only-group scripting nox -t docs
      - run: rm -r public/.doctrees
      - name: Archive docs
        uses: actions/upload-artifact@v4
        with:
          name: docs
          path: public
