on:
  push:

jobs:
  terraform:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup Terraform
        uses: hashicorp/setup-terraform@v3
      - uses: taiki-e/install-action@just
      - name: Init
        run: just terraform init -backend=false
      - name: Lint
        run: just terraform-lint

  ansible:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: 3.11
      - uses: taiki-e/install-action@just

      # HACK: https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
      - name: Fix permissions
        run: chmod 0755 ansible/

      - name: Set up
        run: just ansible-setup
      - name: Lint
        run: just ansible-lint