name: Build
on: [push]
jobs:
  go:
    name: Test Server on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
# TODO Fix tests in Windows
#        os: [macOS-latest, ubuntu-latest, windows-latest]
        os: [macOS-latest, ubuntu-latest]

    steps:
      - name: Set up Go 1.13
        uses: actions/setup-go@v1
        with:
          go-version: 1.13
        id: go

      - name: Check out code into the Go module directory
        uses: actions/checkout@v1

      - name: Download dependencies
        run: go mod download

      - name: Test
        run: go test -cover ./... -v

  js:
    name: Test UI
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 13

      - name: npm install dependencies
        run: |
          cd ui
          npm ci

# TODO: Enable when there are tests to run
#      - name: npm test
#        run: |
#          cd ui
#          CI=test npm test

      - name: npm build
        run: |
          cd ui
          npm run build
