name: Documentation

on:
   push:
      branches: [ RC_1_2 RC_2_0 master ]
   pull_request:

concurrency:
   group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
   cancel-in-progress: true

jobs:

   docs:
      name: Docs
      runs-on: ubuntu-20.04

      steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: update package lists
        continue-on-error: true
        run: |
          sudo apt update

      - name: install dependencies
        run: |
          sudo apt install python-docutils python-pygments python-pil gsfonts inkscape icoutils graphviz hunspell imagemagick
          python -m pip install aafigure
          ~/.local/bin/aafigure --version

      - name: spell-check
        run: |
          cd docs
          make AAFIGURE=~/.local/bin/aafigure RST2HTML=rst2html spell-check html

      - name: build docs
        run: |
          cd docs
          make AAFIGURE=~/.local/bin/aafigure RST2HTML=rst2html
