name: Docker Build

on: [pull_request]

jobs:
  test:
    name: Run unit tests
    runs-on: ubuntu-latest
    env:
      GOPATH: /tmp/go
      GO111MODULE: on
    steps:
      - name: Create GOPATH
        run: mkdir -p /tmp/go

      - uses: actions/setup-go@v3
        with:
          go-version: ">=1.19.0"
          check-latest: true

      - name: Checkout code
        uses: actions/checkout@v2

      - name: Run database
        run: docker-compose up -d

      - name: Run unit tests
        run: |
          sleep 45
          make dbtest
