Skip to content

Commit

Permalink
Merge branch 'master' into feat/publish-provider-contracts-using-all-…
Browse files Browse the repository at this point in the history
…in-one-endpoint
  • Loading branch information
bethesque committed Sep 6, 2023
2 parents e85e5a3 + 4451e4f commit fc65cc4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ jobs:
with:
ruby-version: "3.2"
- run: "bundle install"
# Publish to old and new account until we can disable the old account
- run: |
rm -rf spec/pacts/*
bundle exec rspec spec/service_providers/
VERBOSE=true bundle exec rake pact:publish:pactflow
VERBOSE=true bundle exec rake pact:publish:pactflow_oss
VERBOSE=true bundle exec rake pact:publish:pactflow_pact_foundation
env:
PACT_BROKER_TOKEN: ${{ secrets.PACTFLOW_PACT_OSS_TOKEN }}
PACT_BROKER_TOKEN_PACT_FOUNDATION: ${{ secrets.PACT_BROKER_TOKEN_PACT_FOUNDATION }}
PACT_BROKER_FEATURES: ${{ matrix.feature }}
TEST_FEATURE: ${{ matrix.feature }}
can-i-deploy:
Expand Down
37 changes: 29 additions & 8 deletions tasks/pact.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require "pact_broker/client/tasks"
require "pact_broker/client/git"

PactBroker::Client::PublicationTask.new(:localhost) do | task |
require 'pact_broker/client/version'
require "pact_broker/client/version"
task.tag = `git rev-parse --abbrev-ref HEAD`.strip
task.consumer_version = PactBroker::Client::VERSION
task.pact_broker_base_url = "http://localhost:9292"
Expand All @@ -11,25 +11,25 @@ PactBroker::Client::PublicationTask.new(:localhost) do | task |
end

PactBroker::Client::PublicationTask.new(:remote) do | task |
require 'pact_broker/client/version'
require "pact_broker/client/version"
task.tag = `git rev-parse --abbrev-ref HEAD`.strip
task.consumer_version = PactBroker::Client::VERSION
task.pact_broker_base_url = "https://test.pact.dius.com.au"
task.pact_broker_basic_auth = { username: ENV.fetch('PACT_BROKER_USERNAME'), password: ENV.fetch('PACT_BROKER_PASSWORD') }
task.pact_broker_basic_auth = { username: ENV.fetch("PACT_BROKER_USERNAME"), password: ENV.fetch("PACT_BROKER_PASSWORD") }
end

PactBroker::Client::PublicationTask.new(:pactflow) do | task |
version = ENV.fetch('GITHUB_SHA')
branch = ENV.fetch('GITHUB_REF').gsub("refs/heads/", "")
feature = ENV.fetch('TEST_FEATURE', '')
PactBroker::Client::PublicationTask.new(:pactflow_oss) do | task |
version = ENV.fetch("GITHUB_SHA")
branch = ENV.fetch("GITHUB_REF").gsub("refs/heads/", "")
feature = ENV.fetch("TEST_FEATURE", "")
tag = branch

if feature != ''
version = "#{version}+#{feature}"
tag = "#{tag}+#{feature}"
end

require 'pact_broker/client/version'
require "pact_broker/client/version"
task.auto_detect_version_properties = false
task.tags = [tag]
task.branch = nil
Expand All @@ -38,3 +38,24 @@ PactBroker::Client::PublicationTask.new(:pactflow) do | task |
task.pact_broker_token = ENV['PACT_BROKER_TOKEN']
task.build_url = PactBroker::Client::Git.build_url
end

PactBroker::Client::PublicationTask.new(:pactflow_pact_foundation) do | task |
version = ENV.fetch("GITHUB_SHA")
branch = ENV.fetch("GITHUB_REF").gsub("refs/heads/", "")
feature = ENV.fetch("TEST_FEATURE", "")
tag = branch

if feature != ""
version = "#{version}+#{feature}"
tag = "#{tag}+#{feature}"
end

require "pact_broker/client/version"
task.auto_detect_version_properties = false
task.tags = [tag]
task.branch = nil
task.consumer_version = version
task.pact_broker_base_url = "https://pact-foundation.pactflow.io"
task.pact_broker_token = ENV["PACT_BROKER_TOKEN_PACT_FOUNDATION"]
task.build_url = PactBroker::Client::Git.build_url
end

0 comments on commit fc65cc4

Please sign in to comment.