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

Feat/rust tools #146

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,3 @@ jobs:
uses: actions/download-artifact@v3
- name: test ${{ matrix.os }} package
run: ./script/unpack-and-test.sh
- name: test x86 package
if: ${{ runner.os == 'Windows'}}
run: ./script/unpack-and-test.sh
env:
BINARY_OS: 'windows'
BINARY_ARCH: 'x86'
28 changes: 23 additions & 5 deletions packaging/README.md.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

![Build](https://github.com/pact-foundation/pact-ruby-standalone/workflows/Build/badge.svg)

Creates a standalone pact command line executable using the ruby pact implementation and Traveling Ruby
Creates a standalone pact command line executable containing

- The rust pact implementation via cargo executables
- The ruby pact implementation via Traveling Ruby

## Package contents

Expand All @@ -14,6 +17,10 @@ This version (<%= ENV.fetch('VERSION') %>) of the Pact standalone executables pa
* pact-provider-verifier gem <%= Pact::ProviderVerifier::VERSION %>
* pact_broker-client gem <%= PactBroker::Client::VERSION %>
* pact-message gem <%= Pact::Message::VERSION %>
* [pact_mock_server_cli](https://github.com/pact-foundation/pact-core-mock-server/tree/main/pact_mock_server_cli)
* [pact-stub-server](https://github.com/pact-foundation/pact-stub-server)
* [pact_verifier_cli](https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_verifier_cli)
* [pact-plugin-cli](https://github.com/pact-foundation/pact-plugins/tree/main/cli)

Binaries will be extracted into `pact/bin`:

Expand All @@ -25,19 +32,31 @@ Binaries will be extracted into `pact/bin`:
├── pact-message
├── pact-mock-service
├── pact-provider-verifier
└── pact-stub-service
├── pact-stub-service
├── pact_mock_server_cli (rust)
├── pact-stub-server (rust)
├── pact_verifier_cli (rust)
└── pact-plugin-cli (rust)
```

### Windows Users

Please append `.bat` to any of the provided binaries
Please append `.bat` to any of the provided ruby-based binaries

eg.

```ps1
.\pact\bin\pact-broker.bat
```

Please append `.exe` to any of the provided rust based binaries

eg.

```ps1
.\pact\bin\pact_mock_server_cli.exe
```

## Installation

See the [release page][releases].
Expand All @@ -55,10 +74,9 @@ Ruby is not required on the host platform, Ruby 3.3.3 is provided in the distrib
| Linux | 3.3.3 | x86_64 | ✅ |
| Linux | 3.3.3 | aarch64 (arm64)| ✅ |
| Windows| 3.3.3 | x86_64 | ✅ |
| Windows| 3.3.3 | x86 | ✅ |
| Windows| 3.3.3 | aarch64 (arm64)| 🚧 |

🚧 - Tested under emulation mode x86 / x86_64 in Windows on ARM
🚧 - Tested under emulation mode x86_64 in Windows on ARM

## Usage

Expand Down
10 changes: 1 addition & 9 deletions packaging/RELEASE_NOTES.md.template
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,4 @@ tar xzf pact-<PACKAGE_VERSION>-linux-arm64.tar.gz
```
curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/<TAG_NAME>/pact-<PACKAGE_VERSION>-windows-x86_64.zip
unzip pact-<PACKAGE_VERSION>-windows-x86_64.zip
```

#### x86

```
curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/<TAG_NAME>/pact-<PACKAGE_VERSION>-windows-x86.zip
unzip pact-<PACKAGE_VERSION>-windows-x86.zip
```

```
25 changes: 13 additions & 12 deletions script/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,36 @@ if [ "$BINARY_OS" == "" ] || [ "$BINARY_ARCH" == "" ] ; then
BINARY_OS=windows
BINARY_ARCH=x86_64
;;
"Windows"* | "MINGW"*)
BINARY_OS=windows
BINARY_ARCH=x86
;;
*)
echo "Sorry, os not determined"
exit 1
;;
esac;
fi

if [ "$BINARY_OS" != "windows" ] ; then PATH_SEPERATOR=/ ; else PATH_SEPERATOR=\\; fi
PATH_TO_BIN=.${PATH_SEPERATOR}pkg${PATH_SEPERATOR}pact${PATH_SEPERATOR}bin${PATH_SEPERATOR}

tools=(
# pact
pact
pact-broker
pact-message
pact-mock-service
pact-plugin-cli
pact-provider-verifier
pact-stub-service
pactflow
pact-plugin-cli
pact-stub-server
pact_verifier_cli
pact_mock_server_cli
)

test_cmd=""
for tool in ${tools[@]}; do
echo testing $tool
if [ "$BINARY_OS" != "windows" ] ; then echo "no bat file ext needed for $(uname -a)" ; else FILE_EXT=.bat; fi
if [ "$BINARY_OS" = "windows" ] && [ "$tool" = "pact-plugin-cli" ] ; then FILE_EXT=.exe ; else echo "no exe file ext needed for $(uname -a)"; fi
if [ "$BINARY_OS" = "windows" ] ; then FILE_EXT=.bat; fi
if [ "$BINARY_OS" = "windows" ] && ([ "$tool" = "pact-plugin-cli" ] || [ "$tool" = "pact-stub-server" ] || [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact_mock_server_cli" ]) ; then FILE_EXT=.exe ; fi
if [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact-mock-service" ]; then test_cmd="--help" ; fi
echo executing ${tool}${FILE_EXT}
if [ "$BINARY_ARCH" = "x86" ] && [ "$tool" = "pact-plugin-cli" ] ; then echo "skipping for x86" ; else ${tool}${FILE_EXT} help; fi
done


${PATH_TO_BIN}${tool}${FILE_EXT} ${test_cmd};
done
28 changes: 15 additions & 13 deletions script/unpack-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ if [ "$BINARY_OS" == "" ] || [ "$BINARY_ARCH" == "" ] ; then
BINARY_OS=windows
BINARY_ARCH=x86_64
;;
"Windows"* | "MINGW"*)
BINARY_OS=windows
BINARY_ARCH=x86
;;
*)
echo "Sorry, os not determined"
exit 1
;;
esac;
fi

if [[ "$BINARY_OS" == "windows" ]]; then
FILE_EXT=".zip"
fi

cd pkg
rm -rf pact
Expand All @@ -50,22 +49,25 @@ if [ "$BINARY_OS" != "windows" ] ; then PATH_SEPERATOR=/ ; else PATH_SEPERATOR=\
PATH_TO_BIN=.${PATH_SEPERATOR}pact${PATH_SEPERATOR}bin${PATH_SEPERATOR}

tools=(
# pact
pact
pact-broker
pact-message
pact-mock-service
pact-plugin-cli
pact-provider-verifier
pact-stub-service
pactflow
pact-plugin-cli
pact-stub-server
pact_verifier_cli
pact_mock_server_cli
)

test_cmd=""
for tool in ${tools[@]}; do
echo testing $tool
if [ "$BINARY_OS" != "windows" ] ; then echo "no bat file ext needed for $(uname -a)" ; else FILE_EXT=.bat; fi
if [ "$BINARY_OS" = "windows" ] && [ "$tool" = "pact-plugin-cli" ] ; then FILE_EXT=.exe ; else echo "no exe file ext needed for $(uname -a)"; fi
echo executing ${PATH_TO_BIN}${tool}${FILE_EXT}
if [ "$BINARY_ARCH" = "x86" ] && [ "$tool" = "pact-plugin-cli" ] ; then echo "skipping for x86" ; else ${PATH_TO_BIN}${tool}${FILE_EXT} help; fi
done


if [ "$BINARY_OS" = "windows" ] ; then FILE_EXT=.bat; fi
if [ "$BINARY_OS" = "windows" ] && ([ "$tool" = "pact-plugin-cli" ] || [ "$tool" = "pact-stub-server" ] || [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact_mock_server_cli" ]) ; then FILE_EXT=.exe ; fi
if [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact-mock-service" ]; then test_cmd="--help" ; fi
echo executing ${tool}${FILE_EXT}
${PATH_TO_BIN}${tool}${FILE_EXT} ${test_cmd};
done
Loading
Loading