name: 🔨 Build Test
on:
  pull_request:
    paths:
      - '**.go'
      - '**.mod'
  workflow_dispatch:


jobs:  
  build:
    name: Test Builds
    runs-on: ubuntu-latest
    steps:
      - name: Set up Go
        uses: actions/setup-go@v4
        with:
          go-version: 1.19

      - name: Check out code
        uses: actions/checkout@v3

      - name: Build
        run: go build .
        working-directory: cmd/mapcidr/

      - name: Test
        run: go test ./...
        working-directory: .

      - name: Integration Tests
        env:
          GH_ACTION: true
        run: bash run.sh
        working-directory: integration_tests/

      - name: Race Test
        run: go run -race . -cidr 192.168.1.224/30
        working-directory: cmd/mapcidr/