Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): master - Pact V2 Update #21

Merged
merged 33 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4b0aec5
chore: add unit/integration test flags
Dec 1, 2019
e354058
feat: use local broker running on docker instead of test.pact.dius.co…
Jan 6, 2020
5a16df0
Fix spelling mistake
Jan 20, 2020
0bc21f6
Merge pull request #2 from aceslick911/fix/step-11-spelling-issue
mefellows Feb 4, 2020
ca3e9b8
chore: upgrade to pact 1.5
mefellows Oct 9, 2020
2aa4b50
chore: cleanup provider test, show error if fails
mefellows Oct 9, 2020
f44f926
chore: update vendor dir
mefellows Oct 9, 2020
bfe7315
fix: actual client code produced bad token
mefellows Dec 22, 2020
b093669
chore: update broker url from test.pact.dius.com.au
YOU54F Jan 19, 2024
59b41ec
chore: updates to pact-go 1.7.0 and branches
YOU54F Jan 19, 2024
58ea174
Merge branch 'step11'
YOU54F Jan 19, 2024
d06f356
chore: missing vendor files post merge
YOU54F Jan 19, 2024
93a8f0c
chore: update docker-compose for latest broker
YOU54F Jan 19, 2024
c4f39c4
chore: update vendor pact-go v2
YOU54F Jan 19, 2024
7dfeb5e
feat: client test update -> pact-go v2
YOU54F Jan 19, 2024
1333cfa
chore: update vendor pact-go v2
YOU54F Jan 19, 2024
75af461
chore: update go mod pact-go v2
YOU54F Jan 19, 2024
3f37597
feat: provider test update -> pact-go v2
YOU54F Jan 19, 2024
6d988fd
fix: update content-type to application/json
YOU54F Jan 19, 2024
e80f5aa
ci: add ci workflow
YOU54F Jan 19, 2024
eee5ea2
chore: rm vendor
YOU54F Jan 19, 2024
31f1086
ci: sudo install due to non usr writable lcn
YOU54F Jan 19, 2024
bf0ca98
chore: address shell issue
YOU54F Jan 19, 2024
3a8888c
chore: ordering
YOU54F Jan 19, 2024
a52295b
chore: missing sep
YOU54F Jan 19, 2024
195804b
chore: readme updates
YOU54F Feb 2, 2024
c7a6ddd
chore: readme updates
YOU54F Feb 2, 2024
da39858
ci: step11
YOU54F Feb 2, 2024
fa58c0b
ci: step10 readme updates
YOU54F Feb 2, 2024
03bde7a
chore: pact name changed in v2
YOU54F Feb 2, 2024
43819e1
chore: PactFiles not PactUrls
YOU54F Feb 2, 2024
14ab6d3
chore: align readme - prior tests dont have token
YOU54F Feb 2, 2024
fd13313
ci: run against step11 and master
YOU54F Feb 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Pact-Workshop(GoLang)

on:
push:
branches:
- step11
- master
pull_request:
branches:
- step11
- master

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: install
run: make install
- name: install_pact_ffi_lib
run: make install_pact_ffi_lib
- name: consumer unit tests
run: make unit
- name: consumer pact tests
run: make consumer
- uses: KengoTODA/actions-setup-docker-compose@v1
if: ${{ env.ACT }}
name: Install `docker-compose` for use with act
with:
version: '2.24.1'
- name: start pact broker
run: make broker
- name: publish consumer pacts
run: make publish
- name: provider pact tests
run: make provider
- name: provider check safe to deploy
run: make deploy-provider
- name: provider record deployment
run: make record-deploy-provider
- name: consumer check safe to deploy
run: make record-deploy-consumer
- name: consumer check safe to deploy
run: make deploy-consumer
- name: consumer record deployment
run: make record-deploy-consumer

45 changes: 35 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ install:
curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh | bash;\
fi

install_pact_ffi_lib:
go install github.com/pact-foundation/pact-go/[email protected]
sudo mkdir -p /usr/local/lib/
sudo $$HOME/go/bin/pact-go -l DEBUG install

run-consumer:
@go run consumer/client/cmd/main.go

Expand All @@ -19,7 +24,8 @@ deploy-consumer: install
--broker-base-url ${PACT_BROKER_PROTO}://$(PACT_BROKER_URL) \
--broker-username $(PACT_BROKER_USERNAME) \
--broker-password $(PACT_BROKER_PASSWORD) \
--latest
--version ${VERSION_COMMIT} \
--to-environment production

deploy-provider: install
@echo "--- ✅ Checking if we can deploy provider"
Expand All @@ -28,31 +34,50 @@ deploy-provider: install
--broker-base-url ${PACT_BROKER_PROTO}://$(PACT_BROKER_URL) \
--broker-username $(PACT_BROKER_USERNAME) \
--broker-password $(PACT_BROKER_PASSWORD) \
--latest
--version ${VERSION_COMMIT} \
--to-environment production
record-deploy-consumer: install
@echo "--- ✅ Recording deployment of consumer"
pact-broker record-deployment \
--pacticipant $(CONSUMER_NAME) \
--broker-base-url ${PACT_BROKER_PROTO}://$(PACT_BROKER_URL) \
--broker-username $(PACT_BROKER_USERNAME) \
--broker-password $(PACT_BROKER_PASSWORD) \
--version ${VERSION_COMMIT} \
--environment production
record-deploy-provider: install
@echo "--- ✅ Recording deployment of provider"
pact-broker record-deployment \
--pacticipant $(PROVIDER_NAME) \
--broker-base-url ${PACT_BROKER_PROTO}://$(PACT_BROKER_URL) \
--broker-username $(PACT_BROKER_USERNAME) \
--broker-password $(PACT_BROKER_PASSWORD) \
--version ${VERSION_COMMIT} \
--environment production

publish: install
publish:
@echo "--- 📝 Publishing Pacts"
go run consumer/client/pact/publish.go
pact/bin/pact-broker publish ${PWD}/pacts --consumer-app-version ${VERSION_COMMIT} --branch ${VERSION_BRANCH} \
-b $(PACT_BROKER_PROTO)://$(PACT_BROKER_URL) -u ${PACT_BROKER_USERNAME} -p ${PACT_BROKER_PASSWORD}
@echo
@echo "Pact contract publishing complete!"
@echo
@echo "Head over to $(PACT_BROKER_PROTO)://$(PACT_BROKER_URL) and login with"
@echo "=> Username: $(PACT_BROKER_USERNAME)"
@echo "=> Password: $(PACT_BROKER_PASSWORD)"
@echo "Head over to $(PACT_BROKER_PROTO)://$(PACT_BROKER_URL) and login with $(PACT_BROKER_USERNAME)/$(PACT_BROKER_PASSWORD)"
@echo "to see your published contracts. "

unit:
@echo "--- 🔨Running Unit tests "
go test github.com/pact-foundation/pact-workshop-go/consumer/client -run 'TestClientUnit'
go test -tags=unit -count=1 github.com/pact-foundation/pact-workshop-go/consumer/client -run 'TestClientUnit'

consumer: export PACT_TEST := true
consumer: install
@echo "--- 🔨Running Consumer Pact tests "
go test -count=1 github.com/pact-foundation/pact-workshop-go/consumer/client -run 'TestClientPact'
go test -tags=integration -count=1 github.com/pact-foundation/pact-workshop-go/consumer/client -run 'TestClientPact'

provider: export PACT_TEST := true
provider: install
@echo "--- 🔨Running Provider Pact tests "
go test -count=1 -tags=integration github.com/pact-foundation/pact-workshop-go/provider -run "TestPactProvider"

broker:
docker-compose up -d
.PHONY: install deploy-consumer deploy-provider publish unit consumer provider
Loading
Loading