Skip to content

Commit 02fa398

Browse files
committed
first commit
0 parents  commit 02fa398

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Example Java GraphQL Provider
2+
3+
![Build](https://github.com/pactflow/example-provider-springboot/workflows/Build/badge.svg)
4+
5+
[![Can I deploy Status](https://test.pactflow.io/pacticipants/pactflow-example-provider-springboot/branches/master/latest-version/can-i-deploy/to-environment/production/badge.svg)](https://test.pactflow.io/overview/provider/pactflow-example-provider-springboot/consumer/pactflow-example-consumer-java-junit)
6+
7+
[![Pact Status](https://test.pactflow.io/pacts/provider/pactflow-example-provider-springboot/consumer/pactflow-example-consumer-java-junit/latest/badge.svg)](https://test.pactflow.io/pacts/provider/pactflow-example-provider-springboot/consumer/pactflow-example-consumer-java-junit/latest) (latest pact)
8+
9+
[![Pact Status](https://test.pactflow.io/pacts/provider/pactflow-example-provider-springboot/consumer/pactflow-example-consumer-java-junit/latest/prod/badge.svg)](https://test.pactflow.io/pacts/provider/pactflow-example-provider-springboot/consumer/pactflow-example-consumer-java-junit/latest/prod) (prod/prod pact)
10+
11+
12+
This is an example of a Java Spring Boot GraphQL provider that uses Pact, [PactFlow](https://pactflow.io) and GitHub Actions to ensure that it is compatible with the expectations its consumers have of it.
13+
14+
The project uses a Makefile to simulate a very simple build pipeline with two stages - test and deploy.
15+
16+
It is using a public tenant on PactFlow, which you can access [here](https://test.pactflow.io) using the credentials `dXfltyFMgNOFZAxr8io9wJ37iUpY42M`/`O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1`.
17+
18+
## Project Phases
19+
20+
The project uses a Makefile to simulate a very simple build pipeline with two stages - test and deploy.
21+
22+
- Test
23+
- Run tests (including the pact tests that generate the contract)
24+
- Publish pacts, tagging the consumer version with the name of the current branch
25+
- Check if we are safe to deploy to prod (ie. has the pact content been successfully verified)
26+
- Deploy (only from master)
27+
- Deploy app (just pretend for the purposes of this example!)
28+
- Tag the deployed consumer version as 'prod'
29+
30+
## Dependencies
31+
32+
- Docker
33+
- A [PactFlow](https://pactflow.io) account
34+
- A [read/write API Token](https://docs.pactflow.io/#configuring-your-api-token) from your PactFlow account
35+
- Java 8+ installed
36+
37+
## Usage
38+
39+
See the [PactFlow CI/CD Workshop](https://github.com/pactflow/ci-cd-workshop).
40+
41+
The below commands are designed for a Linux/OSX environment, please translate for use on Windows/PowerShell as necessary:
42+
43+
Please ensure the following environment variables have been exported in the process that you run the tests (generally a terminal):
44+
45+
```
46+
export PACT_BROKER_TOKEN=<your pactflow read/write token here>
47+
export PACT_BROKER_BASE_URL=https://<your pactflow subdomain>.pactflow.io
48+
export PACT_BROKER_HOST=<your pactflow subdomain>.pactflow.io
49+
```
50+
51+
You can run the tests locally with:
52+
53+
```
54+
make test
55+
```
56+
57+
### Simulating CI
58+
59+
Usually, you would integrate this into a real CI system (such as Buildkite/Jenkins/CircleCI etc., or GitHub Actions as this repository is built against).
60+
61+
You can simulate a CI process with the following command:
62+
63+
```
64+
make fake_ci
65+
```

0 commit comments

Comments
 (0)