Fix repository SHA #659
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pact Plugin Examples | |
on: | |
- push | |
- pull_request | |
jobs: | |
csv-examples: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
operating-system: [ ubuntu-latest, windows-latest, macos-12 ] | |
env: | |
PACT_DO_NOT_TRACK: true | |
RUST_LOG: trace | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install plugin cli | |
run: scripts/install-plugin-cli.sh | |
shell: bash | |
- name: Install Protobuf plugin | |
run: ~/.pact/bin/pact-plugin-cli -y install protobuf | |
shell: bash | |
- name: Install csv plugin | |
run: ~/.pact/bin/pact-plugin-cli -y install csv | |
shell: bash | |
- name: Install Pact verifier | |
run: scripts/install-verifier-cli.sh | |
shell: bash | |
- name: Run CSV examples (Non-Windows) | |
run: | | |
set -e | |
cd csv-consumer-jvm | |
./gradlew check | |
cd ../csv-consumer-rust | |
pact_do_not_track=true cargo test | |
cd ../csv-provider | |
cargo build | |
nohup ./target/debug/csv-provider & | |
PID=$! | |
trap "kill $PID" EXIT | |
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 | |
./gradlew check | |
shell: bash | |
working-directory: examples/csv | |
if: runner.os != 'Windows' | |
- name: Run CSV examples (Windows) | |
run: | | |
set -e | |
cd csv-consumer-jvm | |
./gradlew check | |
cd ../csv-provider | |
cargo build | |
nohup ./target/debug/csv-provider & | |
PID=$! | |
trap "kill $PID" EXIT | |
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' | |
protobuf-examples: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
operating-system: [ ubuntu-latest, windows-latest, macos-12 ] | |
env: | |
PACT_DO_NOT_TRACK: true | |
RUST_LOG: trace | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19.x | |
- name: Install plugin cli | |
run: scripts/install-plugin-cli.sh | |
shell: bash | |
- name: Install Protobuf plugin | |
run: ~/.pact/bin/pact-plugin-cli -y install protobuf | |
shell: bash | |
- name: Install Pact verifier | |
run: scripts/install-verifier-cli.sh | |
shell: bash | |
- name: Install timeout on OSX | |
run: | | |
brew install coreutils | |
shell: bash | |
if: runner.os == 'macOS' | |
- name: Build docker container | |
run: docker build -f examples/protobuf/Dockerfile.rust -t protobuf-container . | |
if: runner.os == 'Linux' | |
- name: Run Protobuf examples (Linux) | |
run: | | |
set -e | |
pushd protobuf-consumer-jvm | |
./gradlew check | |
popd | |
pushd protobuf-consumer-maven | |
mvn verify | |
popd | |
pushd ../.. | |
docker run -t -v $(pwd):/build protobuf-container -c 'cd examples/protobuf/protobuf-consumer-rust && cargo test' | |
popd | |
pushd protobuf-provider | |
go build main.go | |
nohup ./main & | |
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 ~/.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' | |
- name: Run Protobuf examples (Non-Linux) | |
run: | | |
set -e | |
cd protobuf-consumer-jvm | |
./gradlew check | |
cd ../protobuf-consumer-maven | |
mvn verify | |
cd ../protobuf-consumer-rust | |
pact_do_not_track=true cargo test -- --test-threads 1 | |
cd ../protobuf-provider | |
go build main.go | |
nohup ./main & | |
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 ~/.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' | |
- name: Run area calculator Protobuf example | |
run: | | |
pact_do_not_track=true cargo test -- --test-threads 1 | |
shell: bash | |
working-directory: examples/protobuf/area_calculator_example/consumer | |
grpc-examples: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
operating-system: [ ubuntu-latest, windows-latest, macos-12 ] | |
env: | |
PACT_DO_NOT_TRACK: true | |
RUST_LOG: trace | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19.x | |
- name: Install plugin cli | |
run: scripts/install-plugin-cli.sh | |
shell: bash | |
- name: Install Protobuf plugin | |
run: ~/.pact/bin/pact-plugin-cli -y install protobuf | |
shell: bash | |
- name: Install Pact verifier | |
run: scripts/install-verifier-cli.sh | |
shell: bash | |
- name: Install timeout on OSX | |
run: | | |
brew install coreutils | |
shell: bash | |
if: runner.os == 'macOS' | |
- name: Install Pact Go (Linux) | |
run: | | |
go install github.com/pact-foundation/pact-go/[email protected] | |
sudo $HOME/go/bin/pact-go -l DEBUG install | |
sudo chmod 644 /usr/local/lib/libpact_ffi.so | |
ls -la /usr/local/lib/ | |
shell: bash | |
if: runner.os == 'Linux' | |
- name: Install Pact Go (OSX) | |
run: | | |
go install github.com/pact-foundation/pact-go/[email protected] | |
$HOME/go/bin/pact-go -l DEBUG install | |
shell: bash | |
if: runner.os == 'macOS' | |
- name: Install Pact Go (Windows) | |
run: | | |
go install github.com/pact-foundation/pact-go/[email protected] | |
#$HOME/go/bin/pact-go -l DEBUG install | |
curl -L -o ~/.pact/pact_ffi.dll.gz https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v0.4.5/pact_ffi-windows-x86_64.dll.gz | |
gunzip -N -f ~/.pact/pact_ffi.dll.gz | |
cp ~/.pact/pact_ffi.dll examples/gRPC/area_calculator/consumer-go | |
shell: bash | |
env: | |
PACT_GO_LIB_DOWNLOAD_PATH: .pact | |
if: runner.os == 'Windows' | |
- name: Run gRPC examples | |
run: ../../../scripts/run-grpc-examples.sh | |
shell: bash | |
working-directory: examples/gRPC/area_calculator |