---

name: Lint

"on":
  pull_request:
    branches:
      - main
  schedule:
    # Run on the 10th of each month at noon.
    - cron: "00 12 10 * *"
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:

  test:
    name: lint
    runs-on: ubuntu-latest

    strategy:
      max-parallel: 2
      matrix:
        ansible: ["2.16", "latest"]

    steps:
      - name: Check out the codebase
        uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"
          cache: "pip"
          cache-dependency-path: .requirements/${{ matrix.ansible }}.txt

      - name: Install/upgrade pip, wheel
        run: pip install --upgrade pip wheel

      - name: Install test dependencies
        run: pip install -r .requirements/${{ matrix.ansible }}.txt

      - name: Run ansible-lint
        run: ansible-lint
