name: Ansible Docsite CI

on:
  push:
    branches-ignore:
      - 'patchback/**'
  pull_request:

jobs:
  docs_sanity_docs_build:
    name: docs-build
    runs-on: ubuntu-22.04
    steps:
    - name: Checkout Docsite
      uses: actions/checkout@v3

    - name: Install Python 3.11
      uses: actions/setup-python@v4
      with:
        python-version: '3.11'

    - name: Install Test Requirements
      run: |
        python -m pip install -r tests/requirements.txt

    - name: Graft ansible-core
      run: |
        python docs/bin/clone-core.py

    - name: Run docs-build Sanity
      run: |
        python tests/sanity.py docs-build

  docs_sanity_rstcheck:
    name: rstcheck
    runs-on: ubuntu-22.04
    steps:
    - name: Checkout Docsite
      uses: actions/checkout@v3

    - name: Install Python 3.11
      uses: actions/setup-python@v4
      with:
        python-version: '3.11'

    - name: Install Test Requirements
      run: |
        python -m pip install -r tests/requirements.txt

    - name: Graft ansible-core
      run: |
        python docs/bin/clone-core.py

    - name: Run rstcheck Sanity
      run: |
        python tests/sanity.py rstcheck
