name: Integration Test

on:
  push:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Go
        uses: actions/setup-go@v2
        with:
            go-version: 1.18
      - name: Build
        run: |
         env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build main.go
         cd netclient
         env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go
         env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build main.go
         env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go
         env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go
  tests:
    env:
      DATABASE: sqlite
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest, windows-latest]
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.17
      - name: run tests
        run: |
            go test -p 1 ./... -v
        env:
          DATABASE: sqlite
          CLIENT_MODE: "off"

