chore: copy pull_request_linting workflow from quay/quay #2060
Workflow file for this run
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: CI | |
on: [pull_request] | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ">=1.17.0" | |
- uses: actions/checkout@v2 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
args: --timeout=3m | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
container: docker.io/library/golang:latest | |
strategy: | |
matrix: | |
platform: [amd64, ppc64le, s390x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Add safe directory | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Go Fmt | |
run: make fmt | |
- name: Go Tidy | |
run: go mod tidy | |
- name: Git Diff | |
run: git diff --exit-code | |
- name: Go Build | |
run: CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.platform }} GO111MODULE=on go build -mod vendor -o manager main.go | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
container: docker.io/library/golang:latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: OS Dependencies | |
run: apt-get update && apt-get install -y tar make gcc | |
- name: Install Kubebuilder | |
run: | | |
os=$(go env GOOS) | |
arch=$(go env GOARCH) | |
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_${os}_${arch}.tar.gz | tar -xz -C /tmp/ | |
mv /tmp/kubebuilder_2.3.1_${os}_${arch} /usr/local/kubebuilder | |
export PATH=$PATH:/usr/local/kubebuilder/bin | |
- name: Tests | |
run: go test -v ./... |