-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5203 from varshaprasad96/add/goapi-diff
[Chore] Enable go-api-diff checker
- Loading branch information
Showing
3 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: APIDiff | ||
|
||
# Trigger the workflow on pull requests and direct pushes to any branch | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
go-apidiff: | ||
name: Verify API differences | ||
runs-on: ubuntu-latest | ||
# Pull requests from different repository only trigger this checks | ||
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) | ||
steps: | ||
- name: Clone the code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.work | ||
- name: Execute go-apidiff | ||
uses: joelanford/[email protected] | ||
with: | ||
compare-imports: true | ||
print-compatible: true | ||
- name: Report failure | ||
uses: nashmaniac/[email protected] | ||
# Only report failures of pushes (PRs have are visible through the Checks section) to the default branch | ||
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
with: | ||
title: 🐛 go-apidiff failed for ${{ github.sha }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
labels: kind/bug | ||
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,14 @@ check-license: $(MYGOBIN)/addlicense | |
lint: $(MYGOBIN)/golangci-lint $(MYGOBIN)/goimports $(builtinplugins) | ||
./hack/for-each-module.sh "make lint" | ||
|
||
.PHONY: apidiff | ||
apidiff: go-apidiff ## Run the go-apidiff to verify any API differences compared with origin/master | ||
$(GOBIN)/go-apidiff master --compare-imports --print-compatible --repo-path=. | ||
|
||
.PHONY: go-apidiff | ||
go-apidiff: | ||
go install github.com/joelanford/[email protected] | ||
|
||
.PHONY: test-unit-all | ||
test-unit-all: \ | ||
test-unit-non-plugin \ | ||
|
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