---
name: nox

"on":
  workflow_call:

jobs:
  nox:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          # Inputs:
          #   session: name of session
          #   python-versions: comma-separated list of Python versions to install
          #   extra-args (optional): extra arguments to pass to nox session.
          - session: static
            python-versions: "3.12"
          - session: formatters_check
            python-versions: "3.12"
          - session: typing
            python-versions: "3.12"
          - session: spelling
            python-versions: "3.12"
          - session: "checkers(rstcheck)"
            python-versions: "3.12"
          - session: "checkers(rst-yamllint)"
            python-versions: "3.12"
          - session: "checkers(docs-build)"
            python-versions: "3.12"
          - session: "actionlint"
            python-versions: "3.12"
          - session: "pip-compile"
            extra-args: "--check"
            python-versions: "3.12"
    name: "Run nox ${{ matrix.session }} session"
    steps:
      - name: Check out repo
        uses: actions/checkout@v5
      - name: Setup nox
        uses: wntrblm/nox@2025.10.16
        with:
          python-versions: "${{ matrix.python-versions }}"
      - name: Graft ansible-core
        run: |
          nox -e clone-core
      - name: "Run nox -e ${{ matrix.session }}"
        run: |
          # Using GHA expression interpolation is fine here,
          # as we control all the inputs.
          nox -e "${{ matrix.session }}" -- ${{ matrix.extra-args }}
