name: 🧪 Build and Test

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
    paths:
      - src/**
      - .github/workflows/**
      - docker/**
  # Allow manual trigger
  workflow_dispatch:

jobs:
  build-and-test:
    uses: hotosm/gh-workflows/.github/workflows/test_compose.yml@1.4.1
    with:
      image_name: ghcr.io/${{ github.repository }}
      build_dockerfile: docker/underpass.dockerfile
      compose_service: underpass
      compose_command: '"make check -j $(nproc)"'
      tag_override: ci
      # TODO update postgis image to use github repo var ${{ vars.UNDERPASSDB_TAG }}
      cache_extra_imgs: |
        "docker.io/postgis/postgis:15-3.3-alpine"