Enable codegen check and pin specific version (#53)

* pin controller-gen with version v0.4.1

* update workflow yaml
This commit is contained in:
Hongcai Ren 2020-12-04 11:18:01 +08:00 committed by GitHub
parent 8553359816
commit 2e7d385163
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 20 deletions

50
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: CI Workflow
on:
# Run this workflow every time a new commit pushed to upstream/fork repository.
# Run workflow on fork repository will help contributors find and resolve issues before sending a PR.
push:
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# the version of golangci-lint.
version: v1.32.2
# show only new issues if it's a pull request.
only-new-issues: false
codegen:
name: codegen, crdgen
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
- name: verify codegen
run: hack/verify-codegen.sh
- name: verify crdgen
run: hack/verify-crdgen.sh
build:
name: compile binary and images
needs: codegen # rely on codegen successful completion
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
- name: compile
run: make all
- name: make images
run: make images

View File

@ -1,20 +0,0 @@
name: golangci-lint
on:
# Run this workflow every time a new commit pushed to upstream/fork repository.
# Run workflow on fork repository will help contributors find and resolve issues before sending a PR.
push:
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# the version of golangci-lint.
version: v1.32.2
# show only new issues if it's a pull request.
only-new-issues: false

View File

@ -4,4 +4,13 @@ set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
CONTROLLER_GEN_VERSION="v0.4.1"
# Install tools we need.
TEMP_PATH=$(mktemp -d)
pushd "${TEMP_PATH}" >/dev/null
GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@"${CONTROLLER_GEN_VERSION}"
popd >/dev/null
rm -rf "${TEMP_PATH}"
controller-gen crd paths=./pkg/apis/... output:crd:dir=./artifacts/deploy controller-gen crd paths=./pkg/apis/... output:crd:dir=./artifacts/deploy