name: Go

on: [push, pull_request]

jobs:

  build:
    name: build
    runs-on: ubuntu-latest
    steps:

    - name: Set up Go 1.x
      uses: actions/setup-go@v2
      with:
        go-version: ^1.15

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

    - name: fmt
      run: IS_CONTAINER=yes make fmt

    - name: Build
      run: make all

  test:
    name: test
    runs-on: ubuntu-latest
    steps:

    - name: Set up Go 1.x
      uses: actions/setup-go@v2
      with:
        go-version: ^1.15

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

    - name: test pkg
      run: make test-pkg

    - name: test controllers on opensfhit
      run: CLUSTER_TYPE=openshift make test-controllers

