Update proto breaking CI check to pass on release branches (#1407)

* modify proto check breaking to check against the previous commit by
default

* add additional proto breaking check for pull requests to master

* always check proto breaking against target branch when making a pull
request
This commit is contained in:
Nick DeLuca 2022-11-30 11:02:16 -07:00 committed by GitHub
parent cf009647e6
commit a4de1b7fb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,8 @@
name: Protobuf Checks name: Protobuf Checks
on: on:
push push:
pull_request:
jobs: jobs:
check-proto: check-proto:
@ -19,6 +20,8 @@ jobs:
- run: make check-proto-lint - run: make check-proto-lint
- run: make check-proto-format - run: make check-proto-format
- run: make check-proto-breaking-remote - run: make check-proto-breaking-remote
- run: BUF_CHECK_BREAKING_AGAINST="branch=$GITHUB_BASE_REF" make check-proto-breaking-remote
if: github.event_name == 'pull_request'
- run: make check-proto-gen - run: make check-proto-gen
- run: make check-proto-gen-doc - run: make check-proto-gen-doc
- run: make check-proto-gen-swagger - run: make check-proto-gen-swagger

View File

@ -43,15 +43,17 @@ proto-format: install-build-deps
check-proto-format: proto-format check-proto-format: proto-format
@git diff --exit-code proto/**/*.proto > /dev/null || (echo "Protobuf format is not up to date! Please run \`make proto-format\`."; exit 1) @git diff --exit-code proto/**/*.proto > /dev/null || (echo "Protobuf format is not up to date! Please run \`make proto-format\`."; exit 1)
BUF_CHECK_BREAKING_AGAINST ?= ref=HEAD~1
.PHONY: check-proto-breaking .PHONY: check-proto-breaking
check-proto-breaking: install-build-deps check-proto-breaking: install-build-deps
@echo "Checking for proto backward compatibility" @echo "Checking for proto backward compatibility"
@$(BUF) breaking --against '.git#branch=master' @$(BUF) breaking --against '.git#$(BUF_CHECK_BREAKING_AGAINST)'
.PHONY: check-proto-breaking-remote .PHONY: check-proto-breaking-remote
check-proto-breaking-remote: install-build-deps check-proto-breaking-remote: install-build-deps
@echo "Checking for proto backward compatibility" @echo "Checking for proto backward compatibility"
@$(BUF) breaking --against '$(HTTPS_GIT)#branch=master' @$(BUF) breaking --against '$(HTTPS_GIT)#$(BUF_CHECK_BREAKING_AGAINST)'
.PHONY: proto-gen-all .PHONY: proto-gen-all
proto-gen-all: proto-gen proto-gen-doc proto-gen-swagger proto-gen-all: proto-gen proto-gen-doc proto-gen-swagger