---

name: Lint

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]
  schedule:
    # * is a special character in YAML so you have to quote this string
    # Run at 1:00 every day
    - cron: '0 1 * * *'

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        python-version: ["3.9"]

    steps:
      - uses: actions/checkout@v2
      - name: "Set up Python"
        uses: actions/setup-python@v1
        with:
          python-version: ${{ matrix.python-version }}

      - uses: actions/cache@v2
        with:
          path: ~/.cache/pip
          # This is like the example but we use ``*requirements.txt`` rather
          # than ``requirements.txt`` because we have multiple requirements
          # files.
          key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      - name: "Install dependencies"
        run: |
          python -m pip install --upgrade pip setuptools wheel
          # We use '--ignore-installed' to avoid GitHub's cache which can cause
          # issues - we have seen packages from this cache be cause trouble with
          # pip-extra-reqs.
          python -m pip install --ignore-installed --upgrade --editable .[dev]
          sudo apt-get install -y enchant

      - name: "Lint"
        run: |
          make lint
