-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (52 loc) · 2.11 KB
/
pact-provider-verification.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Pact Provider Verification
on:
repository_dispatch:
types: [provider-verification]
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test:
name: Provider verification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make build up
- run: go build -o ./api-test/tester ./api-test && chmod +x ./api-test/tester
- run: cat ./docs/example-lpa.json | AWS_ACCESS_KEY_ID=x AWS_SECRET_ACCESS_KEY=x ./api-test/tester -jwtSecret=secret -expectedStatus=201 REQUEST PUT http://localhost:9000/lpas/M-3467-89QW-ERTY "`xargs -0`"
- run: export JWT=$(./api-test/tester -jwtSecret=secret JWT)
- name: Verify specified Pact
if: ${{ github.event_name == 'repository_dispatch' }}
run: |
docker-compose run --rm pact-verifier \
--header="X-Jwt-Authorization: Bearer $JWT" \
--provider-version=$(git rev-parse HEAD) \
--provider-branch=main \
--publish \
--user=admin \
--password=${{ secrets.PACT_BROKER_PASSWORD }} \
--url=${{ github.event.client_payload.pact_url }}
- name: Verify pacts, including pending
if: ${{ github.event_name == 'push' }}
run: |
docker-compose run --rm pact-verifier \
--header="X-Jwt-Authorization: Bearer $JWT" \
--provider-version=$(git rev-parse HEAD) \
--provider-branch=main \
--publish \
--user=admin \
--password=${{ secrets.PACT_BROKER_PASSWORD }} \
--consumer-version-selectors='{"mainBranch": true}' \
--enable-pending
- name: Verify pacts are still upheld
if: ${{ github.event_name == 'pull_request' }}
run: |
docker-compose run --rm pact-verifier \
--header="X-Jwt-Authorization=Bearer $JWT" \
--provider-version=$(git rev-parse HEAD) \
--provider-branch=${{ github.head_ref }} \
--consumer-version-selectors='{"branch": "VEGA2174_lpastore_service"}'
# --consumer-version-selectors='{"mainBranch": true}'