name: Backend Test Coverage Check

on:
  push:
    branches:
      - dev

jobs:
  coverage:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: "1.25"
          cache-dependency-path: backend/go.sum

      - name: Run tests with coverage
        working-directory: ./backend
        run: |
          go test -v -coverprofile=coverage.out -covermode=atomic ./internal/handler/... ./internal/service/...

      - name: Check coverage
        uses: vladopajic/go-test-coverage@v2
        with:
          config: ./.gitea/coverage.json
