Skip to content

Commit

Permalink
feat: update installer script
Browse files Browse the repository at this point in the history
- more supported platforms
- install to ~/.pact/bin
  • Loading branch information
YOU54F committed Apr 25, 2024
1 parent 20c8dae commit aaddff9
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 46 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
run: scripts/install-plugin-cli.sh
shell: bash
- name: Install Protobuf plugin
run: ~/bin/pact-plugin-cli -y install protobuf
run: ~/.pact/bin/pact-plugin-cli -y install protobuf
shell: bash
- name: Install csv plugin
run: ~/bin/pact-plugin-cli -y install csv
run: ~/.pact/bin/pact-plugin-cli -y install csv
shell: bash
- name: Install Pact verifier
run: scripts/install-verifier-cli.sh
Expand All @@ -51,8 +51,8 @@ jobs:
nohup ./target/debug/csv-provider &
PID=$!
trap "kill $PID" EXIT
pact_do_not_track=true ~/bin/pact_verifier_cli -f ../csv-consumer-rust/target/pacts/CsvClient-CsvServer.json -p 8080
pact_do_not_track=true ~/bin/pact_verifier_cli -f ../csv-consumer-jvm/build/pacts/CsvClient-CsvServer.json -p 8080
pact_do_not_track=true ~/.pact/bin/pact_verifier_cli -f ../csv-consumer-rust/target/pacts/CsvClient-CsvServer.json -p 8080
pact_do_not_track=true ~/.pact/bin/pact_verifier_cli -f ../csv-consumer-jvm/build/pacts/CsvClient-CsvServer.json -p 8080
cd ../csv-provider-jvm
mkdir -p server/src/test/resources/pacts
cp ../csv-consumer-jvm/build/pacts/CsvClient-CsvServer.json server/src/test/resources/pacts
Expand All @@ -70,7 +70,7 @@ jobs:
nohup ./target/debug/csv-provider &
PID=$!
trap "kill $PID" EXIT
pact_do_not_track=true ~/bin/pact_verifier_cli -f ../csv-consumer-jvm/build/pacts/CsvClient-CsvServer.json -p 8080
pact_do_not_track=true ~/.pact/bin/pact_verifier_cli -f ../csv-consumer-jvm/build/pacts/CsvClient-CsvServer.json -p 8080
shell: bash
working-directory: examples/csv
if: runner.os == 'Windows'
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
run: scripts/install-plugin-cli.sh
shell: bash
- name: Install Protobuf plugin
run: ~/bin/pact-plugin-cli -y install protobuf
run: ~/.pact/bin/pact-plugin-cli -y install protobuf
shell: bash
- name: Install Pact verifier
run: scripts/install-verifier-cli.sh
Expand Down Expand Up @@ -138,8 +138,8 @@ jobs:
PID=$!
trap "kill $PID" EXIT
timeout --foreground -s TERM 30s bash -c 'while [[ "$(curl -s -o /dev/null -m 3 -L -w ''%{http_code}'' -XPOST -d'{}' http://127.0.0.1:8111)" != "200" ]]; do echo "Waiting for http://127.0.0.1:8111" && sleep 2; done'
pact_do_not_track=true ~/bin/pact_verifier_cli -f ../protobuf-consumer-rust/target/pacts/protobuf-consumer-rust-protobuf-provider.json -p 8111
pact_do_not_track=true ~/bin/pact_verifier_cli -f ../protobuf-consumer-jvm/build/pacts/protobuf-consumer-protobuf-provider.json -p 8111
pact_do_not_track=true ~/.pact/bin/pact_verifier_cli -f ../protobuf-consumer-rust/target/pacts/protobuf-consumer-rust-protobuf-provider.json -p 8111
pact_do_not_track=true ~/.pact/bin/pact_verifier_cli -f ../protobuf-consumer-jvm/build/pacts/protobuf-consumer-protobuf-provider.json -p 8111
shell: bash
working-directory: examples/protobuf
if: runner.os == 'Linux'
Expand All @@ -158,8 +158,8 @@ jobs:
PID=$!
trap "kill $PID" EXIT
timeout --foreground -s TERM 30s bash -c 'while [[ "$(curl -s -o /dev/null -m 3 -L -w ''%{http_code}'' -XPOST -d'{}' http://127.0.0.1:8111)" != "200" ]]; do echo "Waiting for http://127.0.0.1:8111" && sleep 2; done'
pact_do_not_track=true ~/bin/pact_verifier_cli -f ../protobuf-consumer-rust/target/pacts/protobuf-consumer-rust-protobuf-provider.json -p 8111
pact_do_not_track=true ~/bin/pact_verifier_cli -f ../protobuf-consumer-jvm/build/pacts/protobuf-consumer-protobuf-provider.json -p 8111
pact_do_not_track=true ~/.pact/bin/pact_verifier_cli -f ../protobuf-consumer-rust/target/pacts/protobuf-consumer-rust-protobuf-provider.json -p 8111
pact_do_not_track=true ~/.pact/bin/pact_verifier_cli -f ../protobuf-consumer-jvm/build/pacts/protobuf-consumer-protobuf-provider.json -p 8111
shell: bash
working-directory: examples/protobuf
if: runner.os != 'Linux'
Expand Down Expand Up @@ -199,7 +199,7 @@ jobs:
run: scripts/install-plugin-cli.sh
shell: bash
- name: Install Protobuf plugin
run: ~/bin/pact-plugin-cli -y install protobuf
run: ~/.pact/bin/pact-plugin-cli -y install protobuf
shell: bash
- name: Install Pact verifier
run: scripts/install-verifier-cli.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: scripts/install-plugin-cli.sh
shell: bash
- name: Install Protobuf plugin
run: ~/bin/pact-plugin-cli -y install protobuf
run: ~/.pact/bin/pact-plugin-cli -y install protobuf
shell: bash
- name: Run plugin driver tests
run: ./gradlew -s --no-daemon -i check
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
run: scripts/install-plugin-cli.sh
shell: bash
- name: Install Protobuf plugin
run: ~/bin/pact-plugin-cli -y install protobuf
run: ~/.pact/bin/pact-plugin-cli -y install protobuf
shell: bash
- name: Run plugin driver tests
run: ./gradlew -s --no-daemon -i check
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
run: scripts/install-plugin-cli.sh
shell: bash
- name: Install Protobuf plugin
run: ~/bin/pact-plugin-cli -y install protobuf
run: ~/.pact/bin/pact-plugin-cli -y install protobuf
shell: bash
- name: Install csv plugin
run: ~/bin/pact-plugin-cli -y install csv
run: ~/.pact/bin/pact-plugin-cli -y install csv
shell: bash
- name: Tests
run: cargo test
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.88.77/pact-1.88.77-linux-x86_64.tar.gz
tar xzf pact-1.88.77-linux-x86_64.tar.gz
VER=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
pact/bin/pact-broker publish -a "$VER+$GITHUB_SHA" -b https://pact-foundation.pactflow.io -k ${{ secrets.PACTFLOW_TOKEN }} target/pacts
pact/bin/pact-broker publish -a "$VER+$GITHUB_SHA" -b https://saf.pactflow.io -k ${{ secrets.PACTFLOW_TOKEN }} target/pacts
working-directory: drivers/rust/driver_pact_tests
if: runner.os == 'Linux'

Expand Down
34 changes: 21 additions & 13 deletions scripts/install-plugin-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,44 @@ set -x

VERSION="0.1.0"

mkdir -p ~/bin
mkdir -p ~/.pact/bin
case "$(uname -s)" in

Darwin)
echo '== Installing plugin CLI for Mac OSX =='
if [ "$(uname -m)" == "arm64" ]; then
curl -L -o ~/bin/pact-plugin-cli.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-osx-aarch64.gz
if [ "$(uname -m)" = "arm64" ]; then
curl -L -o ~/.pact/bin/pact-plugin-cli.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-osx-aarch64.gz
else
curl -L -o ~/bin/pact-plugin-cli.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-osx-x86_64.gz
curl -L -o ~/.pact/bin/pact-plugin-cli.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-osx-x86_64.gz
fi
gunzip -N -f ~/bin/pact-plugin-cli.gz
chmod +x ~/bin/pact-plugin-cli
gunzip -N -f ~/.pact/bin/pact-plugin-cli.gz
chmod +x ~/.pact/bin/pact-plugin-cli
;;

Linux)
echo '== Installing plugin CLI for Linux =='
curl -L -o ~/bin/pact-plugin-cli.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-linux-x86_64.gz
gunzip -N -f ~/bin/pact-plugin-cli.gz
chmod +x ~/bin/pact-plugin-cli
if [ "$(uname -m)" = "aarch64" ]; then
curl -L -o ~/.pact/bin/pact-plugin-cli.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-linux-aarch64.gz
else
curl -L -o ~/.pact/bin/pact-plugin-cli.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-linux-x86_64.gz
fi
gunzip -N -f ~/.pact/bin/pact-plugin-cli.gz
chmod +x ~/.pact/bin/pact-plugin-cli
;;

CYGWIN*|MINGW32*|MSYS*|MINGW*)
echo '== Installing plugin CLI for MS Windows =='
curl -L -o ~/bin/pact-plugin-cli.exe.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-windows-x86_64.exe.gz
gunzip -N -f ~/bin/pact-plugin-cli.exe.gz
chmod +x ~/bin/pact-plugin-cli.exe
if [ "$(uname -m)" = "aarch64" ]; then
curl -L -o ~/.pact/bin/pact-plugin-cli.exe.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-windows-aarch64.exe.gz
else
curl -L -o ~/.pact/bin/pact-plugin-cli.exe.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-windows-x86_64.exe.gz
fi
gunzip -N -f ~/.pact/bin/pact-plugin-cli.exe.gz
chmod +x ~/.pact/bin/pact-plugin-cli.exe
;;

*)
echo "ERROR: $(uname -s) is not a supported operating system"
exit 1
;;
esac
esac
40 changes: 24 additions & 16 deletions scripts/install-verifier-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,44 @@ set -x

VERSION="0.9.20"

mkdir -p ~/bin
mkdir -p ~/.pact/bin
case "$(uname -s)" in

Darwin)
echo '== Installing verifier CLI for Mac OSX =='
if [ "$(uname -m)" == "arm64" ]; then
curl -L -o ~/bin/pact_verifier_cli.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-osx-aarch64.gz
echo '== Installing pact verifier CLI for Mac OSX =='
if [ "$(uname -m)" = "arm64" ]; then
curl -L -o ~/.pact/bin/pact_verifier_cli.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-osx-aarch64.gz
else
curl -L -o ~/bin/pact_verifier_cli.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-osx-x86_64.gz
curl -L -o ~/.pact/bin/pact_verifier_cli.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-osx-x86_64.gz
fi
gunzip -N -f ~/bin/pact_verifier_cli.gz
chmod +x ~/bin/pact_verifier_cli
gunzip -N -f ~/.pact/bin/pact_verifier_cli.gz
chmod +x ~/.pact/bin/pact_verifier_cli
;;

Linux)
echo '== Installing verifier CLI for Linux =='
curl -L -o ~/bin/pact_verifier_cli.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-linux-x86_64.gz
gunzip -N -f ~/bin/pact_verifier_cli.gz
chmod +x ~/bin/pact_verifier_cli
echo '== Installing pact verifier CLI for Linux =='
if [ "$(uname -m)" = "aarch64" ]; then
curl -L -o ~/.pact/bin/pact_verifier_cli.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-linux-aarch64.gz
else
curl -L -o ~/.pact/bin/pact_verifier_cli.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-linux-x86_64.gz
fi
gunzip -N -f ~/.pact/bin/pact_verifier_cli.gz
chmod +x ~/.pact/bin/pact_verifier_cli
;;

CYGWIN*|MINGW32*|MSYS*|MINGW*)
echo '== Installing verifier CLI for MS Windows =='
curl -L -o ~/bin/pact_verifier_cli.exe.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-windows-x86_64.exe.gz
gunzip -N -f ~/bin/pact_verifier_cli.exe.gz
chmod +x ~/bin/pact_verifier_cli.exe
echo '== Installing pact verifier CLI for MS Windows =='
if [ "$(uname -m)" = "aarch64" ]; then
curl -L -o ~/.pact/bin/pact_verifier_cli.exe.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-windows-aarch64.exe.gz
else
curl -L -o ~/.pact/bin/pact_verifier_cli.exe.gz https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v${VERSION}/pact_verifier_cli-windows-x86_64.exe.gz
fi
gunzip -N -f ~/.pact/bin/pact_verifier_cli.exe.gz
chmod +x ~/.pact/bin/pact_verifier_cli.exe
;;

*)
echo "ERROR: $(uname -s) is not a supported operating system"
exit 1
;;
esac
esac
2 changes: 1 addition & 1 deletion scripts/run-grpc-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ trap "kill $PID" EXIT
sleep 1
ls -la
PROVIDER_PORT=$(cat provider.go.out | cut -f4 -d:)
~/bin/pact_verifier_cli -f ../consumer-jvm/build/pacts/grpc-consumer-jvm-area-calculator-provider.json\
~/.pact/bin/pact_verifier_cli -f ../consumer-jvm/build/pacts/grpc-consumer-jvm-area-calculator-provider.json\
-f ../consumer-rust/target/pacts/grpc-consumer-rust-area-calculator-provider.json\
-f ../consumer-go/pacts/grpc-consumer-go-area-calculator-provider.json\
-p "$PROVIDER_PORT"

0 comments on commit aaddff9

Please sign in to comment.