Project
Cross-language contract testing with Pact + Broker
Cross-language contract testing monorepo that connects a Python consumer with a Java/Spring Boot provider through Pact Broker, with a complete workflow for publishing, verification and deployment gating.
Overview
Cross-language contract testing project between a Python consumer and a Java/Spring Boot provider, using Pact Broker on Docker and PostgreSQL to publish and verify contracts. The workflow includes commit-based versioning, verification through the Broker and real gating with can-i-deploy in GitHub Actions to block deployments when breaking changes appear.
Stack: Pact, Pact Broker, Python, Java, Spring Boot, Docker, PostgreSQL, GitHub Actions
What it does
The project aims to prevent silent breakages between services or teams that evolve separately. The consumer publishes the contract it expects, the provider verifies it in its build, and can-i-deploy blocks deployment when there is no valid verification or when a breaking change appears.
How it is built
The solution is organised as a monorepo with apps/consumer-python, apps/provider-java and infrastructure to run Pact Broker with PostgreSQL on Docker. It implements three real contracts, Auth, Catalog and Checkout, and in the last one the provider persists orders in H2 with JPA and returns a generated orderId.
What it validates or automates
The end-to-end workflow runs pytest in the consumer to generate the pact JSON, publishes the contract to the Broker with commit-based versioning, verifies the provider through the Broker and publishes the results. Then, can-i-deploy queries the Broker to decide whether deployment should be allowed, and GitHub Actions leaves artifacts such as pacts and provider-surefire-reports.
Key points
- Python consumer and Java/Spring Boot provider with real contracts between both sides.
- Pact Broker on Docker with PostgreSQL and commit-based versioning to publish and verify contracts.
- Real gating with can-i-deploy in GitHub Actions to block deployments with breaking changes.