-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from YOU54F/step11
chore(deps): master - Pact V2 Update
- Loading branch information
Showing
118 changed files
with
1,347 additions
and
22,782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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" | ||
|
@@ -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 |
Oops, something went wrong.