From 21fc8646652f4ea28ee7f855a05f7582607b40f4 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 5 May 2023 13:23:39 +0100 Subject: [PATCH 1/8] ci(test): test on ruby 3.2 and x-plat --- .github/workflows/release_gem.yml | 4 ++-- .github/workflows/test.yml | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release_gem.yml b/.github/workflows/release_gem.yml index 03473611..4d0b0b52 100644 --- a/.github/workflows/release_gem.yml +++ b/.github/workflows/release_gem.yml @@ -10,7 +10,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: ruby-version: '2.6' @@ -28,7 +28,7 @@ jobs: version: ${{ steps.release-gem.outputs.version }} increment: ${{ steps.release-gem.outputs.increment }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - id: release-gem diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09084b14..b884a494 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,28 +4,30 @@ on: [push, pull_request] jobs: test: - runs-on: "ubuntu-latest" + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - ruby_version: ["2.4", "2.7", "3.0"] + ruby_version: ["2.4", "2.7", "3.0", "3.2"] + os: ["ubuntu-latest","windows-latest","macos-latest"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby_version }} bundler-cache: true - run: "bundle exec rake" test-with-active-support: - runs-on: "ubuntu-latest" + runs-on: ${{ matrix.os }} env: BUNDLE_GEMFILE: active-support.gemfile strategy: fail-fast: false matrix: - ruby_version: ["2.7", "3.0"] + ruby_version: ["2.7", "3.0", "3.2"] + os: ["ubuntu-latest","windows-latest","macos-latest"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby_version }} From 82ddf67487ce987f76c331534dbad7169089c956 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 5 May 2023 13:31:42 +0100 Subject: [PATCH 2/8] ci(chore): x-plat - skip cli tests on windows --- spec/integration/cli_docs_spec.rb | 2 +- spec/integration/cli_spec.rb | 2 +- spec/integration/executing_verify_from_wrapper_language_spec.rb | 2 +- spec/spec_helper.rb | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/integration/cli_docs_spec.rb b/spec/integration/cli_docs_spec.rb index 4cf447e1..0a02ef12 100644 --- a/spec/integration/cli_docs_spec.rb +++ b/spec/integration/cli_docs_spec.rb @@ -2,7 +2,7 @@ require 'support/cli' require 'fileutils' -describe "running the pact docs CLI" do +describe "running the pact docs CLI", skip_windows: true do include Pact::Support::CLI diff --git a/spec/integration/cli_spec.rb b/spec/integration/cli_spec.rb index 5debc957..2fafd1ce 100644 --- a/spec/integration/cli_spec.rb +++ b/spec/integration/cli_spec.rb @@ -1,7 +1,7 @@ require 'open3' require 'support/cli' -describe "running the pact verify CLI" do +describe "running the pact verify CLI", skip_windows: true do include Pact::Support::CLI diff --git a/spec/integration/executing_verify_from_wrapper_language_spec.rb b/spec/integration/executing_verify_from_wrapper_language_spec.rb index b25e2f62..53d8e519 100644 --- a/spec/integration/executing_verify_from_wrapper_language_spec.rb +++ b/spec/integration/executing_verify_from_wrapper_language_spec.rb @@ -1,4 +1,4 @@ -RSpec.describe "executing pact verify" do +RSpec.describe "executing pact verify", skip_windows: true do let(:command) { "bundle exec rake pact:verify:test_app:fail > /dev/null" } let(:reports_dir) { 'tmp/spec_reports' } # The config for this is in spec/support/pact_helper.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0195548e..6ee324fc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,7 @@ require './spec/support/warning_silencer' is_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' +is_windows = Gem.win_platform? RSpec.configure do | config | config.include(FakeFS::SpecHelpers, fakefs: true) @@ -25,4 +26,5 @@ config.example_status_persistence_file_path = "./spec/examples.txt" end config.filter_run_excluding skip_jruby: is_jruby + config.filter_run_excluding skip_windows: is_windows end From 4473d63c13df0c68b1f131418d6941aa1fb67e6d Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 5 May 2023 13:56:34 +0100 Subject: [PATCH 3/8] chore(deps): update fakefs gem --- pact.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pact.gemspec b/pact.gemspec index e3a0c556..6f61b828 100644 --- a/pact.gemspec +++ b/pact.gemspec @@ -37,7 +37,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rake', '~> 13.0' gem.add_development_dependency 'webmock', '~> 3.0' - gem.add_development_dependency 'fakefs', '0.5' # 0.6.0 blows up + gem.add_development_dependency 'fakefs', '2.4' # 0.6.0 blows up gem.add_development_dependency 'hashie', '~> 2.0' gem.add_development_dependency 'faraday', '~>1.0', '<3.0' gem.add_development_dependency 'faraday-multipart', '~> 1.0' From 7f54defb8d8dbee2c3ee5445cfa55803ecc062f7 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 5 May 2023 13:57:27 +0100 Subject: [PATCH 4/8] ci(test): drop testing of ruby 2.4 --- .github/workflows/release_gem.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_gem.yml b/.github/workflows/release_gem.yml index 4d0b0b52..192c23b8 100644 --- a/.github/workflows/release_gem.yml +++ b/.github/workflows/release_gem.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: '2.6' + ruby-version: '2.7' - run: | gem install bundler -v 2.1 bundle install diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b884a494..6723b012 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - ruby_version: ["2.4", "2.7", "3.0", "3.2"] + ruby_version: ["2.7", "3.0", "3.2"] os: ["ubuntu-latest","windows-latest","macos-latest"] steps: - uses: actions/checkout@v3 From 057bc51685bf31d40eac22a32dec6f28353fd66f Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 5 May 2023 15:19:33 +0100 Subject: [PATCH 5/8] ci(chore): run all shells with bash by default --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6723b012..3d9783c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,9 @@ jobs: matrix: ruby_version: ["2.7", "3.0", "3.2"] os: ["ubuntu-latest","windows-latest","macos-latest"] + defaults: + run: + shell: bash steps: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 @@ -26,6 +29,9 @@ jobs: matrix: ruby_version: ["2.7", "3.0", "3.2"] os: ["ubuntu-latest","windows-latest","macos-latest"] + defaults: + run: + shell: bash steps: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 From e417219e3b673b13fb264e5239d6bb0f9017d1aa Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 5 May 2023 16:06:53 +0100 Subject: [PATCH 6/8] chore: replace port 1234 with 8888 --- example/zoo-app/spec/service_providers/pact_helper.rb | 2 +- spec/features/consumption_spec.rb | 4 ++-- spec/integration/pact/consumer_configuration_spec.rb | 4 ++-- spec/lib/pact/consumer/configuration_spec.rb | 2 +- spec/lib/pact/consumer/consumer_contract_builder_spec.rb | 4 ++-- spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb | 8 ++++---- spec/service_providers/helper.rb | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/example/zoo-app/spec/service_providers/pact_helper.rb b/example/zoo-app/spec/service_providers/pact_helper.rb index 5314229e..592e71f9 100644 --- a/example/zoo-app/spec/service_providers/pact_helper.rb +++ b/example/zoo-app/spec/service_providers/pact_helper.rb @@ -8,7 +8,7 @@ Pact.service_consumer 'Zoo App' do has_pact_with "Animal Service" do mock_service :animal_service do - port 1234 + port 8888 pact_specification_version "2.0.0" end end diff --git a/spec/features/consumption_spec.rb b/spec/features/consumption_spec.rb index f7143da4..16b7d97d 100644 --- a/spec/features/consumption_spec.rb +++ b/spec/features/consumption_spec.rb @@ -19,7 +19,7 @@ has_pact_with "Alice Service" do mock_service :alice_service do verify true - port 1234 + port 8888 end end @@ -76,7 +76,7 @@ }) - alice_response = Net::HTTP.get_response(URI('http://localhost:1234/mallory')) + alice_response = Net::HTTP.get_response(URI('http://localhost:8888/mallory')) expect(alice_response.code).to eql '200' expect(alice_response['Content-Type']).to eql 'text/html' diff --git a/spec/integration/pact/consumer_configuration_spec.rb b/spec/integration/pact/consumer_configuration_spec.rb index 0614575e..272e3cdf 100644 --- a/spec/integration/pact/consumer_configuration_spec.rb +++ b/spec/integration/pact/consumer_configuration_spec.rb @@ -27,7 +27,7 @@ class TestHelper has_pact_with "My Service" do mock_service :my_service do - port 1234 + port 8888 standalone true end end @@ -52,7 +52,7 @@ class TestHelper context "when standalone is true" do it "is not registerd with the AppManager" do - expect(Pact::MockService::AppManager.instance.app_registered_on?(1234)).to eq false + expect(Pact::MockService::AppManager.instance.app_registered_on?(8888)).to eq false end end diff --git a/spec/lib/pact/consumer/configuration_spec.rb b/spec/lib/pact/consumer/configuration_spec.rb index 4c02bfe1..edde7a8e 100644 --- a/spec/lib/pact/consumer/configuration_spec.rb +++ b/spec/lib/pact/consumer/configuration_spec.rb @@ -6,7 +6,7 @@ module Pact::Consumer::Configuration describe MockService do let(:world) { Pact::Consumer::World.new } - let(:port_number) { 1234 } + let(:port_number) { 8888 } before do Pact.clear_configuration allow(Pact::MockService::AppManager.instance).to receive(:register_mock_service_for).and_return(port_number) diff --git a/spec/lib/pact/consumer/consumer_contract_builder_spec.rb b/spec/lib/pact/consumer/consumer_contract_builder_spec.rb index ebb5789a..3f35a070 100644 --- a/spec/lib/pact/consumer/consumer_contract_builder_spec.rb +++ b/spec/lib/pact/consumer/consumer_contract_builder_spec.rb @@ -72,12 +72,12 @@ module Consumer consumer_name: consumer_name, provider_name: provider_name, host: 'localhost', - port: 1234 + port: 8888 ) end it "returns the mock service base URL" do - expect(subject.mock_service_base_url).to eq("http://localhost:1234") + expect(subject.mock_service_base_url).to eq("http://localhost:8888") end end diff --git a/spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb b/spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb index 791bfbf7..c2126190 100644 --- a/spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb +++ b/spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb @@ -32,7 +32,7 @@ module RSpec let(:examples) { [example, example, example_2]} let(:output) { StringIO.new } let(:rerun_command) { 'PACT_DESCRIPTION="a description" PACT_PROVIDER_STATE="a state" # an interaction' } - let(:broker_rerun_command) { "rake pact:verify:at[pact_file_uri] PACT_BROKER_INTERACTION_ID=\"1234\" # an interaction" } + let(:broker_rerun_command) { "rake pact:verify:at[pact_file_uri] PACT_BROKER_INTERACTION_ID=\"8888\" # an interaction" } let(:missing_provider_states) { 'missing_provider_states'} let(:summary) { double("summary", failure_count: 1, failed_examples: failed_examples, examples: examples)} let(:pact_executing_language) { 'ruby' } @@ -77,7 +77,7 @@ module RSpec context "when PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER is set" do context "when the _id is populated" do - let(:id) { "1234" } + let(:id) { "8888" } it "prints a list of rerun commands" do expect(output_result).to include(broker_rerun_command) @@ -100,10 +100,10 @@ module RSpec let(:pact_interaction_rerun_command_for_broker) { nil } context "when the _id is populated" do - let(:id) { "1234" } + let(:id) { "8888" } it "prints a list of failed interactions" do - expect(output_result).to include('* an interaction (to re-run just this interaction, set environment variable PACT_BROKER_INTERACTION_ID="1234")') + expect(output_result).to include('* an interaction (to re-run just this interaction, set environment variable PACT_BROKER_INTERACTION_ID="8888")') end end diff --git a/spec/service_providers/helper.rb b/spec/service_providers/helper.rb index 9d41fd1d..7511bf57 100644 --- a/spec/service_providers/helper.rb +++ b/spec/service_providers/helper.rb @@ -3,7 +3,7 @@ Pact.service_consumer 'Pact Ruby' do has_pact_with 'Pact Broker' do mock_service :pact_broker do - port 1234 + port 8888 pact_specification_version '2.0.0' end end From 54a4197d2fa71109d45dca53dd05c51da6eaf81a Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Fri, 5 May 2023 16:08:23 +0100 Subject: [PATCH 7/8] chore: skip some verification tests on windows --- .github/workflows/test.yml | 6 +++--- tasks/pact-test.rake | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3d9783c3..550ea65e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,9 +10,9 @@ jobs: matrix: ruby_version: ["2.7", "3.0", "3.2"] os: ["ubuntu-latest","windows-latest","macos-latest"] - defaults: - run: - shell: bash + # defaults: + # run: + # shell: bash steps: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 diff --git a/tasks/pact-test.rake b/tasks/pact-test.rake index 28247981..7a5e44e2 100644 --- a/tasks/pact-test.rake +++ b/tasks/pact-test.rake @@ -69,6 +69,8 @@ namespace :pact do desc "All the verification tests" task "tests:all" do + next if Gem.win_platform? + Rake::Task['pact:verify:stubbing'].execute Rake::Task['spec:standalone:pass'].execute Rake::Task['pact:verify'].execute From d8d65b60ceff54ea4dfa8565fae3df2bd15bad4b Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 11 May 2023 17:21:13 +0100 Subject: [PATCH 8/8] ci: release with 3.2, add 3.1 to matrix --- .github/workflows/release_gem.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_gem.yml b/.github/workflows/release_gem.yml index 192c23b8..076a8bd9 100644 --- a/.github/workflows/release_gem.yml +++ b/.github/workflows/release_gem.yml @@ -13,9 +13,9 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: '3.2' - run: | - gem install bundler -v 2.1 + gem install bundler -v 2.4 bundle install - name: Test run: bundle exec rake diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 550ea65e..d4152139 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - ruby_version: ["2.7", "3.0", "3.2"] + ruby_version: ["2.7", "3.0", "3.1", "3.2"] os: ["ubuntu-latest","windows-latest","macos-latest"] # defaults: # run: @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - ruby_version: ["2.7", "3.0", "3.2"] + ruby_version: ["2.7", "3.0", "3.1", "3.2"] os: ["ubuntu-latest","windows-latest","macos-latest"] defaults: run: