name: pull_request

on:
  pull_request:
    branches:
      - master

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-python@v2
        with:
          python-version: "3.6.x"

      - uses: actions/cache@v2
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      - name: Requirements
        run: make requirements

      - name: Build
        run: make build

      - name: Formatting check (black)
        run: make check-fmt

      - name: Lint Python check (pylint)
        run: make check-lint-python

      - name: Lint reStructuredText check (rst-lint)
        run: make check-lint-rst

      - name: Type check (mypy)
        run: make check-type

      - name: Test
        run: make test
