name: CI Go

on:
  pull_request:
    branches:
      - "main"
      - "release-*"

jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0

    - name: set up golang
      uses: actions/setup-go@v3
      with:
        go-version: 1.21.7

    - name: format
      run: ./hack/check-format.sh

    - name: fix the version
      run: make update-version

    - name: go vetting
      run: make vet

    - name: build
      run: |
        go version
        make all

    - name: test
      run: make test-unit