diff --git a/README.md b/README.md index 94277ade..aa634c27 100644 --- a/README.md +++ b/README.md @@ -21,24 +21,34 @@ This version (2.5.2) of the Pact standalone executables package contains: * [pact-stub-server](https://github.com/pact-foundation/pact-stub-server) * [pact_verifier_cli](https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_verifier_cli) * [pact-plugin-cli](https://github.com/pact-foundation/pact-plugins/tree/main/cli) + * [pact-broker-cli](https://github.com/pact-foundation/pact-broker-cli) Binaries will be extracted into `pact/bin`: ``` ./pact/bin/ ├── pact (central entry point to all binaries) -├── pact-broker -├── pactflow +├── pact-broker-cli ├── pact_mock_server_cli ├── pact-stub-server ├── pact_verifier_cli ├── pact-plugin-cli -├── pact-message (legacy) -├── pact-mock-service (legacy) -├── pact-provider-verifier (legacy) -└── pact-stub-service (legacy) +├── pact-broker (legacy) - use `pact-broker-cli` +├── pactflow (legacy) - use `pact-broker-cli pactflow` +├── pact-message (legacy) - use `pact_mock_server_cli` (consumer) / `pact_verifier_cli` (provider) +├── pact-mock-service (legacy) - use `pact_mock_server_cli` +├── pact-provider-verifier (legacy) - use `pact_verifier_cli` +└── pact-stub-service (legacy) - use `pact-stub-server` ``` +Note: from `v2.6.0+`, the legacy commands will redirect to the new cli executables built in rust. + +Existing behaviour can be preserved by setting the `PACT_CLI_LEGACY` environment variable. + +In `v3.0.0`, the ruby runtime will be removed completely, and all commands will link to the rust executables. + +Longer term, this package is likely to be deprecated, replaced with a single `pact` cli executable. + ### Windows Users Please append `.bat` to any of the provided ruby-based binaries @@ -75,9 +85,14 @@ Ruby is not required on the host platform, Ruby 3.3.9 is provided in the distrib | Linux | 3.3.9 | aarch64 (arm64)| ✅ | | Windows| 3.3.9 | x86_64 | ✅ | | Windows| 3.3.9 | aarch64 (arm64)| 🚧 | +| Windows| N/A. | aarch64 (arm64)| ✅ | 🚧 - Tested under emulation mode x86_64 in Windows on ARM +Windows-arm64 package supports rust based executables only and does not provide an arm64 runtime currently. + +To use ruby packages on windows on arm, please use the x86_64 package. + ## Usage diff --git a/packaging/README.md.template b/packaging/README.md.template index 107dda9c..03872537 100644 --- a/packaging/README.md.template +++ b/packaging/README.md.template @@ -21,24 +21,34 @@ This version (<%= ENV.fetch('VERSION') %>) of the Pact standalone executables pa * [pact-stub-server](https://github.com/pact-foundation/pact-stub-server) * [pact_verifier_cli](https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_verifier_cli) * [pact-plugin-cli](https://github.com/pact-foundation/pact-plugins/tree/main/cli) + * [pact-broker-cli](https://github.com/pact-foundation/pact-broker-cli) Binaries will be extracted into `pact/bin`: ``` ./pact/bin/ ├── pact (central entry point to all binaries) -├── pact-broker -├── pactflow +├── pact-broker-cli ├── pact_mock_server_cli ├── pact-stub-server ├── pact_verifier_cli ├── pact-plugin-cli -├── pact-message (legacy) -├── pact-mock-service (legacy) -├── pact-provider-verifier (legacy) -└── pact-stub-service (legacy) +├── pact-broker (legacy) - use `pact-broker-cli` +├── pactflow (legacy) - use `pact-broker-cli pactflow` +├── pact-message (legacy) - use `pact_mock_server_cli` (consumer) / `pact_verifier_cli` (provider) +├── pact-mock-service (legacy) - use `pact_mock_server_cli` +├── pact-provider-verifier (legacy) - use `pact_verifier_cli` +└── pact-stub-service (legacy) - use `pact-stub-server` ``` +Note: from `v2.6.0+`, the legacy commands will redirect to the new cli executables built in rust. + +Existing behaviour can be preserved by setting the `PACT_CLI_LEGACY` environment variable. + +In `v3.0.0`, the ruby runtime will be removed completely, and all commands will link to the rust executables. + +Longer term, this package is likely to be deprecated, replaced with a single `pact` cli executable. + ### Windows Users Please append `.bat` to any of the provided ruby-based binaries @@ -74,7 +84,13 @@ Ruby is not required on the host platform, Ruby 3.3.9 is provided in the distrib | Linux | 3.3.9 | x86_64 | ✅ | | Linux | 3.3.9 | aarch64 (arm64)| ✅ | | Windows| 3.3.9 | x86_64 | ✅ | -| Windows| 3.3.9 | aarch64 (arm64)| 🚧 | +| Windows| N/A. | aarch64 (arm64)| ✅ | + +🚧 - Tested under emulation mode x86_64 in Windows on ARM + +Windows-arm64 package supports rust based executables only and does not provide an arm64 runtime currently. + +To use ruby packages on windows on arm, please use the x86_64 package. 🚧 - Tested under emulation mode x86_64 in Windows on ARM diff --git a/packaging/pact-broker.bat b/packaging/pact-broker.bat index c0f50d01..fc5d38a2 100644 --- a/packaging/pact-broker.bat +++ b/packaging/pact-broker.bat @@ -3,6 +3,16 @@ SET RUNNING_PATH=%~dp0 CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH +IF NOT DEFINED PACT_CLI_LEGACY ( + IF "%~1"=="" ( + %RUNNING_PATH%pact-broker-cli.exe --help + EXIT /B %ERRORLEVEL% + ) ELSE ( + %RUNNING_PATH%pact-broker-cli.exe %* + EXIT /B %ERRORLEVEL% + ) +) + :: Tell Bundler where the Gemfile and gems are. set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile" set BUNDLE_IGNORE_CONFIG= diff --git a/packaging/pact-broker.sh b/packaging/pact-broker.sh index 8be616ff..fb68e617 100755 --- a/packaging/pact-broker.sh +++ b/packaging/pact-broker.sh @@ -15,6 +15,18 @@ done RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +if [ -z "${PACT_CLI_LEGACY}" ]; then + APP="$DIR/pact-broker-cli" + if [ -x "$APP" ]; then + if [ "$#" -eq 0 ]; then + exec "$APP" --help + else + exec "$APP" "$@" + fi + exit $? + fi +fi + # Figure out where this script is located. LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" diff --git a/packaging/pact-message.bat b/packaging/pact-message.bat index 8ef3c6d0..0154702b 100644 --- a/packaging/pact-message.bat +++ b/packaging/pact-message.bat @@ -3,6 +3,12 @@ SET RUNNING_PATH=%~dp0 CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH +IF NOT DEFINED PACT_CLI_LEGACY ( + echo pact-message is deprecated. Please use pact_mock_server_cli instead. + echo or set the PACT_CLI_LEGACY environment variable to use the old CLI. + EXIT /B 1 +) + :: Tell Bundler where the Gemfile and gems are. set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile" set BUNDLE_IGNORE_CONFIG= diff --git a/packaging/pact-message.sh b/packaging/pact-message.sh index 13cb9bf1..b79a2ed4 100755 --- a/packaging/pact-message.sh +++ b/packaging/pact-message.sh @@ -15,6 +15,12 @@ done RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +if [ -z "${PACT_CLI_LEGACY}" ]; then + echo "pact-message is deprecated. Please use pact_mock_server_cli instead." + echo "or set the PACT_CLI_LEGACY environment variable to use the old CLI." + exit 1 +fi + # Figure out where this script is located. LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" diff --git a/packaging/pact-mock-service.bat b/packaging/pact-mock-service.bat index 7dffdf5e..eceed231 100644 --- a/packaging/pact-mock-service.bat +++ b/packaging/pact-mock-service.bat @@ -3,6 +3,11 @@ SET RUNNING_PATH=%~dp0 CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH +IF NOT DEFINED PACT_CLI_LEGACY ( + %RUNNING_PATH%pact_mock_server_cli.exe %* + EXIT /B %ERRORLEVEL% +) + :: Tell Bundler where the Gemfile and gems are. set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile" set BUNDLE_IGNORE_CONFIG= diff --git a/packaging/pact-mock-service.sh b/packaging/pact-mock-service.sh index db5e2786..46289111 100755 --- a/packaging/pact-mock-service.sh +++ b/packaging/pact-mock-service.sh @@ -15,6 +15,14 @@ done RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +if [ -z "${PACT_CLI_LEGACY}" ]; then + APP="$DIR/pact_mock_server_cli" + if [ -x "$APP" ]; then + exec "$APP" "$@" + exit $? + fi +fi + # Figure out where this script is located. LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" diff --git a/packaging/pact-provider-verifier.bat b/packaging/pact-provider-verifier.bat index 4cad4713..9589bdf4 100644 --- a/packaging/pact-provider-verifier.bat +++ b/packaging/pact-provider-verifier.bat @@ -3,6 +3,11 @@ SET RUNNING_PATH=%~dp0 CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH +IF NOT DEFINED PACT_CLI_LEGACY ( + %RUNNING_PATH%pact_verifier_cli.exe %* + EXIT /B %ERRORLEVEL% +) + :: Tell Bundler where the Gemfile and gems are. set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile" set BUNDLE_IGNORE_CONFIG= diff --git a/packaging/pact-provider-verifier.sh b/packaging/pact-provider-verifier.sh index 8e2e7726..2899c189 100755 --- a/packaging/pact-provider-verifier.sh +++ b/packaging/pact-provider-verifier.sh @@ -15,6 +15,14 @@ done RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +if [ -z "${PACT_CLI_LEGACY}" ]; then + APP="$DIR/pact_verifier_cli" + if [ -x "$APP" ]; then + exec "$APP" "$@" + exit $? + fi +fi + # Figure out where this script is located. LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" diff --git a/packaging/pact-publish.bat b/packaging/pact-publish.bat index f40626c2..eec5d741 100644 --- a/packaging/pact-publish.bat +++ b/packaging/pact-publish.bat @@ -3,6 +3,11 @@ SET RUNNING_PATH=%~dp0 CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH +IF NOT DEFINED PACT_CLI_LEGACY ( + %RUNNING_PATH%pact-broker-cli.exe publish %* + EXIT /B %ERRORLEVEL% +) + :: Tell Bundler where the Gemfile and gems are. set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile" set BUNDLE_IGNORE_CONFIG= diff --git a/packaging/pact-publish.sh b/packaging/pact-publish.sh index 5114aa8c..80af4dde 100755 --- a/packaging/pact-publish.sh +++ b/packaging/pact-publish.sh @@ -15,6 +15,14 @@ done RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +if [ -z "${PACT_CLI_LEGACY}" ]; then + APP="$DIR/pact-broker-cli publish" + if [ -x "$APP" ]; then + exec "$APP" "$@" + exit $? + fi +fi + # Figure out where this script is located. LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" diff --git a/packaging/pact-stub-service.bat b/packaging/pact-stub-service.bat index 82003f5b..a92f4b9b 100644 --- a/packaging/pact-stub-service.bat +++ b/packaging/pact-stub-service.bat @@ -3,6 +3,11 @@ SET RUNNING_PATH=%~dp0 CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH +IF NOT DEFINED PACT_CLI_LEGACY ( + %RUNNING_PATH%pact-stub-server.exe %* + EXIT /B %ERRORLEVEL% +) + :: Tell Bundler where the Gemfile and gems are. set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile" set BUNDLE_IGNORE_CONFIG= diff --git a/packaging/pact-stub-service.sh b/packaging/pact-stub-service.sh index 1ff19281..20843118 100755 --- a/packaging/pact-stub-service.sh +++ b/packaging/pact-stub-service.sh @@ -15,6 +15,14 @@ done RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +if [ -z "${PACT_CLI_LEGACY}" ]; then + APP="$DIR/pact-stub-server" + if [ -x "$APP" ]; then + exec "$APP" "$@" + exit $? + fi +fi + # Figure out where this script is located. LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" diff --git a/packaging/pact.rb b/packaging/pact.rb index 7c35adff..a7466048 100644 --- a/packaging/pact.rb +++ b/packaging/pact.rb @@ -73,20 +73,26 @@ exit_status = Process.wait2(io.pid)[1].exitstatus exit(exit_status) end +when 'pact-broker-cli' + ARGV.shift + output = `#{File.expand_path("../../bin/pact-broker-cli", __dir__)} #{ARGV.join(" ")}` + exit_status = $?.exitstatus + puts output + exit(exit_status) else puts "available commands:" puts "__________________" puts "#{FILENAME} help" - puts "#{FILENAME} pact" - puts "#{FILENAME} pactflow" - puts "#{FILENAME} stub-server" - puts "#{FILENAME} verifier" - puts "#{FILENAME} mock-server" - puts "#{FILENAME} message" - puts "#{FILENAME} broker" - puts "#{FILENAME} pact-broker" - puts "#{FILENAME} plugin" - puts "#{FILENAME} stub-service (legacy)" - puts "#{FILENAME} provider-verifier (legacy)" - puts "#{FILENAME} mock-service (legacy)" + puts "#{FILENAME} pact (central entry point to all binaries)" + puts "#{FILENAME} pact-broker-cli" + puts "#{FILENAME} pact_mock_server_cli" + puts "#{FILENAME} pact-stub-server" + puts "#{FILENAME} pact_verifier_cli" + puts "#{FILENAME} pact-plugin-cli" + puts "#{FILENAME} pact-broker (legacy) - use `pact-broker-cli`" + puts "#{FILENAME} pactflow (legacy) - use `pact-broker-cli pactflow`" + puts "#{FILENAME} pact-message (legacy) - use `pact_mock_server_cli` (consumer) / `pact_verifier_cli` (provider)" + puts "#{FILENAME} pact-mock-service (legacy) - use `pact_mock_server_cli`" + puts "#{FILENAME} pact-provider-verifier (legacy) - use `pact_verifier_cli`" + puts "#{FILENAME} pact-stub-service (legacy) - use `pact-stub-server`" end \ No newline at end of file diff --git a/packaging/pactflow.bat b/packaging/pactflow.bat index f8720979..cd2c34c3 100644 --- a/packaging/pactflow.bat +++ b/packaging/pactflow.bat @@ -3,6 +3,11 @@ SET RUNNING_PATH=%~dp0 CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH +IF NOT DEFINED PACT_CLI_LEGACY ( + %RUNNING_PATH%pact-broker-cli.exe pactflow %* + EXIT /B %ERRORLEVEL% +) + :: Tell Bundler where the Gemfile and gems are. set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile" set BUNDLE_IGNORE_CONFIG= diff --git a/packaging/pactflow.sh b/packaging/pactflow.sh index cc6742a1..5738b56f 100755 --- a/packaging/pactflow.sh +++ b/packaging/pactflow.sh @@ -15,6 +15,14 @@ done RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +if [ -z "${PACT_CLI_LEGACY}" ]; then + APP="$DIR/pact-broker-cli pactflow" + if [ -x "$APP" ]; then + exec "$APP" "$@" + exit $? + fi +fi + # Figure out where this script is located. LIBDIR="$(cd "$DIR" && cd ../lib && pwd)" diff --git a/script/test.sh b/script/test.sh index f06e10fd..6121f667 100755 --- a/script/test.sh +++ b/script/test.sh @@ -42,7 +42,6 @@ PATH_TO_BIN=.${PATH_SEPERATOR}pkg${PATH_SEPERATOR}pact${PATH_SEPERATOR}bin${PATH tools=( pact pact-broker - pact-message pact-mock-service pact-provider-verifier pact-stub-service @@ -51,14 +50,19 @@ tools=( pact-stub-server pact_verifier_cli pact_mock_server_cli + pact-broker-cli ) +if [ ! -z "${PACT_CLI_LEGACY:-}" ]; then + tools+=(pact-message) +fi + test_cmd="" for tool in ${tools[@]}; do echo testing $tool if [ "$BINARY_OS" = "windows" ] ; then FILE_EXT=.bat; fi - if [ "$BINARY_OS" = "windows" ] && ([ "$tool" = "pact-plugin-cli" ] || [ "$tool" = "pact-stub-server" ] || [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact_mock_server_cli" ]) ; then FILE_EXT=.exe ; fi - if [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact-mock-service" ]; then test_cmd="--help" ; fi + if [ "$BINARY_OS" = "windows" ] && ([ "$tool" = "pact-plugin-cli" ] || [ "$tool" = "pact-stub-server" ] || [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact_mock_server_cli" ] || [ "$tool" = "pact-broker-cli" ]) ; then FILE_EXT=.exe ; fi + if [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact-mock-service" ] || [ "$tool" = "pact-broker-cli" ]; then test_cmd="--help" ; fi echo executing ${tool}${FILE_EXT} ${PATH_TO_BIN}${tool}${FILE_EXT} ${test_cmd}; done \ No newline at end of file diff --git a/script/unpack-and-test.sh b/script/unpack-and-test.sh index f3cc91a1..bd3a2905 100755 --- a/script/unpack-and-test.sh +++ b/script/unpack-and-test.sh @@ -51,7 +51,6 @@ PATH_TO_BIN=.${PATH_SEPERATOR}pact${PATH_SEPERATOR}bin${PATH_SEPERATOR} tools=( pact pact-broker - pact-message pact-mock-service pact-provider-verifier pact-stub-service @@ -60,14 +59,19 @@ tools=( pact-stub-server pact_verifier_cli pact_mock_server_cli + pact-broker-cli ) +if [ ! -z "${PACT_CLI_LEGACY:-}" ]; then + tools+=(pact-message) +fi + test_cmd="" for tool in ${tools[@]}; do echo testing $tool if [ "$BINARY_OS" = "windows" ] ; then FILE_EXT=.bat; fi - if [ "$BINARY_OS" = "windows" ] && ([ "$tool" = "pact-plugin-cli" ] || [ "$tool" = "pact-stub-server" ] || [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact_mock_server_cli" ]) ; then FILE_EXT=.exe ; fi - if [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact-mock-service" ]; then test_cmd="--help" ; fi + if [ "$BINARY_OS" = "windows" ] && ([ "$tool" = "pact-plugin-cli" ] || [ "$tool" = "pact-stub-server" ] || [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact_mock_server_cli" ] || [ "$tool" = "pact-broker-cli" ]) ; then FILE_EXT=.exe ; fi + if [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact-mock-service" ] || [ "$tool" = "pact-broker-cli" ]; then test_cmd="--help" ; fi echo executing ${tool}${FILE_EXT} ${PATH_TO_BIN}${tool}${FILE_EXT} ${test_cmd}; done \ No newline at end of file diff --git a/tasks/package.rake b/tasks/package.rake index 3304cc72..3a9cb418 100644 --- a/tasks/package.rake +++ b/tasks/package.rake @@ -13,9 +13,10 @@ PLUGIN_CLI_VERSION = "0.1.3" # https://github.com/pact-foundation/pact-plugins/r MOCK_SERVER_CLI_VERSION = "1.0.6" # https://github.com/pact-foundation/pact-core-mock-server/releases VERIFIER_CLI_VERSION = "1.2.0" # https://github.com/pact-foundation/pact-reference/releases STUB_SERVER_CLI_VERSION = "0.6.2" # https://github.com/pact-foundation/pact-stub-server/releases +PACT_BROKER_CLI_VERSION = "0.2.0" # https://github.com/pact-foundation/pact-broker-cli/releases desc "Package pact-standalone for OSX, Linux x86_64 and windows x86_64" -task :package => ['package:linux:x86_64','package:linux:arm64', 'package:osx:x86_64', 'package:osx:arm64','package:windows:x86_64'] +task :package => ['package:linux:x86_64','package:linux:arm64', 'package:osx:x86_64', 'package:osx:arm64','package:windows:x86_64', 'package:windows:arm64'] namespace :package do namespace :linux do @@ -47,10 +48,16 @@ namespace :package do create_package(TRAVELING_RUBY_VERSION, "windows-x86_64", "windows-x86_64", :windows) end end + namespace :windows do + desc "Package pact-standalone for windows arm64" + task :arm64 do + create_package(TRAVELING_RUBY_VERSION, "windows-arm64", "windows-arm64", :windows) + end + end desc "Install gems to local directory" task :bundle_install do if RUBY_VERSION !~ /^#{RUBY_MAJOR_VERSION}\.#{RUBY_MINOR_VERSION}\./ - abort "You can only 'bundle install' using Ruby #{RUBY_VERSION}, because that's what Traveling Ruby uses." + abort "You can only 'bundle install' using Ruby #{TRAVELING_RB_VERSION}, because that's what Traveling Ruby uses. \n You are using Ruby #{RUBY_VERSION}." end sh "rm -rf build/tmp" sh "mkdir -p build/tmp" @@ -106,7 +113,11 @@ def create_package(version, source_target, package_target, os_type) # sh "cp -pR lib #{package_dir}/lib/app" sh "mkdir #{package_dir}/lib/ruby" - sh "tar -xzf build/traveling-ruby-#{version}-#{source_target}.tar.gz -C #{package_dir}/lib/ruby" + if package_target == "windows-arm64" + sh "mkdir -p #{package_dir}/lib/ruby/lib" + else + sh "tar -xzf build/traveling-ruby-#{version}-#{source_target}.tar.gz -C #{package_dir}/lib/ruby" + end # From https://curl.se/docs/caextract.html sh "cp packaging/cacert.pem #{package_dir}/lib/ruby/lib/ca-bundle.crt" @@ -120,22 +131,26 @@ def create_package(version, source_target, package_target, os_type) else raise "We don't serve their kind (#{os_type}) here!" end - - sh "cp -pR build/vendor #{package_dir}/lib/" - sh "cp packaging/Gemfile packaging/Gemfile.lock #{package_dir}/lib/vendor/" - sh "mkdir #{package_dir}/lib/vendor/.bundle" - sh "cp packaging/bundler-config #{package_dir}/lib/vendor/.bundle/config" - - if package_target.include? 'windows' - sh "sed -i.bak '37s/^/#/' #{package_dir}/lib/ruby/lib/ruby/#{RUBY_COMPAT_VERSION}/bundler/stub_specification.rb" - else - sh "sed -i.bak '41s/^/#/' #{package_dir}/lib/ruby/lib/ruby/site_ruby/#{RUBY_COMPAT_VERSION}/bundler/stub_specification.rb" + unless package_target == "windows-arm64" + sh "cp -pR build/vendor #{package_dir}/lib/" + sh "cp packaging/Gemfile packaging/Gemfile.lock #{package_dir}/lib/vendor/" + sh "mkdir #{package_dir}/lib/vendor/.bundle" + sh "cp packaging/bundler-config #{package_dir}/lib/vendor/.bundle/config" end + unless package_target == "windows-arm64" + + if package_target.include? 'windows' + sh "sed -i.bak '37s/^/#/' #{package_dir}/lib/ruby/lib/ruby/#{RUBY_COMPAT_VERSION}/bundler/stub_specification.rb" + else + sh "sed -i.bak '41s/^/#/' #{package_dir}/lib/ruby/lib/ruby/site_ruby/#{RUBY_COMPAT_VERSION}/bundler/stub_specification.rb" + end remove_unnecessary_files package_dir + end install_plugin_cli package_dir, package_target install_mock_server_cli package_dir, package_target install_verifier_cli package_dir, package_target install_stub_server_cli package_dir, package_target + install_broker_cli package_dir, package_target if !ENV['DIR_ONLY'] sh "mkdir -p pkg" @@ -146,7 +161,7 @@ def create_package(version, source_target, package_target, os_type) sh "zip -9rq pkg/#{package_name}.zip #{package_dir}" end - sh "rm -rf #{package_dir}" + # sh "rm -rf #{package_dir}" end end @@ -262,6 +277,10 @@ def install_plugin_cli(package_dir, package_target) sh "curl -L -o #{package_dir}/bin/pact-plugin-cli.exe.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v#{PLUGIN_CLI_VERSION}/pact-plugin-cli-windows-x86_64.exe.gz" sh "gunzip -N -f #{package_dir}/bin/pact-plugin-cli.exe.gz" sh "chmod +x #{package_dir}/bin/pact-plugin-cli.exe" + when "windows-arm64" + sh "curl -L -o #{package_dir}/bin/pact-plugin-cli.exe.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v#{PLUGIN_CLI_VERSION}/pact-plugin-cli-windows-aarch64.exe.gz" + sh "gunzip -N -f #{package_dir}/bin/pact-plugin-cli.exe.gz" + sh "chmod +x #{package_dir}/bin/pact-plugin-cli.exe" end end @@ -287,6 +306,10 @@ def install_mock_server_cli(package_dir, package_target) sh "curl -L -o #{package_dir}/bin/pact_mock_server_cli.exe.gz https://github.com/pact-foundation/pact-core-mock-server//releases/download/pact_mock_server_cli-v#{MOCK_SERVER_CLI_VERSION}/pact_mock_server_cli-windows-x86_64.exe.gz" sh "gunzip -N -f #{package_dir}/bin/pact_mock_server_cli.exe.gz" sh "chmod +x #{package_dir}/bin/pact_mock_server_cli.exe" + when "windows-arm64" + sh "curl -L -o #{package_dir}/bin/pact_mock_server_cli.exe.gz https://github.com/pact-foundation/pact-core-mock-server//releases/download/pact_mock_server_cli-v#{MOCK_SERVER_CLI_VERSION}/pact_mock_server_cli-windows-aarch64.exe.gz" + sh "gunzip -N -f #{package_dir}/bin/pact_mock_server_cli.exe.gz" + sh "chmod +x #{package_dir}/bin/pact_mock_server_cli.exe" end end @@ -312,6 +335,10 @@ def install_verifier_cli(package_dir, package_target) sh "curl -L -o #{package_dir}/bin/pact_verifier_cli.exe.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v#{VERIFIER_CLI_VERSION}/pact_verifier_cli-windows-x86_64.exe.gz" sh "gunzip -N -f #{package_dir}/bin/pact_verifier_cli.exe.gz" sh "chmod +x #{package_dir}/bin/pact_verifier_cli.exe" + when "windows-arm64" + sh "curl -L -o #{package_dir}/bin/pact_verifier_cli.exe.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v#{VERIFIER_CLI_VERSION}/pact_verifier_cli-windows-aarch64.exe.gz" + sh "gunzip -N -f #{package_dir}/bin/pact_verifier_cli.exe.gz" + sh "chmod +x #{package_dir}/bin/pact_verifier_cli.exe" end end @@ -337,5 +364,32 @@ def install_stub_server_cli(package_dir, package_target) sh "curl -L -o #{package_dir}/bin/pact-stub-server.exe.gz https://github.com/pact-foundation/pact-stub-server/releases/download/v#{STUB_SERVER_CLI_VERSION}/pact-stub-server-windows-x86_64.exe.gz" sh "gunzip -N -f #{package_dir}/bin/pact-stub-server.exe.gz" sh "chmod +x #{package_dir}/bin/pact-stub-server.exe" + when "windows-arm64" + sh "curl -L -o #{package_dir}/bin/pact-stub-server.exe.gz https://github.com/pact-foundation/pact-stub-server/releases/download/v#{STUB_SERVER_CLI_VERSION}/pact-stub-server-windows-aarch64.exe.gz" + sh "gunzip -N -f #{package_dir}/bin/pact-stub-server.exe.gz" + sh "chmod +x #{package_dir}/bin/pact-stub-server.exe" end -end \ No newline at end of file +end + +def install_broker_cli(package_dir, package_target) + case package_target + when "linux-x86_64" + sh "curl -L -o #{package_dir}/bin/pact-broker-cli https://github.com/pact-foundation/pact-broker-cli/releases/download/v#{PACT_BROKER_CLI_VERSION}/pact-broker-cli-x86_64-linux-musl" + sh "chmod +x #{package_dir}/bin/pact-broker-cli" + when "linux-arm64" + sh "curl -L -o #{package_dir}/bin/pact-broker-cli https://github.com/pact-foundation/pact-broker-cli/releases/download/v#{PACT_BROKER_CLI_VERSION}/pact-broker-cli-aarch64-linux" + sh "chmod +x #{package_dir}/bin/pact-broker-cli" + when "osx-x86_64" + sh "curl -L -o #{package_dir}/bin/pact-broker-cli https://github.com/pact-foundation/pact-broker-cli/releases/download/v#{PACT_BROKER_CLI_VERSION}/pact-broker-cli-x86_64-macos" + sh "chmod +x #{package_dir}/bin/pact-broker-cli" + when "osx-arm64" + sh "curl -L -o #{package_dir}/bin/pact-broker-cli https://github.com/pact-foundation/pact-broker-cli/releases/download/v#{PACT_BROKER_CLI_VERSION}/pact-broker-cli-aarch64-macos" + sh "chmod +x #{package_dir}/bin/pact-broker-cli" + when "windows-x86_64" + sh "curl -L -o #{package_dir}/bin/pact-broker-cli.exe https://github.com/pact-foundation/pact-broker-cli/releases/download/v#{PACT_BROKER_CLI_VERSION}/pact-broker-cli-x86_64-windows-gnu.exe" + sh "chmod +x #{package_dir}/bin/pact-broker-cli.exe" + when "windows-arm64" + sh "curl -L -o #{package_dir}/bin/pact-broker-cli.exe https://github.com/pact-foundation/pact-broker-cli/releases/download/v#{PACT_BROKER_CLI_VERSION}/pact-broker-cli-aarch64-windows-msvc.exe" + sh "chmod +x #{package_dir}/bin/pact-broker-cli.exe" + end +end diff --git a/tasks/release.rake b/tasks/release.rake index a2e6b6c3..3e1f4bc6 100644 --- a/tasks/release.rake +++ b/tasks/release.rake @@ -20,6 +20,7 @@ task :generate_release_notes, [:tag] do | t, args | release_notes_content = release_notes_content.gsub("", VERSION) File.open(RELEASE_NOTES_PATH, "w") do |file| file << release_notes_content + file << "\n\n" file << readme_content end end