Skip to content

Commit ee674c5

Browse files
authored
Introduce verify github action (#127)
* Remove metadata from bindata * Introduce verify github action Problem: It is possible to commit changes to the repo without updating generated files. Solution: Introduce a GitHub Action which ensures that generated files are up to date.
1 parent d805371 commit ee674c5

File tree

4 files changed

+33
-10
lines changed

4 files changed

+33
-10
lines changed

.github/workflows/verify.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: verify
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
paths:
8+
- '**'
9+
jobs:
10+
verify:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-go@v2
15+
with:
16+
go-version: '~1.16'
17+
- name: Run the verify target
18+
run: |
19+
export GOPATH=$(go env GOPATH)
20+
make verify

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ install: ## Build & install operator-verify
3636
$(BUILD_PATH)
3737

3838
# Code management.
39-
.PHONY: format tidy clean vendor generate
39+
.PHONY: format tidy clean vendor generate manifests
4040

4141
format: ## Format the source code
4242
$(Q)go fmt $(PKGS)
@@ -77,14 +77,17 @@ manifests: controller-gen ## Generate manifests e.g. CRD, RBAC etc
7777
$(Q)go generate ./crds/...
7878

7979
# Static tests.
80-
.PHONY: test test-unit
80+
.PHONY: test test-unit verify
8181

8282
test: test-unit ## Run the tests
8383

8484
TEST_PKGS:=$(shell go list ./...)
8585
test-unit: ## Run the unit tests
8686
$(Q)go test -count=1 -short ${TEST_PKGS}
8787

88+
verify: manifests generate
89+
git diff --exit-code
90+
8891
# Utilities.
8992
.PHONY: controller-gen
9093

crds/defs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package crds
22

33
// Generate embedded files from CRDs to avoid file path changes when this package is imported.
4-
//go:generate go run github.com/go-bindata/go-bindata/v3/go-bindata -pkg crds -o zz_defs.go -ignore=.*\.go .
4+
//go:generate go run github.com/go-bindata/go-bindata/v3/go-bindata -pkg crds -o zz_defs.go -ignore=.*\.go -nometadata .
55

66
import (
77
"bytes"

crds/zz_defs.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)