-
Notifications
You must be signed in to change notification settings - Fork 2.2k
328 lines (297 loc) · 11.8 KB
/
test-suite-e2e-tests.yml
File metadata and controls
328 lines (297 loc) · 11.8 KB
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
name: test-suite-e2e-tests
on:
workflow_dispatch:
inputs: &workflow_inputs
image_mode:
description: "Use registry images or build workspace overrides on the runner"
default: "registry"
type: string
override:
description: "Comma-separated override values for workspace mode (for example: all, coprocessor, or coprocessor:host-listener)"
default: ""
type: string
coprocessor-db-migration-version:
description: "Coprocessor DB Migration Image Version"
default: ""
type: string
coprocessor-host-listener-version:
description: "Coprocessor Host Listener Image Version"
default: ""
type: string
coprocessor-gw-listener-version:
description: "Coprocessor Gateway Listener Image Version"
default: ""
type: string
coprocessor-tx-sender-version:
description: "Coprocessor Transaction Sender Image Version"
default: ""
type: string
coprocessor-tfhe-worker-version:
description: "Coprocessor TFHE Worker Image Version"
default: ""
type: string
coprocessor-sns-worker-version:
description: "Coprocessor SNS Worker Image Version"
default: ""
type: string
coprocessor-zkproof-worker-version:
description: "Coprocessor ZKProof Worker Image Version"
default: ""
type: string
gateway-version:
description: "Gateway version"
default: ""
type: string
host-version:
description: "Host version"
default: ""
type: string
connector-db-migration-version:
description: "KMS Connector DB Migration Image Version"
default: ""
type: string
connector-gw-listener-version:
description: "KMS Connector Gateway Listener Image Version"
default: ""
type: string
connector-kms-worker-version:
description: "KMS Connector KMS Worker Image Version"
default: ""
type: string
connector-tx-sender-version:
description: "KMS Connector Transaction Sender Image Version"
default: ""
type: string
test-suite-version:
description: "Test suite version"
default: ""
type: string
relayer-version:
description: "Relayer version"
default: ""
type: string
kms-core-version:
description: "KMS Core version"
default: ""
type: string
workflow_call:
secrets:
GHCR_READ_TOKEN:
required: true
CGR_USERNAME:
required: true
CGR_PASSWORD:
required: true
inputs: *workflow_inputs
permissions: {}
# Allow to run multiple instances of the same workflow in parallel when triggered manually
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || 'auto' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
fhevm-e2e-test:
permissions:
contents: 'read' # Required to checkout repository code
id-token: 'write' # Required for OIDC authentication
packages: 'read' # Required to read GitHub packages/container registry
env:
GH_TOKEN: ${{ secrets.GHCR_READ_TOKEN || github.token }}
IMAGE_MODE: ${{ inputs.image_mode || 'registry' }}
WORKSPACE_OVERRIDE: ${{ inputs.override || '' }}
COPROCESSOR_DB_MIGRATION_VERSION: ${{ inputs.coprocessor-db-migration-version }}
COPROCESSOR_HOST_LISTENER_VERSION: ${{ inputs.coprocessor-host-listener-version }}
COPROCESSOR_GW_LISTENER_VERSION: ${{ inputs.coprocessor-gw-listener-version }}
COPROCESSOR_TX_SENDER_VERSION: ${{ inputs.coprocessor-tx-sender-version }}
COPROCESSOR_TFHE_WORKER_VERSION: ${{ inputs.coprocessor-tfhe-worker-version }}
COPROCESSOR_SNS_WORKER_VERSION: ${{ inputs.coprocessor-sns-worker-version }}
COPROCESSOR_ZKPROOF_WORKER_VERSION: ${{ inputs.coprocessor-zkproof-worker-version }}
GATEWAY_VERSION: ${{ inputs.gateway-version }}
HOST_VERSION: ${{ inputs.host-version }}
CONNECTOR_DB_MIGRATION_VERSION: ${{ inputs.connector-db-migration-version }}
CONNECTOR_GW_LISTENER_VERSION: ${{ inputs.connector-gw-listener-version }}
CONNECTOR_KMS_WORKER_VERSION: ${{ inputs.connector-kms-worker-version }}
CONNECTOR_TX_SENDER_VERSION: ${{ inputs.connector-tx-sender-version }}
TEST_SUITE_VERSION: ${{ inputs.test-suite-version }}
RELAYER_VERSION: ${{ inputs.relayer-version }}
CORE_VERSION: ${{ inputs.kms-core-version }}
runs-on: large_ubuntu_32
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
- name: Setup Docker
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Setup Bun
uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2
- name: Install foundry
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_READ_TOKEN }}
- name: Login to Chainguard Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: cgr.dev
username: ${{ secrets.CGR_USERNAME }}
password: ${{ secrets.CGR_PASSWORD }}
- name: Install CLI deps
working-directory: test-suite/fhevm
run: bun install --frozen-lockfile
- name: Resolve CLI up args
working-directory: test-suite/fhevm
run: |
set -euo pipefail
args_file="$RUNNER_TEMP/fhevm-up-args"
printf '%s\n%s\n' --target latest-release > "$args_file"
case "$IMAGE_MODE" in
registry)
if [ -n "$WORKSPACE_OVERRIDE" ]; then
echo "::error::override requires image_mode=workspace"
exit 1
fi
;;
workspace)
if [ -z "$WORKSPACE_OVERRIDE" ]; then
echo "::error::image_mode=workspace requires override"
exit 1
fi
IFS=',' read -r -a overrides <<< "$WORKSPACE_OVERRIDE"
for raw in "${overrides[@]}"; do
override="${raw#"${raw%%[![:space:]]*}"}"
override="${override%"${override##*[![:space:]]}"}"
[ -n "$override" ] || continue
printf '%s\n%s\n' --override "$override" >> "$args_file"
done
if ! grep -qx -- --override "$args_file"; then
echo "::error::override did not contain any usable values"
exit 1
fi
;;
*)
echo "::error::image_mode must be registry or workspace"
exit 1
;;
esac
echo "UP_ARGS_FILE=$args_file" >> "$GITHUB_ENV"
- name: Dry run
working-directory: test-suite/fhevm
run: |
mapfile -t up_args < "$UP_ARGS_FILE"
./fhevm-cli up "${up_args[@]}" --dry-run
- name: Boot fhevm Stack
working-directory: test-suite/fhevm
run: |
mapfile -t up_args < "$UP_ARGS_FILE"
./fhevm-cli up "${up_args[@]}"
# E2E tests on pausing the Host contracts
- name: Pause Host Contracts
working-directory: test-suite/fhevm
run: |
./fhevm-cli pause host
- name: Paused Host contracts test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test paused-host-contracts
- name: Unpause Host Contracts
working-directory: test-suite/fhevm
run: |
./fhevm-cli unpause host
# E2E tests on pausing the Gateway contracts
- name: Pause Gateway Contracts
working-directory: test-suite/fhevm
run: |
./fhevm-cli pause gateway
- name: Paused Gateway contracts test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test paused-gateway-contracts
- name: Unpause Gateway Contracts
working-directory: test-suite/fhevm
run: |
./fhevm-cli unpause gateway
# E2E tests after unpausing the Host and Gateway contracts
- name: Input proof test (uint64)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test input-proof
- name: Input proof test with compute and decrypt (uint64)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test input-proof-compute-decrypt
- name: User Decryption test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test user-decryption
- name: Delegated User Decryption test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test delegated-user-decryption
- name: ERC20 test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test erc20
- name: Public Decryption HTTP endpoint test (ebool)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test public-decrypt-http-ebool
- name: Public Decryption HTTP endpoint test (mixed)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test public-decrypt-http-mixed
- name: Random operators test (subset)
working-directory: test-suite/fhevm
run: |
./fhevm-cli test random-subset
- name: HCU block cap test
working-directory: test-suite/fhevm
run: |
./fhevm-cli test hcu-block-cap
- name: Host listener poller test
working-directory: test-suite/fhevm
run: |
docker stop coprocessor-host-listener
./fhevm-cli test erc20
docker start coprocessor-host-listener
- name: Show logs on test failure
working-directory: test-suite/fhevm
if: failure()
run: |
echo "::group::Relayer Logs"
timeout 20 ./fhevm-cli logs fhevm-relayer || true
echo "::endgroup::"
echo "::group::SNS Worker Logs"
timeout 20 ./fhevm-cli logs coprocessor-sns-worker | grep -v "Selected 0 rows to process" || true
echo "::endgroup::"
echo "::group::Transaction Sender Logs (filtered)"
timeout 20 ./fhevm-cli logs coprocessor-transaction-sender | grep -v "Selected 0 rows to process" || true
echo "::endgroup::"
echo "::group::Host Listener"
timeout 20 ./fhevm-cli logs coprocessor-host-listener || true
echo "::endgroup::"
echo "::group::Gateway Listener"
timeout 20 ./fhevm-cli logs coprocessor-gw-listener || true
echo "::endgroup::"
echo "::group::ZKProof Worker"
timeout 20 ./fhevm-cli logs coprocessor-zkproof-worker || true
echo "::endgroup::"
echo "::group::TFHE Worker"
timeout 20 ./fhevm-cli logs coprocessor-tfhe-worker || true
echo "::endgroup::"
echo "::group::Coprocessor 2 - SNS Worker"
./fhevm-cli logs coprocessor-2-sns-worker 2>/dev/null | grep -v "Selected 0 rows to process" || true
echo "::endgroup::"
echo "::group::Coprocessor 2 - Transaction Sender (filtered)"
./fhevm-cli logs coprocessor-2-transaction-sender 2>/dev/null | grep -v "Selected 0 rows to process" || true
echo "::endgroup::"
echo "::group::Coprocessor 2 - TFHE Worker"
./fhevm-cli logs coprocessor-2-tfhe-worker 2>/dev/null || true
echo "::endgroup::"
- name: Cleanup
working-directory: test-suite/fhevm
if: always()
run: |
./fhevm-cli clean --images