name: Test

on: [push, pull_request]

env:
  GODEBUG: tracebackancestors=1000

jobs:
  test:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest]

    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-go@v5
        with:
          go-version: 1.22

      - name: lint
        if: matrix.os == 'ubuntu-latest'
        run: go run github.com/ysmood/golangci-lint@latest -v 1.59.1

      - name: test
        env:
          TERM: xterm-256color
        run: go test -coverprofile="coverage.out" . ./lib/diff ./lib/lcs ./lib/mock ./lib/utils

      - name: coverage
        if: matrix.os == 'ubuntu-latest'
        run: go run ./cmd/check-cov
