Skip to content

Commit

Permalink
Merge pull request #94 from pact-foundation/revert-93-revert-92-versi…
Browse files Browse the repository at this point in the history
…on/v2.0.0

Revert "Revert "update for v2.0.0 standalone with native ARM support""
  • Loading branch information
YOU54F authored Jun 8, 2023
2 parents 22ea032 + bde2028 commit 7647772
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
pactflow --help
- name: Audit tap (⚠️ experimental ⚠️) - so we ignore the error code
- name: Audit tap
run: |
brew audit --strict --online pact-ruby-standalone || true
brew audit --strict --online pact-ruby-standalone
1 change: 1 addition & 0 deletions Aliases/pact-ruby-standalone@2
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ The Pact Ruby Standalone public homebrew tap for OS X homebrew formulae.

The easier way to install [`pact-ruby-standalone`](https://github.com/pact-foundation/pact-ruby-standalone) bundle of tools on your macOS using Homebrew.


## Installation

brew tap pact-foundation/pact-ruby-standalone
Expand All @@ -15,8 +14,9 @@ The easier way to install [`pact-ruby-standalone`](https://github.com/pact-found
| OS | Architecture | Supported |
| ------- | ------------ | --------- |
| OSX | x86_64 ||
| OSX | aarch64 (arm)||
| OSX | arm64 ||
| Linux | x86_64 ||
| Linux | arm64 ||


## Included tools
Expand All @@ -33,12 +33,20 @@ The easier way to install [`pact-ruby-standalone`](https://github.com/pact-found
pactflow --help
```

### Notes
### Previous versions

The latest version, of the previous major release is provided, in case of issues with the latest version installed by default.

brew install pact-ruby-standalone@1

#### Notes

For v1.x and below -

OSX ARM (M1/M2) Machines will require Rosetta tools, as the Ruby binaries as currently built for x86_64.

If you don't already have it installed, you can use the following command

```sh
sudo softwareupdate --install-rosetta --agree-to-license
```
```
23 changes: 11 additions & 12 deletions pact-ruby-standalone.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
class PactRubyStandalone < Formula
desc "Standalone pact CLI executable using the Ruby Pact impl and Travelling Ruby"
homepage "https://github.com/pact-foundation/pact-ruby-standalone"
version "1.92.0"
version "2.0.2"
on_macos do
on_intel do
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.92.0/pact-1.92.0-osx.tar.gz"
sha256 "dee18427b9eced63a159d5e64c5ff0d7aa2d4a1e67255b24b239c007c2c8b6c1"
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v2.0.2/pact-2.0.2-osx-x86_64.tar.gz"
sha256 "072766ea5fe6ce4228022c068b9b4889cd70537a913d6e253839cf7616fdb54b"
end
on_arm do
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.92.0/pact-1.92.0-osx.tar.gz"
sha256 "dee18427b9eced63a159d5e64c5ff0d7aa2d4a1e67255b24b239c007c2c8b6c1"
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v2.0.2/pact-2.0.2-osx-arm64.tar.gz"
sha256 "f0acdef27afa6c1837c37960568787b5c25d0f8e71fbd9ee232bf6aac6dfc0b2"
end
end
on_linux do
on_intel do
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.92.0/pact-1.92.0-linux-x86_64.tar.gz"
sha256 "a5922e4098cae6f8717b9d51fda050d30540dff657c44f61eed9d51875f7822a"
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v2.0.2/pact-2.0.2-linux-x86_64.tar.gz"
sha256 "5c28a99b0309adb6ed8cb15bafb86c92fa4c49971b8019e4036f27b7e66e0588"
end
on_arm do
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v2.0.2/pact-2.0.2-linux-arm64.tar.gz"
sha256 "91f11de10077bfde1c37c6aaa69e9258288ab7f8ff4fb48f592ffce8665427c8"
end
end

Expand All @@ -24,10 +28,6 @@ def install
bin.install Dir["bin/*"]
lib.install Dir["lib/*"]
puts "# Run 'pact-mock-service --help' (see https://github.com/pact-foundation/pact-ruby-standalone/releases/)"
OS.mac? && Hardware::CPU.arm? do
puts "# Rosetta is required to run pact-ruby-standalone commands"
puts "# sudo softwareupdate --install-rosetta --agree-to-license"
end
end

test do
Expand All @@ -36,7 +36,6 @@ def install
system "#{bin}/pact-message", "help"
system "#{bin}/pact-mock-service", "help"
system "#{bin}/pact-plugin-cli", "help"
system "#{bin}/pact-mock-service", "help"
system "#{bin}/pact-provider-verifier", "help"
system "#{bin}/pact-stub-service", "help"
system "#{bin}/pactflow", "help"
Expand Down
54 changes: 54 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class PactRubyStandaloneAT1 < Formula
desc "Standalone pact CLI executable using the Ruby Pact impl and Travelling Ruby"
homepage "https://github.com/pact-foundation/pact-ruby-standalone"
version "1.92.0"

on_macos do
on_arm do
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.92.0/pact-1.92.0-osx.tar.gz"
sha256 "dee18427b9eced63a159d5e64c5ff0d7aa2d4a1e67255b24b239c007c2c8b6c1"
end
on_intel do
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.92.0/pact-1.92.0-osx.tar.gz"
sha256 "dee18427b9eced63a159d5e64c5ff0d7aa2d4a1e67255b24b239c007c2c8b6c1"
end
end

on_linux do
on_intel do
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.92.0/pact-1.92.0-linux-x86_64.tar.gz"
sha256 "a5922e4098cae6f8717b9d51fda050d30540dff657c44f61eed9d51875f7822a"
end
end

def install
# pact-ruby-standalone
bin.install Dir["bin/*"]
lib.install Dir["lib/*"]
puts "# (see https://github.com/pact-foundation/pact-ruby-standalone/releases/)'"
puts "# Run 'pact --help'"
puts "# Run 'pact-broker --help'"
puts "# Run 'pact-message --help'"
puts "# Run 'pact-mock-service --help'"
puts "# Run 'plugin-cli --help'"
puts "# Run 'pact-provider-verifier --help'"
puts "# Run 'pact-stub-service --help'"
puts "# Run 'pactflow --help'"
on_macos do
on_arm do
puts "# Rosetta is required to run pact-ruby-standalone commands"
puts "# sudo softwareupdate --install-rosetta --agree-to-license"
end
end
end

test do
system "#{bin}/pact", "help"
system "#{bin}/pact-broker", "help"
system "#{bin}/pact-message", "help"
system "#{bin}/pact-mock-service", "help"
system "#{bin}/pact-provider-verifier", "help"
system "#{bin}/pact-stub-service", "help"
system "#{bin}/pactflow", "help"
end
end
32 changes: 15 additions & 17 deletions scripts/update_tap_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,36 @@ write_homebrew_formulae() {
echo " version \"$version\"" >&3
echo " on_macos do" >&3
echo " on_intel do" >&3
echo " url \"$homepage/releases/download/v$version/pact-$version-osx.tar.gz\"" >&3
echo " url \"$homepage/releases/download/v$version/pact-$version-osx-x86_64.tar.gz\"" >&3
echo " sha256 \"${sha_osx_x86_64}\"" >&3
echo " end" >&3
echo " on_arm do" >&3
echo " url \"$homepage/releases/download/v$version/pact-$version-osx.tar.gz\"" >&3
echo " sha256 \"${sha_osx_x86_64}\"" >&3
echo " url \"$homepage/releases/download/v$version/pact-$version-osx-arm64.tar.gz\"" >&3
echo " sha256 \"${sha_osx_arm64}\"" >&3
echo " end" >&3
echo " end" >&3
echo " on_linux do" >&3
echo " on_intel do" >&3
echo " url \"$homepage/releases/download/v$version/pact-$version-linux-x86_64.tar.gz\"" >&3
echo " sha256 \"${sha_linux_x86_64}\"" >&3
echo " end" >&3
echo " on_arm do" >&3
echo " url \"$homepage/releases/download/v$version/pact-$version-linux-arm64.tar.gz\"" >&3
echo " sha256 \"${sha_linux_arm64}\"" >&3
echo " end" >&3
echo " end" >&3
echo "" >&3
echo " def install" >&3
echo " # pact-ruby-standalone" >&3
echo " bin.install Dir[\"bin/*\"]" >&3
echo " lib.install Dir[\"lib/*\"]" >&3
echo " puts \"# Run 'pact-mock-service --help' (see $homepage/releases/)\"" >&3
echo " OS.mac? && Hardware::CPU.arm? do" >&3
echo " puts \"# Rosetta is required to run pact-ruby-standalone commands\"" >&3
echo " puts \"# sudo softwareupdate --install-rosetta --agree-to-license\"" >&3
echo " end" >&3
echo " end" >&3
echo "" >&3
echo " test do" >&3
echo " system \"#{bin}/pact\", \"help\"" >&3
echo " system \"#{bin}/pact-broker\", \"help\"" >&3
echo " system \"#{bin}/pact-message\", \"help\"" >&3
echo " system \"#{bin}/pact-mock-service\", \"help\"" >&3
echo " system \"#{bin}/pact-plugin-cli\", \"help\"" >&3
echo " system \"#{bin}/pact-mock-service\", \"help\"" >&3
echo " system \"#{bin}/pact-provider-verifier\", \"help\"" >&3
Expand Down Expand Up @@ -80,18 +79,13 @@ else

shas=()
for platform in osx linux; do
for arch in x86_64; do
if [[ ${platform} == "osx" ]]
then
filename=pact-$version-${platform}
else
filename=pact-$version-${platform}-${arch}
fi
for arch in x86_64 arm64; do
filename=pact-$version-${platform}-${arch}
echo "⬇️ Downloading $filename.tar.gz from $homepage"
curl -LO $homepage/releases/download/v$version/$filename.tar.gz

brewshasignature=( $(eval "openssl dgst -sha256 $filename.tar.gz") )
echo "🔏 Checksum SHA256:\t ${brewshasignature[1]} for ${arch}"
echo "🔏 Checksum SHA256:\t ${brewshasignature[1]} for ${platform}-${arch}"

shasignature=( $(eval "openssl dgst -sha1 $filename.tar.gz") )
echo "🔏 Checksum SHA1:\t ${shasignature[1]} for ${platform}-${arch}"
Expand Down Expand Up @@ -119,9 +113,13 @@ for platform in osx linux; do
done

sha_osx_x86_64=${shas[0]}
sha_linux_x86_64=${shas[1]}
sha_osx_arm64=${shas[1]}
sha_linux_x86_64=${shas[2]}
sha_linux_arm64=${shas[3]}
echo "sha_osx_x86_64:" $sha_osx_x86_64
echo "sha_osx_arm64:" $sha_osx_arm64
echo "sha_linux_x86_64:" $sha_linux_x86_64
echo "sha_linux_arm64:" $sha_linux_arm64

write_homebrew_formulae

Expand Down

0 comments on commit 7647772

Please sign in to comment.