diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml index 0a7e07d9..6e2fa4bb 100644 --- a/.github/workflows/golang.yaml +++ b/.github/workflows/golang.yaml @@ -30,54 +30,74 @@ jobs: steps: - uses: actions/checkout@v4 name: Checkout code + - name: Get Golang version id: vars run: | GOLANG_VERSION=$(./hack/golang-version.sh) echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV + - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GOLANG_VERSION }} + - name: Lint uses: golangci/golangci-lint-action@v6 with: version: latest args: -v --timeout 5m skip-cache: true + - name: Check golang modules run: | make check-vendor make -C deployments/devel check-modules + test: name: Unit test runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 + - name: Get Golang version id: vars run: | GOLANG_VERSION=$(./hack/golang-version.sh) echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV + - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GOLANG_VERSION }} + - run: make test + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.out + fail_ci_if_error: true + verbose: true + build: name: Build runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 + - name: Get Golang version id: vars run: | GOLANG_VERSION=$(./hack/golang-version.sh) echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV + - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ env.GOLANG_VERSION }} + - run: make build