-
Notifications
You must be signed in to change notification settings - Fork 1.7k
370 lines (355 loc) · 16.6 KB
/
evm-version-compatibility-tests.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
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
name: EVM Node Version Compatibility Tests
on:
merge_group:
pull_request:
push:
tags:
- "*"
workflow_dispatch:
inputs:
base64_test_list:
description: Base64 encoded test list (same format as ./integration-tests/evm_node_compatibility_test_list.json)
required: false
type: string
env:
CHAINLINK_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink
INTERNAL_DOCKER_REPO: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com
MOD_CACHE_VERSION: 2
jobs:
# Check if go.mod has changed
check-dependency-bump:
runs-on: ubuntu-latest
outputs:
dependency_changed: ${{ steps.changes.outputs.dependency_changed }}
steps:
- name: Checkout code
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 0
- name: Check for go.mod changes
id: changes
run: |
git fetch origin ${{ github.base_ref }}
# if no match is found then grep exits with code 1, but if there is a match it exits with code 0
# this will return a match if there are any changes on that corresponding line, for example if spacing was changed
DEPENDENCY_CHANGED=$(git diff -U0 origin/${{ github.base_ref }}...HEAD -- go.mod | grep -q 'github.com/ethereum/go-ethereum'; echo $?)
PR_VERSION=$(grep 'github.com/ethereum/go-ethereum' go.mod | awk '{print $2}')
# here 0 means a match was found, 1 means no match was found
if [ "$DEPENDENCY_CHANGED" -eq 0 ]; then
# Dependency was changed in the PR, now compare with the base branch
git fetch origin ${{ github.base_ref }}
BASE_VERSION=$(git show origin/${{ github.base_ref }}:go.mod | grep 'github.com/ethereum/go-ethereum' | awk '{print $2}')
echo "Base branch version: $BASE_VERSION"
echo "PR branch version: $PR_VERSION"
echo "Dependency version changed in the PR compared to the base branch."
echo "dependency_changed=true" >> $GITHUB_OUTPUT
else
echo "No changes to ethereum/go-ethereum dependency in the PR."
echo "PR branch version: $PR_VERSION"
echo "dependency_changed=false" >> $GITHUB_OUTPUT
fi
# Check if images used as test dependencies exist in the ECR
check-ecr-images-exist:
if: needs.check-dependency-bump.outputs.dependency_changed == 'true' || github.event_name == 'workflow_dispatch'
needs: [check-dependency-bump]
environment: integration
permissions:
id-token: write
contents: read
name: Check images used as test dependencies exist in ECR
runs-on: ubuntu-latest
steps:
- name: Update internal ECR if the latest Ethereum client image does not exist
uses: smartcontractkit/chainlink-testing-framework/.github/actions/update-internal-mirrors@7eb04a030823b316d8dd5bb555f1e49593a503fc
with:
aws_region: ${{ secrets.QA_AWS_REGION }}
role_to_assume: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
aws_account_number: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
image_name: 'ethereum/client-go'
expression: '^(alltools-v|v)[0-9]\.[0-9]+\.[0-9]+$'
# Build Test Dependencies
build-chainlink:
if: needs.check-dependency-bump.outputs.dependency_changed == 'true' || github.event_name == 'workflow_dispatch'
needs: [check-dependency-bump, check-ecr-images-exist]
environment: integration
permissions:
id-token: write
contents: read
name: Build Chainlink Image
runs-on: ubuntu-latest
steps:
- name: Collect Metrics
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1
with:
id: evm-build-chainlink
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: Build Chainlink Image
continue-on-error: true
- name: Checkout the repo
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
- name: Build Chainlink Image
uses: ./.github/actions/build-chainlink-image
with:
tag_suffix: ""
dockerfile: core/chainlink.Dockerfile
git_commit_sha: ${{ github.sha }}
AWS_REGION: ${{ secrets.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
build-tests:
if: needs.check-dependency-bump.outputs.dependency_changed == 'true' || github.event_name == 'workflow_dispatch'
needs: [check-dependency-bump, check-ecr-images-exist]
environment: integration
permissions:
id-token: write
contents: read
name: Build Tests Binary
runs-on: ubuntu-latest
steps:
- name: Collect Metrics
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1
with:
id: evm-build-tests
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: Build Tests Binary
continue-on-error: true
- name: Checkout the repo
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
- name: Build Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19
with:
test_download_vendor_packages_command: cd ./integration-tests && go mod download
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: ./integration-tests/go.mod
go_tags: embed
cache_key_id: core-e2e-${{ env.MOD_CACHE_VERSION }}
cache_restore_only: "true"
binary_name: tests
build-test-matrix:
if: needs.check-dependency-bump.outputs.dependency_changed == 'true' || github.event_name == 'workflow_dispatch'
needs: [check-dependency-bump, check-ecr-images-exist]
runs-on: ubuntu-latest
name: Build Test Matrix
outputs:
matrix: ${{ env.JOB_MATRIX_JSON }}
steps:
- name: Checkout the repo
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Setup environment variables
run: |
echo "BASE64_TEST_LIST=${{ github.event.inputs.base64_test_list }}" >> $GITHUB_ENV
- name: Decode Base64 Test List Input if Set
id: decode-base64-test-list
if: env.BASE64_TEST_LIST != ''
run: |
echo "Decoding base64 test list..."
DECODED_BASE64_TEST_LIST=$(echo $BASE64_TEST_LIST | base64 -d)
echo $DECODED_BASE64_TEST_LIST
cd ./integration-tests
echo $DECODED_BASE64_TEST_LIST >> ./evm_node_compatibility_test_list.json
- name: Override Test List If Present
if: env.BASE64_TEST_LIST == ''
id: build-test-matrix-list
run: |
cd ./integration-tests
cp ./smoke/evm_node_compatibility_test_list.json .
- name: Create Test Matrix
id: create-test-matrix-list
run: |
cd ./integration-tests
JOB_MATRIX_JSON=$(./scripts/buildEvmClientTestMatrixList.sh ./evm_node_compatibility_test_list.json ubuntu-latest)
echo "JOB_MATRIX_JSON=${JOB_MATRIX_JSON}" >> $GITHUB_ENV
echo $JOB_MATRIX_JSON | jq .
# End Build Test Dependencies
evm-node-compatiblity-matrix:
environment: integration
permissions:
checks: write
pull-requests: write
id-token: write
contents: read
needs:
[check-dependency-bump, build-chainlink, build-tests, build-test-matrix]
env:
SELECTED_NETWORKS: SIMULATED
CHAINLINK_COMMIT_SHA: ${{ github.sha }}
CHAINLINK_ENV_USER: ${{ github.actor }}
TEST_LOG_LEVEL: debug
strategy:
fail-fast: false
matrix:
evm_node: ${{fromJson(needs.build-test-matrix.outputs.matrix)}}
runs-on: ${{ matrix.evm_node.os }}
name: EVM node compatibility of ${{ matrix.evm_node.product }} with ${{ matrix.evm_node.docker_image }}
steps:
- name: Collect Metrics
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d9da21a2747016b3e13de58c7d4115a3d5c97935 # v3.0.1
with:
id: evm-e2e-compatability-tests-${{ matrix.evm_node.name }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
this-job-name: EVM node compatibility ${{ matrix.evm_node.name }} ${{ matrix.evm_node.docker_image }}
test-results-file: '{"testType":"go","filePath":"/tmp/gotest.log"}'
continue-on-error: true
- name: Checkout the repo
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
- name: Build Go Test Command
id: build-go-test-command
run: |
# if the matrix.evm_node.run is set, use it for a different command
if [ "${{ matrix.evm_node.run }}" != "" ]; then
echo "run_command=${{ matrix.evm_node.run }} ./smoke/${{ matrix.evm_node.product }}_test.go" >> "$GITHUB_OUTPUT"
else
echo "run_command=./smoke/${{ matrix.evm_node.product }}_test.go" >> "$GITHUB_OUTPUT"
fi
- name: Setup GAP for Grafana
uses: smartcontractkit/.github/actions/setup-gap@6c9d62fdad050cfb8b59376ded291f1350705944 # [email protected]
with:
# aws inputs
aws-region: ${{ secrets.AWS_REGION }}
aws-role-arn: ${{ secrets.AWS_OIDC_IAM_ROLE_VALIDATION_PROD_ARN }}
api-gateway-host: ${{ secrets.AWS_API_GW_HOST_GRAFANA }}
# other inputs
duplicate-authorization-header: "true"
- name: Prepare Base64 TOML override
uses: ./.github/actions/setup-create-base64-config
with:
runId: ${{ github.run_id }}
testLogCollect: ${{ vars.TEST_LOG_COLLECT }}
selectedNetworks: ${{ env.SELECTED_NETWORKS }}
chainlinkImage: ${{ env.CHAINLINK_IMAGE }}
chainlinkVersion: ${{ github.sha }}
lokiEndpoint: ${{ secrets.LOKI_URL }}
lokiTenantId: ${{ vars.LOKI_TENANT_ID }}
lokiBasicAuth: ${{ secrets.LOKI_BASIC_AUTH }}
logstreamLogTargets: ${{ vars.LOGSTREAM_LOG_TARGETS }}
grafanaUrl: "http://localhost:8080/primary"
grafanaDashboardUrl: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs"
grafanaBearerToken: ${{ secrets.GRAFANA_INTERNAL_URL_SHORTENER_TOKEN }}
ethExecutionClient: ${{ matrix.evm_node.eth_client }}
customEthClientDockerImage: ${{ matrix.evm_node.docker_image }}
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@af92c5fae8dcf1659201e907db82d221fc304b94 # v2.3.21
with:
test_command_to_run: cd ./integration-tests && go test -timeout 45m -count=1 -json -test.parallel=2 ${{ steps.build-go-test-command.outputs.run_command }} 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs
test_download_vendor_packages_command: cd ./integration-tests && go mod download
cl_repo: ${{ env.CHAINLINK_IMAGE }}
cl_image_tag: ${{ github.sha }}
aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
artifacts_location: ./integration-tests/smoke/logs/
publish_check_name: ${{ matrix.evm_node.product }}-compatibility-${{ matrix.evm_node.eth_client }}-${{ matrix.evm_node.docker_image }}
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: ./integration-tests/go.mod
cache_key_id: core-e2e-${{ env.MOD_CACHE_VERSION }}
cache_restore_only: "true"
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ""
should_tidy: "false"
- name: Print failed test summary
if: always()
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/show-test-summary@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19
start-slack-thread:
name: Start Slack Thread
if: ${{ always() && needs.check-dependency-bump.outputs.dependency_changed == 'true' && needs.*.result != 'skipped' && needs.*.result != 'cancelled' }}
environment: integration
outputs:
thread_ts: ${{ steps.slack.outputs.thread_ts }}
permissions:
checks: write
pull-requests: write
id-token: write
contents: read
runs-on: ubuntu-latest
needs: [ evm-node-compatiblity-matrix]
steps:
- name: Debug Result
run: echo ${{ join(needs.*.result, ',') }}
- name: Main Slack Notification
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
id: slack
with:
channel-id: ${{ secrets.QA_SLACK_CHANNEL }}
payload: |
{
"attachments": [
{
"color": "${{ contains(join(needs.*.result, ','), 'failure') && '#C62828' || '#2E7D32' }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "EVM Node Compatability Test Results ${{ contains(join(needs.*.result, ','), 'failure') && ':x:' || ':white_check_mark:'}}",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ contains(join(needs.*.result, ','), 'failure') && 'Some tests failed, notifying <@U060CGGPY8H>' || 'All Good!' }}"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}> | <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Run>"
}
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
post-test-results-to-slack:
name: Post Test Results for ${{matrix.evm_node.eth_client}} to Slack
if: ${{ always() && needs.check-dependency-bump.outputs.dependency_changed == 'true' && needs.*.result != 'skipped' && needs.*.result != 'cancelled' }}
environment: integration
permissions:
checks: write
pull-requests: write
id-token: write
contents: read
runs-on: ubuntu-latest
needs: [start-slack-thread, build-test-matrix]
strategy:
fail-fast: false
matrix:
# this basically works as group by in SQL; we should update it when we update the test list JSON file
product: [automation,ocr,ocr2,vrf,vrfv2,vrfv2plus]
steps:
- name: Checkout the repo
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
- name: Post Test Results to Slack
uses: ./.github/actions/notify-slack-jobs-result
with:
github_token: ${{ github.token }}
github_repository: ${{ github.repository }}
workflow_run_id: ${{ github.run_id }}
github_job_name_regex: ^EVM node compatibility of ${{ matrix.product }} with (?<cap>.*?)$
message_title: ${{ matrix.product }}
slack_channel_id: ${{ secrets.QA_SLACK_CHANNEL }}
slack_bot_token: ${{ secrets.QA_SLACK_API_KEY }}
slack_thread_ts: ${{ needs.start-slack-thread.outputs.thread_ts }}