File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
31
31
GO_INSTALL = ./scripts/go_install.sh
32
32
E2E_CONF_FILE_ENVSUBST := $(REPO_ROOT ) /test/e2e/config/ibmcloud-e2e-envsubst.yaml
33
33
34
+ GO_APIDIFF := $(TOOLS_BIN_DIR ) /go-apidiff
34
35
GOLANGCI_LINT := $(TOOLS_BIN_DIR ) /golangci-lint
35
36
KUSTOMIZE := $(TOOLS_BIN_DIR ) /kustomize
36
37
GOJQ := $(TOOLS_BIN_DIR ) /gojq
@@ -405,6 +406,20 @@ lint: $(GOLANGCI_LINT) ## Lint codebase
405
406
lint-fix : $(GOLANGCI_LINT ) # # Lint the codebase and run auto-fixers if supported by the linter
406
407
GOLANGCI_LINT_EXTRA_ARGS=--fix $(MAKE ) lint
407
408
409
+ APIDIFF_OLD_COMMIT ?= $(shell git rev-parse origin/main)
410
+
411
+ .PHONY : apidiff
412
+ apidiff : $(GO_APIDIFF ) # # Check for API differences.
413
+ @if ($( call checkdiff) | grep " api/" ); then \
414
+ $(GO_APIDIFF ) $(APIDIFF_OLD_COMMIT ) --print-compatible; \
415
+ else \
416
+ echo " No changes to 'api/'. Nothing to do." ; \
417
+ fi
418
+
419
+ define checkdiff
420
+ git --no-pager diff --name-only FETCH_HEAD
421
+ endef
422
+
408
423
ALL_VERIFY_CHECKS = doctoc boilerplate shellcheck modules gen manifests conversions # tiltfile
409
424
410
425
.PHONY : verify
Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ help: # Display this help
52
52
53
53
# #@ hack/tools:
54
54
55
+ GO_APIDIFF := $(BIN_DIR ) /go-apidiff
56
+ $(GO_APIDIFF ) : $(BIN_DIR ) go.mod go.sum # # Build a local copy of go-apidiff.
57
+ go build -tags=tools -o $@ github.com/joelanford/go-apidiff
58
+
55
59
GOLANGCI_LINT := $(BIN_DIR ) /golangci-lint
56
60
$(GOLANGCI_LINT ) : $(BIN_DIR ) go.mod go.sum # # Build a local copy of golangci-lint.
57
61
go build -tags=tools -o $@ github.com/golangci/golangci-lint/cmd/golangci-lint
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Copyright 2022 The Kubernetes Authors.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ set -o errexit
18
+ set -o nounset
19
+ set -o pipefail
20
+
21
+ REPO_ROOT=$( dirname " ${BASH_SOURCE[0]} " ) /..
22
+ # shellcheck source=../hack/ensure-go.sh
23
+ source " ${REPO_ROOT} /hack/ensure-go.sh"
24
+
25
+ cd " ${REPO_ROOT} " && APIDIFF_OLD_COMMIT=" ${PULL_BASE_SHA} " make apidiff
You can’t perform that action at this time.
0 commit comments