Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update for v2.0.0 standalone with native ARM support #92

Merged
merged 1 commit into from May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 2 additions & 12 deletions README.md
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 @@ -32,13 +32,3 @@ The easier way to install [`pact-ruby-standalone`](https://github.com/pact-found
pact-stub-service --help
pactflow --help
```

### Notes

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
```
22 changes: 11 additions & 11 deletions pact-ruby-standalone.rb
@@ -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.0"
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.0/pact-2.0.0-osx-x86_64.tar.gz"
sha256 "025b1b8de4c99f463960a71ad720b0b92bda19bfed2130cfdd819a2af6c27ee1"
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.0/pact-2.0.0-osx-arm64.tar.gz"
sha256 "d91d2fa7596b20afdd6d1d4f1fe0e1353ceb249892b48b4bbd85a303f7f4ff31"
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.0/pact-2.0.0-linux-x86_64.tar.gz"
sha256 "42fb3a74a1ca1504b0bbc541d3521a01a32eeb513bf5edceae3ffb9d760d203d"
end
on_arm do
url "https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v2.0.0/pact-2.0.0-linux-arm64.tar.gz"
sha256 "3a421a35d2ab1da13fc4a99a1506f7243e9702ebacd5cc5fee710cf55e2d5dd5"
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 Down
31 changes: 15 additions & 16 deletions scripts/update_tap_version.sh
Expand Up @@ -19,30 +19,30 @@ 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
Expand Down Expand Up @@ -80,18 +80,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 +114,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