Skip to content

Commit

Permalink
test: test plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed May 10, 2024
1 parent 70ccb23 commit 1bc229d
Show file tree
Hide file tree
Showing 6 changed files with 518 additions and 2 deletions.
1 change: 1 addition & 0 deletions script/ci/download-standalone-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the
. "$SCRIPT_DIR"/../lib/robust-bash.sh

./script/download-standalone.sh
./script/download-plugins.sh
./script/ci/build-and-test.sh
3 changes: 2 additions & 1 deletion script/download-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the

. "${SCRIPT_DIR}/lib/export-binary-versions.sh"
"${SCRIPT_DIR}/lib/download-ffi.sh"
"${SCRIPT_DIR}/lib/download-standalone.sh"
"${SCRIPT_DIR}/lib/download-standalone.sh"
"${SCRIPT_DIR}/lib/download-plugins.sh"
6 changes: 6 additions & 0 deletions script/download-plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -eu
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running

. "${SCRIPT_DIR}/lib/export-binary-versions.sh"
"${SCRIPT_DIR}/install-plugin-cli.sh"
$HOME/.pact/bin/pact-plugin-cli install -y https://github.com/mefellows/pact-matt-plugin/releases/tag/$PACT_PLUGIN_MATT_VERSION
86 changes: 86 additions & 0 deletions script/install-plugin-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/sh -e
#
# Usage:
# $ curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-plugins/master/install-cli.sh | bash
# or
# $ wget -q https://raw.githubusercontent.com/pact-foundation/pact-plugins/master/install-cli.sh -O- | bash
#
set -e # Needed for Windows bash, which doesn't read the shebang





detect_osarch() {
# detect_musl
case $(uname -sm) in
'Linux x86_64')
if ldd /bin/ls >/dev/null 2>&1; then
ldd_output=$(ldd /bin/ls)
case "$ldd_output" in
*musl*)
os='linux'
arch='x86_64-musl'
;;
*)
os='linux'
arch='x86_64'
;;
esac
else
os='linux'
arch='x86_64'
fi
;;
'Linux aarch64')
if ldd /bin/ls >/dev/null 2>&1; then
ldd_output=$(ldd /bin/ls)
case "$ldd_output" in
*musl*)
os='linux'
arch='aarch64-musl'
;;
*)
os='linux'
arch='aarch64'
;;
esac
else
os='linux'
arch='aarch64'
fi
;;
'Darwin x86' | 'Darwin x86_64')
os='osx'
arch='x86_64'
;;
'Darwin arm64')
os='osx'
arch='aarch64'
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
os="windows"
arch='x86_64'
ext='.exe'
;;
*)
echo "Sorry, you'll need to install the plugin CLI manually."
exit 1
;;
esac
}


VERSION="0.1.2"
detect_osarch

if [ ! -f ~/.pact/bin/pact-plugin-cli ]; then
echo "--- 🐿 Installing plugins CLI version '${VERSION}' (from tag ${TAG})"
mkdir -p ~/.pact/bin
DOWNLOAD_LOCATION=https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-${os}-${arch}${ext}.gz
echo " Downloading from: ${DOWNLOAD_LOCATION}"
curl -L -o ~/.pact/bin/pact-plugin-cli-${os}-${arch}.gz "${DOWNLOAD_LOCATION}"
echo " Downloaded $(file ~/.pact/bin/pact-plugin-cli-${os}-${arch}.gz)"
gunzip -N -f ~/.pact/bin/pact-plugin-cli-${os}-${arch}.gz
chmod +x ~/.pact/bin/pact-plugin-cli
fi
3 changes: 2 additions & 1 deletion script/lib/export-binary-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the scr
PROJECT_DIR="${LIB_DIR}"/../../

export STANDALONE_VERSION=$(grep "PACT_STANDALONE_VERSION = '" "$PROJECT_DIR"/standalone/install.ts | grep -E -o "'(.*)'" | cut -d"'" -f2)
export FFI_VERSION=v$(grep "PACT_FFI_VERSION = '" "$PROJECT_DIR"/src/ffi/index.ts | grep -E -o "'(.*)'" | cut -d"'" -f2)
export FFI_VERSION=v$(grep "PACT_FFI_VERSION = '" "$PROJECT_DIR"/src/ffi/index.ts | grep -E -o "'(.*)'" | cut -d"'" -f2)
export PACT_PLUGIN_MATT_VERSION=v0.1.1
Loading

0 comments on commit 1bc229d

Please sign in to comment.