Update bazel build image. (#388) #769
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ^1.17 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Install kubebuilder | |
# see kubebuilder book: https://book.kubebuilder.io/quick-start.html | |
run: | | |
version="3.1.0" | |
os=$(go env GOOS) | |
arch=$(go env GOARCH) | |
curl -L -o kubebuilder https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/kubebuilder_${os}_${arch} | |
sudo chmod +x kubebuilder | |
sudo mv kubebuilder /usr/local/ | |
- name: Get go dependencies | |
run: | | |
go install -v ./... | |
go install -v golang.org/x/lint/golint | |
go install -v golang.org/x/tools/cmd/goimports | |
- name: Check for format and lint issues | |
run: | | |
# see https://github.com/golang/go/issues/24230 | |
fmtcode="$(gofmt -s -d -l .)" | |
echo $fmtcode && test -z "$fmtcode" | |
lintcode="$(golint ./...)" | |
echo $lintcode && test -z "$lintcode" | |
- name: Check imports | |
run: goimports -l . | |
- name: Build | |
run: go build ./... | |
- name: Vet | |
run: make vet | |
- name: Test | |
run: make test |