-
-
Notifications
You must be signed in to change notification settings - Fork 11
238 lines (234 loc) Β· 8.56 KB
/
examples.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
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