name: Build and run
on: [push]

jobs:
  build_n_run:
    name: Build and run
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.19

      - name: Build
        # set rport version to {date-time}-{github-master-head-sha}
        run: go build -v -ldflags="-X 'github.com/cloudradar-monitoring/rport/share.BuildVersion=$(date -u +%y.%m%d.%H%M)-$(git rev-parse HEAD)'"  -o ./ ./cmd/...

      - name: Test Build
        shell: bash
        run: |
          .github/scripts/start_rportd.sh
          .github/scripts/start_rport.sh
