Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 30 additions & 0 deletions .github/workflows/conformance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Conformance
on:
pull_request:
push:
tags: ['v*']
branches:
- 'main'

permissions:
contents: read

jobs:
go:
name: Go
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: [ 'stable', 'oldstable' ]
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Install go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Test conformance
run: make conformance
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ COPYRIGHT_YEARS := 2024-2025
GOLANGCI_LINT_VERSION := v2.4.0
GOLANGCI_LINT := $(BIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
LICENSE_IGNORE := --ignore testdata/
# Set to use a different version of protovalidate-conformance.
# Should be kept in sync with the version referenced in buf.yaml and
# 'buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go' in go.mod.
CONFORMANCE_VERSION ?= v0.14.2

UNAME_OS := $(shell uname -s)
ifeq ($(UNAME_OS),Darwin)
Expand All @@ -33,6 +37,7 @@ help: ## Describe useful make targets
.PHONY: all
all: ## Build, test, and lint (default)
$(MAKE) test
$(MAKE) conformance
$(MAKE) lint

.PHONY: clean
Expand Down Expand Up @@ -74,6 +79,10 @@ lintfix: $(GOLANGCI_LINT) ## Automatically fix some lint errors
buf format -w
go mod tidy

.PHONY: conformance
conformance: $(BIN)/protovalidate-conformance protovalidate-conformance-jsonschema ## Run conformance tests
JSONSCHEMA_DIR=./internal/gen/jsonschema $(BIN)/protovalidate-conformance $(BIN)/protovalidate-conformance-jsonschema --expected_failures=conformance/expected_failures.yaml

.PHONY: install
install: ## Install all binaries
go install ./...
Expand All @@ -82,6 +91,7 @@ install: ## Install all binaries
generate: $(BIN)/license-header $(BIN)/buf ## Regenerate code and licenses
rm -rf internal/gen
buf generate
buf generate buf.build/bufbuild/protovalidate-testing
license-header \
--license-type apache \
--copyright-holder "Buf Technologies, Inc." \
Expand Down Expand Up @@ -121,3 +131,11 @@ $(GOLANGCI_LINT): $(BIN) Makefile

$(BIN)/jv: $(BIN) Makefile
go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest

$(BIN)/protovalidate-conformance: $(BIN) Makefile
GOBIN=$(abspath $(BIN)) go install \
github.com/bufbuild/protovalidate/tools/protovalidate-conformance@$(CONFORMANCE_VERSION)

.PHONY: protovalidate-conformance-jsonschema
protovalidate-conformance-jsonschema: $(BIN)
GOBIN=$(abspath $(BIN)) go install ./internal/cmd/protovalidate-conformance-jsonschema
3 changes: 3 additions & 0 deletions buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ deps:
- name: buf.build/bufbuild/protovalidate
commit: 6c6e0d3c608e4549802254a2eee81bc8
digest: b5:a7ca081f38656fc0f5aaa685cc111d3342876723851b47ca6b80cbb810cbb2380f8c444115c495ada58fa1f85eff44e68dc54a445761c195acdb5e8d9af675b6
- name: buf.build/bufbuild/protovalidate-testing
commit: ed3f62325d2e40d388f399c374c6a70d
digest: b5:7f4f59b65616668a0ca83903d67eb3e89323593d2074777e12e26a584c6ce33dcaf52cfa53ae29edbb52fbd07720881c60b31883ead46d00aee24a8ab17954c5
1 change: 1 addition & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ modules:
- path: internal/proto
deps:
- buf.build/bufbuild/protovalidate
- buf.build/bufbuild/protovalidate-testing#v0.14.2
lint:
except:
- FIELD_NOT_REQUIRED
Expand Down
Loading