name: test

on:
  push:
    branches:
      - main
      - dev
    paths-ignore:
      - '**.md'
      - '.github/**'
      - '!.github/workflows/debug.yml'
  pull_request:
    branches:
      - main
      - dev

jobs:
  build:
    name: Linux
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: ^1.25.0
      - name: Build
        run: |
          make test
          go test -c -o ping_test ./ping
          sudo ./ping_test -test.v
  build_go124:
    name: Linux (Go 1.24)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: ~1.24
        continue-on-error: true
      - name: Build
        run: |
          make test
          go test -c -o ping_test ./ping
          sudo ./ping_test -test.v
  build_go123:
    name: Linux (Go 1.23)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: ~1.23
        continue-on-error: true
      - name: Build
        run: |
          make test
          go test -c -o ping_test ./ping
          sudo ./ping_test -test.v
  build_windows:
    name: Windows
    runs-on: windows-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: ^1.23
        continue-on-error: true
      - name: Build
        run: |
          make test
          go test -v ./ping
  build_darwin:
    name: macOS
    runs-on: macos-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: ^1.23
        continue-on-error: true
      - name: Build
        run: |
          make test
          go test -v ./ping
          go test -c -o ping_test ./ping
          sudo ./ping_test -test.v