Skip to content

Commit

Permalink
Add support for linux (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-manges authored Feb 27, 2024
1 parent 530b965 commit 2dd4abc
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 41 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/abq-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- name: abq
version: "1.7.4"
os: macos-14 # arm

- name: abq@1
version: "1.7.4"
os: macos-12 # intel
Expand All @@ -33,3 +34,23 @@ jobs:
- name: Ensure the integrity was verified
run: '! grep "Cannot verify integrity of" install-output.txt'

test_abq_linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: abq
version: "1.7.4"
- name: abq@1
version: "1.7.4"
steps:
- name: Install homebrew
uses: Homebrew/actions/setup-homebrew@5caa94335a28d8fdf5a478ae8586f2da40a0a989
- name: Install abq & run it
run: |
set -o pipefail
! command -v abq
brew install ${{ matrix.name }}
abq --version | grep ${{ matrix.version }}
22 changes: 22 additions & 0 deletions .github/workflows/captain-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ jobs:
- name: captain
version: "1.11.7"
os: macos-14 # arm

- name: captain@1
version: "1.11.7"
os: macos-12 # intel
- name: captain@1
version: "1.11.7"
os: macos-14 # arm

steps:
- uses: actions/checkout@v3

Expand All @@ -33,3 +35,23 @@ jobs:
- name: Ensure the integrity was verified
run: '! grep "Cannot verify integrity of" install-output.txt'

test_captain_linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: captain
version: "1.11.7"
- name: captain@1
version: "1.11.7"
steps:
- name: Install homebrew
uses: Homebrew/actions/setup-homebrew@5caa94335a28d8fdf5a478ae8586f2da40a0a989
- name: Install captain
run: |
set -o pipefail
! command -v abq
brew install ${{ matrix.name }}
captain --version | grep ${{ matrix.version }}
18 changes: 18 additions & 0 deletions .github/workflows/mint-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,21 @@ jobs:
- name: Ensure the integrity was verified
run: '! grep "Cannot verify integrity of" install-output.txt'

test_mint_linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: mint
version: "0.1.1"
steps:
- name: Install homebrew
uses: Homebrew/actions/setup-homebrew@5caa94335a28d8fdf5a478ae8586f2da40a0a989
- name: Install mint
run: |
set -o pipefail
! command -v abq
brew install rwx-research/tap/${{ matrix.name }}
mint --version | grep ${{ matrix.version }}
21 changes: 13 additions & 8 deletions Formula/abq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ class Abq < Formula
homepage "https://www.rwx.com/abq"
version "1.7.4"

if OS.mac? && Hardware::CPU.intel?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=darwin&arch=x86-64", user_agent: :fake
sha256 "d76b514dc34ea7322f463b7e470e3cea0305d72a11ff81cc591aea1ddbb20e70"
end

if OS.mac? && Hardware::CPU.arm?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=darwin&arch=aarch64", user_agent: :fake
sha256 "818d48e9cdae3e88718affbafaa34cd0a474beea097c7ce0e5fdba5e3fa2a1ed"
if OS.mac?
if Hardware::CPU.intel?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=darwin&arch=x86-64", user_agent: :fake
sha256 "d76b514dc34ea7322f463b7e470e3cea0305d72a11ff81cc591aea1ddbb20e70"
elsif Hardware::CPU.arm?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=darwin&arch=aarch64", user_agent: :fake
sha256 "818d48e9cdae3e88718affbafaa34cd0a474beea097c7ce0e5fdba5e3fa2a1ed"
end
else
if Hardware::CPU.intel?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=linux&arch=x86-64", user_agent: :fake
sha256 "9c64213c07b54cdc526fc436389b77d31a72be9fdb6a58d9a893c11a9c4c55e4"
end
end

def install
Expand Down
21 changes: 13 additions & 8 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ class AbqAT1 < Formula
homepage "https://www.rwx.com/abq"
version "1.7.4"

if OS.mac? && Hardware::CPU.intel?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=darwin&arch=x86-64", user_agent: :fake
sha256 "d76b514dc34ea7322f463b7e470e3cea0305d72a11ff81cc591aea1ddbb20e70"
end

if OS.mac? && Hardware::CPU.arm?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=darwin&arch=aarch64", user_agent: :fake
sha256 "818d48e9cdae3e88718affbafaa34cd0a474beea097c7ce0e5fdba5e3fa2a1ed"
if OS.mac?
if Hardware::CPU.intel?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=darwin&arch=x86-64", user_agent: :fake
sha256 "d76b514dc34ea7322f463b7e470e3cea0305d72a11ff81cc591aea1ddbb20e70"
elsif Hardware::CPU.arm?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=darwin&arch=aarch64", user_agent: :fake
sha256 "818d48e9cdae3e88718affbafaa34cd0a474beea097c7ce0e5fdba5e3fa2a1ed"
end
else
if Hardware::CPU.intel?
url "https://cloud.rwx.com/abq/api/downloads/#{version}?os=linux&arch=x86-64", user_agent: :fake
sha256 "9c64213c07b54cdc526fc436389b77d31a72be9fdb6a58d9a893c11a9c4c55e4"
end
end

def install
Expand Down
21 changes: 13 additions & 8 deletions Formula/captain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ class Captain < Formula
homepage "https://www.rwx.com/captain"
version "1.11.7"

if OS.mac? && Hardware::CPU.intel?
url "https://releases.captain.build/v#{version}/darwin/x86_64/captain", user_agent: :fake
sha256 "7f9be5df82790bf265628a92936cf0d851045b6a4e8c22e5af31ad5930a068c1"
end

if OS.mac? && Hardware::CPU.arm?
url "https://releases.captain.build/v#{version}/darwin/aarch64/captain", user_agent: :fake
sha256 "d7e2255f01e7fe7711daeeb13a99b68599aef7e9cd40903d97aefdfd70fbcf48"
if OS.mac?
if Hardware::CPU.intel?
url "https://releases.captain.build/v#{version}/darwin/x86_64/captain", user_agent: :fake
sha256 "7f9be5df82790bf265628a92936cf0d851045b6a4e8c22e5af31ad5930a068c1"
elsif Hardware::CPU.arm?
url "https://releases.captain.build/v#{version}/darwin/aarch64/captain", user_agent: :fake
sha256 "d7e2255f01e7fe7711daeeb13a99b68599aef7e9cd40903d97aefdfd70fbcf48"
end
else
if Hardware::CPU.intel?
url "https://releases.captain.build/v#{version}/linux/x86_64/captain", user_agent: :fake
sha256 "666c7f6639559a3070273041b693eabfb54168a2a5fcc83c173648d2f6811e10"
end
end

def install
Expand Down
21 changes: 13 additions & 8 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ class CaptainAT1 < Formula
homepage "https://www.rwx.com/captain"
version "1.11.7"

if OS.mac? && Hardware::CPU.intel?
url "https://releases.captain.build/v#{version}/darwin/x86_64/captain", user_agent: :fake
sha256 "7f9be5df82790bf265628a92936cf0d851045b6a4e8c22e5af31ad5930a068c1"
end

if OS.mac? && Hardware::CPU.arm?
url "https://releases.captain.build/v#{version}/darwin/aarch64/captain", user_agent: :fake
sha256 "d7e2255f01e7fe7711daeeb13a99b68599aef7e9cd40903d97aefdfd70fbcf48"
if OS.mac?
if Hardware::CPU.intel?
url "https://releases.captain.build/v#{version}/darwin/x86_64/captain", user_agent: :fake
sha256 "7f9be5df82790bf265628a92936cf0d851045b6a4e8c22e5af31ad5930a068c1"
elsif Hardware::CPU.arm?
url "https://releases.captain.build/v#{version}/darwin/aarch64/captain", user_agent: :fake
sha256 "d7e2255f01e7fe7711daeeb13a99b68599aef7e9cd40903d97aefdfd70fbcf48"
end
else
if Hardware::CPU.intel?
url "https://releases.captain.build/v#{version}/linux/x86_64/captain", user_agent: :fake
sha256 "666c7f6639559a3070273041b693eabfb54168a2a5fcc83c173648d2f6811e10"
end
end

def install
Expand Down
27 changes: 18 additions & 9 deletions Formula/mint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,27 @@ class Mint < Formula
homepage "https://www.rwx.com/mint"
version "0.1.1"

if OS.mac? && Hardware::CPU.intel?
url "https://github.com/rwx-research/mint-cli/releases/download/v#{version}/mint-darwin-x86_64", user_agent: :fake
sha256 "8c13b18ebad7b2afa7490ea2aabb3c2a21a5090891d56f01543a9fd905f9ddae"
end

if OS.mac? && Hardware::CPU.arm?
url "https://github.com/rwx-research/mint-cli/releases/download/v#{version}/mint-darwin-aarch64", user_agent: :fake
sha256 "3f3f6617ac327ceeef41cb0c3a1e65e7880c7210d9bcd00b2fc2c4948f4de6ab"
if OS.mac?
if Hardware::CPU.intel?
url "https://github.com/rwx-research/mint-cli/releases/download/v#{version}/mint-darwin-x86_64", user_agent: :fake
sha256 "8c13b18ebad7b2afa7490ea2aabb3c2a21a5090891d56f01543a9fd905f9ddae"
elsif Hardware::CPU.arm?
url "https://github.com/rwx-research/mint-cli/releases/download/v#{version}/mint-darwin-aarch64", user_agent: :fake
sha256 "3f3f6617ac327ceeef41cb0c3a1e65e7880c7210d9bcd00b2fc2c4948f4de6ab"
end
else
if Hardware::CPU.intel?
url "https://github.com/rwx-research/mint-cli/releases/download/v#{version}/mint-linux-x86_64", user_agent: :fake
sha256 "88f46ba7b54d914b63968be346fc0f1002429749683c651f9bc256775aac40df"
end
end

def install
filename = Hardware::CPU.intel? ? "mint-darwin-x86_64" : "mint-darwin-aarch64"
filename = case
when OS.mac? && Hardware::CPU.intel? then "mint-darwin-x86_64"
when OS.mac? && Hardware::CPU.arm? then "mint-darwin-aarch64"
when OS.linux? && Hardware::CPU.intel? then "mint-linux-x86_64"
end
bin.install filename => "mint"
end

Expand Down
14 changes: 14 additions & 0 deletions bin/update-abq-formulae
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ function getSHA() {
curl --user-agent "${fake_user_agent}" "${url}" -o ./tmp/abq.tar --fail-with-body --silent -L
sha=$(sha256sum ./tmp/abq.tar | cut -d ' ' -f 1)

if [[ "$url" == *"linux"* ]]; then
echo "${sha}"
return
fi

(cd tmp && tar -xvf abq.tar && mv abq_*/abq ./ && cd -) &>/dev/null
chmod +x ./tmp/abq
output=$(./tmp/abq --version)
Expand All @@ -43,15 +48,24 @@ function getSHA() {
echo "Calculating the SHA256 of the binaries"
oldAarch64SHA=$(getSHA "https://cloud.rwx.com/abq/api/downloads/${oldVersion}?os=darwin&arch=aarch64" "${oldVersion}")
oldX8664SHA=$(getSHA "https://cloud.rwx.com/abq/api/downloads/${oldVersion}?os=darwin&arch=x86-64" "${oldVersion}")
oldLinuxX8664SHA=$(getSHA "https://cloud.rwx.com/abq/api/downloads/${oldVersion}?os=linux&arch=x86-64" "${oldVersion}")
newAarch64SHA=$(getSHA "https://cloud.rwx.com/abq/api/downloads/${newVersion}?os=darwin&arch=aarch64" "${newVersion}")
newX8664SHA=$(getSHA "https://cloud.rwx.com/abq/api/downloads/${newVersion}?os=darwin&arch=x86-64" "${newVersion}")
newLinuxX8664SHA=$(getSHA "https://cloud.rwx.com/abq/api/downloads/${newVersion}?os=linux&arch=x86-64" "${newVersion}")

echo "Updating formulae and tests"

sed -i '' -e "s/version \"${oldVersion}\"/version \"${newVersion}\"/" "./Formula/abq.rb"
sed -i '' -e "s/version \"${oldVersion}\"/version \"${newVersion}\"/" "./Formula/[email protected]"

sed -i '' -e "s/sha256 \"${oldAarch64SHA}\"/sha256 \"${newAarch64SHA}\"/" "./Formula/abq.rb"
sed -i '' -e "s/sha256 \"${oldAarch64SHA}\"/sha256 \"${newAarch64SHA}\"/" "./Formula/[email protected]"

sed -i '' -e "s/sha256 \"${oldX8664SHA}\"/sha256 \"${newX8664SHA}\"/" "./Formula/abq.rb"
sed -i '' -e "s/sha256 \"${oldX8664SHA}\"/sha256 \"${newX8664SHA}\"/" "./Formula/[email protected]"

sed -i '' -e "s/sha256 \"${oldLinuxX8664SHA}\"/sha256 \"${newLinuxX8664SHA}\"/" "./Formula/abq.rb"
sed -i '' -e "s/sha256 \"${oldLinuxX8664SHA}\"/sha256 \"${newLinuxX8664SHA}\"/" "./Formula/[email protected]"

sed -i '' -e "s/version: \"${oldVersion}\"/version: \"${newVersion}\"/" "./.github/workflows/abq-ci.yml"
echo "Done!"
15 changes: 15 additions & 0 deletions bin/update-captain-formulae
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ function getSHA() {
curl "${url}" -o ./tmp/captain --fail-with-body --silent -L
sha=$(sha256sum ./tmp/captain | cut -d ' ' -f 1)

if [[ "$url" == *"linux"* ]]; then
echo "${sha}"
return
fi

chmod +x ./tmp/captain
output=$(./tmp/captain --version)
if ! (echo "${output}" | grep "v${expectedVersion}" &>/dev/null); then
Expand All @@ -41,15 +46,25 @@ function getSHA() {
echo "Calculating the SHA256 of the binaries"
oldAarch64SHA=$(getSHA "https://releases.captain.build/v${oldVersion}/darwin/aarch64/captain" "${oldVersion}")
oldX8664SHA=$(getSHA "https://releases.captain.build/v${oldVersion}/darwin/x86_64/captain" "${oldVersion}")
oldLinuxX8664SHA=$(getSHA "https://releases.captain.build/v${oldVersion}/linux/x86_64/captain" "${oldVersion}")
newAarch64SHA=$(getSHA "https://releases.captain.build/v${newVersion}/darwin/aarch64/captain" "${newVersion}")
newX8664SHA=$(getSHA "https://releases.captain.build/v${newVersion}/darwin/x86_64/captain" "${newVersion}")
newLinuxX8664SHA=$(getSHA "https://releases.captain.build/v${newVersion}/linux/x86_64/captain" "${newVersion}")

echo "Updating formulae and tests"

sed -i '' -e "s/version \"${oldVersion}\"/version \"${newVersion}\"/" "./Formula/captain.rb"
sed -i '' -e "s/version \"${oldVersion}\"/version \"${newVersion}\"/" "./Formula/[email protected]"

sed -i '' -e "s/sha256 \"${oldAarch64SHA}\"/sha256 \"${newAarch64SHA}\"/" "./Formula/captain.rb"
sed -i '' -e "s/sha256 \"${oldAarch64SHA}\"/sha256 \"${newAarch64SHA}\"/" "./Formula/[email protected]"

sed -i '' -e "s/sha256 \"${oldX8664SHA}\"/sha256 \"${newX8664SHA}\"/" "./Formula/captain.rb"
sed -i '' -e "s/sha256 \"${oldX8664SHA}\"/sha256 \"${newX8664SHA}\"/" "./Formula/[email protected]"

sed -i '' -e "s/sha256 \"${oldLinuxX8664SHA}\"/sha256 \"${newLinuxX8664SHA}\"/" "./Formula/captain.rb"
sed -i '' -e "s/sha256 \"${oldLinuxX8664SHA}\"/sha256 \"${newLinuxX8664SHA}\"/" "./Formula/[email protected]"

sed -i '' -e "s/version: \"${oldVersion}\"/version: \"${newVersion}\"/" "./.github/workflows/captain-ci.yml"

echo "Done!"
11 changes: 11 additions & 0 deletions bin/update-mint-formulae
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ function getSHA() {
curl "${url}" -o ./tmp/mint --fail-with-body --silent -L
sha=$(sha256sum ./tmp/mint | cut -d ' ' -f 1)

if [[ "$url" == *"linux"* ]]; then
echo "${sha}"
return
fi

chmod +x ./tmp/mint
output=$(./tmp/mint --version)
if ! (echo "${output}" | grep "v${expectedVersion}" &>/dev/null); then
Expand All @@ -41,12 +46,18 @@ function getSHA() {
echo "Calculating the SHA256 of the binaries"
oldAarch64SHA=$(getSHA "https://github.com/rwx-research/mint-cli/releases/download/v${oldVersion}/mint-darwin-aarch64" "${oldVersion}")
oldX8664SHA=$(getSHA "https://github.com/rwx-research/mint-cli/releases/download/v${oldVersion}/mint-darwin-x86_64" "${oldVersion}")
oldLinuxX8664SHA=$(getSHA "https://github.com/rwx-research/mint-cli/releases/download/v${oldVersion}/mint-linux-x86_64" "${oldVersion}")
newAarch64SHA=$(getSHA "https://github.com/rwx-research/mint-cli/releases/download/v${newVersion}/mint-darwin-aarch64" "${newVersion}")
newX8664SHA=$(getSHA "https://github.com/rwx-research/mint-cli/releases/download/v${newVersion}/mint-darwin-x86_64" "${newVersion}")
newLinuxX8664SHA=$(getSHA "https://github.com/rwx-research/mint-cli/releases/download/v${newVersion}/mint-linux-x86_64" "${newVersion}")

echo "Updating formulae and tests"

sed -i '' -e "s/version \"${oldVersion}\"/version \"${newVersion}\"/" "./Formula/mint.rb"
sed -i '' -e "s/sha256 \"${oldAarch64SHA}\"/sha256 \"${newAarch64SHA}\"/" "./Formula/mint.rb"
sed -i '' -e "s/sha256 \"${oldX8664SHA}\"/sha256 \"${newX8664SHA}\"/" "./Formula/mint.rb"
sed -i '' -e "s/sha256 \"${oldLinuxX8664SHA}\"/sha256 \"${newLinuxX8664SHA}\"/" "./Formula/mint.rb"

sed -i '' -e "s/version: \"${oldVersion}\"/version: \"${newVersion}\"/" "./.github/workflows/mint-ci.yml"

echo "Done!"

0 comments on commit 2dd4abc

Please sign in to comment.