name: Docs

on:
  push:
    branches:
      - master
      - ghatest
  pull_request:
    branches:
      - master
      - ghatest

env:
  CARGO_TERM_COLOR: always

jobs:
  docs:
    runs-on: ubuntu-latest

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

      - name: Set up Python 3.x
        uses: actions/setup-python@v2
        with:
        # Semantic version range syntax or exact version of a Python version
          python-version: '3.x'
          # Optional - x64 or x86 architecture, defaults to x64
          architecture: 'x64'

      # You can test your matrix by printing the current Python version
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"

      - name: Install dependencies
        run: pip install git+https://github.com/linkchecker/linkchecker.git

      - name: Remove cargo-config
        run: rm -f .cargo/config

      - name: Build docs
        run: cargo doc

      - name: Check links
        run: linkchecker README.md CHANGELOG.md src examples tests macros

