-
Notifications
You must be signed in to change notification settings - Fork 2k
630 lines (571 loc) · 25.5 KB
/
ci-core.yml
File metadata and controls
630 lines (571 loc) · 25.5 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
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
name: CI Core
run-name: CI Core ${{ inputs.distinct_run_name && inputs.distinct_run_name || '' }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
# Run on key branches to make sure integration is good, otherwise run on all PR's
on:
push:
branches:
- develop
- "release/*"
merge_group:
pull_request:
schedule:
- cron: "0 0,6,12,18 * * *"
workflow_dispatch:
jobs:
filter:
name: Detect Changes
permissions:
pull-requests: read
outputs:
affected-modules: ${{ steps.changed-modules.outputs.modules-json }}
# Runs on workflow changes, any deployment change, or any (non-ignored) core change
should-run-deployment-tests: >-
${{
steps.match-some.outputs.workflow == 'true' ||
steps.match-some.outputs.deployment == 'true' ||
steps.match-every.outputs.core-non-ignored == 'true' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
}}
# Runs on workflow changes, and any (non-ignored) core changes
should-run-core-tests: >-
${{
steps.match-some.outputs.workflow == 'true' ||
steps.match-every.outputs.core-non-ignored == 'true' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
}}
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v6
with:
persist-credentials: false
repository: smartcontractkit/chainlink
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: match-some
with:
# "if any changed file matches one or more of the conditions" (https://github.com/dorny/paths-filter/issues/225)
predicate-quantifier: some
# deployment - any changes in the deployment module
# workflow - any changes that could affect this workflow definition
# - Assume any repository action changes affect this workflow
filters: |
deployment:
- 'deployment/**'
workflow:
- '.github/workflows/ci-core.yml'
- '.github/actions/**'
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: match-every
with:
# "if any changed file match all of the conditions" (https://github.com/dorny/paths-filter/issues/225)
# - Enables listing of files matching each filter.
# - Paths to files will be available in `${FILTER_NAME}_files` output variable.
# - Paths will be formatted as JSON array
predicate-quantifier: every
# core-non-ignored - all changes except for paths which do not affect core module
# - This is opt-in on purpose. To be safe, new files are assumed to have an affect on core unless listed here specifically.
# - For example: core module does not depend on deployment or integration-tests module.
# all - changes in any directory
# - This is used resolve all affected modules based on changed files
list-files: json
filters: |
core-non-ignored:
- '**'
- '!deployment/**'
- '!integration-tests/**'
- '!tools/secrets/**'
- '!tools/docker/**'
- '!tools/benchmark/**'
- '!**/README.md'
- '!**/CHANGELOG.md'
- '!*.nix'
- '!sonar-project.properties'
- '!nix.conf'
- '!nix-darwin-shell-hook.sh'
- '!LICENSE'
- '!.github/**'
- '!core/scripts/cre/environment/examples/workflows/**'
all:
- '**'
- name: Changed modules
id: changed-modules
uses: smartcontractkit/.github/actions/changed-modules-go@changed-modules-go/v1
with:
# when scheduled/workflow_dispatch, run against all modules
no-change-behaviour: all
file-patterns: |
**/*.go
**/go.mod
**/go.sum
module-patterns: |
**
!core/scripts/cre/environment/examples/workflows/**
golangci:
name: GolangCI Lint
needs: [filter, run-frequency]
# We don't directly merge dependabot PRs to not waste the resources.
if: ${{ needs.filter.outputs.affected-modules != '[]' && github.event_name != 'merge_group' && github.actor != 'dependabot[bot]' }}
permissions:
# To annotate code in the PR.
checks: write
contents: read
# For golangci-lint-action's `only-new-issues` option.
pull-requests: read
runs-on: runs-on=${{ github.run_id }}-${{ strategy.job-index }}/cpu=16/ram=32/family=c6gd/spot=false/image=ubuntu24-full-arm64/extras=s3-cache
strategy:
fail-fast: false
matrix:
modules: ${{ fromJson(needs.filter.outputs.affected-modules) }}
steps:
- name: Enable S3 Cache for Self-Hosted Runners
uses: runs-on/action@742bf56072eb4845a0f94b3394673e4903c90ff0 # v2.1.0
with:
metrics: cpu,network,memory,disk
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Golang Lint (${{ matrix.modules }})
id: golang-lint
uses: ./.github/actions/golangci-lint
timeout-minutes: 20
with:
go-directory: ${{ matrix.modules }}
- name: Notify Slack
# Skip for now as it's always failing on scheduled runs
if: false
# if: ${{ failure() && needs.run-frequency.outputs.one-per-day-frequency == 'true' }}
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.QA_SLACK_API_KEY }}
payload: |
channel: ${{ secrets.SLACK_TEAM_CORE_CHANNEL_ID}}
text: "golangci-lint failed (${{ matrix.modules }}): <${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}|Run> - <${{ steps.golang-lint.outputs.golang-report-artifact-url }}|Report>"
# Fails if any golangci-lint matrix jobs fails and silently succeeds otherwise
# Consolidates golangci-lint matrix job results under one required `lint` check
# Inclusive check: all (new) modules are analyzed, but no need to enable "required" checks for each one
golangci-matrix-results-validation:
name: lint
if: ${{ always() }}
needs: [filter, golangci]
runs-on: ubuntu-latest
steps:
- name: Check Golangci-lint Matrix Results
env:
GOLANGCI_RESULT: ${{ needs.golangci.result }}
ALLOW_FAILURE: ${{ contains(join(github.event.pull_request.labels.*.name, ' '), 'allow-lint-issues') }}
SKIPPED: ${{ needs.filter.outputs.affected-modules == '[]' }}
run: |
if [[ "${GOLANGCI_RESULT}" == "success" ]]; then
echo "All 'GolangCI Lint' matrix jobs succeeded."
exit 0
fi
if [[ "${GOLANGCI_RESULT}" == "skipped" || "${SKIPPED}" == "true" ]]; then
echo "'GolangCI Lint' jobs were skipped."
exit 0
fi
if [[ "${ALLOW_FAILURE}" == "true" ]]; then
echo "Some 'GolangCI Lint' matrix jobs failed, but failures are allowed due to 'allow-lint-issues' label."
exit 0
fi
if [[ "${GOLANGCI_RESULT}" == "cancelled" ]]; then
echo "'GolangCI Lint' jobs were cancelled."
exit 1
fi
if [[ "${GOLANGCI_RESULT}" == "failure" ]]; then
echo "'GolangCI Lint' matrix jobs had failures."
exit 1
fi
core:
env:
# We explicitly have this env var not be "CL_DATABASE_URL" to avoid having it be used by core related tests
# when they should not be using it, while still allowing us to DRY up the setup
DB_URL: postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable
strategy:
fail-fast: false
matrix:
type:
- cmd: go_core_tests
os: runs-on=${{ github.run_id }}-unit/cpu=48/ram=96/family=c6id+c5ad/spot=false/image=ubuntu24-full-x64/extras=s3-cache
should-run: ${{ needs.filter.outputs.should-run-core-tests }}
trunk-auto-quarantine: "true"
- cmd: go_core_tests_integration
os: runs-on=${{ github.run_id }}-integ/cpu=48/ram=96/family=c6i/spot=false/image=ubuntu24-full-x64/extras=s3-cache+tmpfs
should-run: ${{ needs.filter.outputs.should-run-core-tests }}
trunk-auto-quarantine: "true"
setup-solana: "true"
install-loopps: "true"
- cmd: go_core_fuzz
os: runs-on=${{ github.run_id}}-fuzz/cpu=8/ram=32/family=m6id+m6idn/spot=false/image=ubuntu24-full-x64/extras=s3-cache
should-run: ${{ needs.filter.outputs.should-run-core-tests }}
- cmd: go_core_race_tests
os: runs-on=${{ github.run_id}}-race/cpu=64/ram=128/family=c7i/volume=80gb/spot=false/image=ubuntu24-full-x64/extras=s3-cache
should-run: ${{ needs.filter.outputs.should-run-core-tests }}
- cmd: go_core_ccip_deployment_tests
os: runs-on=${{ github.run_id }}-deployment/cpu=48/ram=96/family=c6id+c5ad/spot=false/image=ubuntu24-full-x64/extras=s3-cache
should-run: ${{ needs.filter.outputs.should-run-deployment-tests }}
trunk-auto-quarantine: "true"
go-mod-directory: "deployment/"
setup-solana: "true"
setup-aptos: "true"
install-loopps: "true"
setup-sui: "true"
name: Core Tests (${{ matrix.type.cmd }}) # Be careful modifying the job name, as it is used to fetch the job URL
# We don't directly merge dependabot PRs, so let's not waste the resources
if: ${{ github.actor != 'dependabot[bot]' }}
needs: [filter, run-frequency]
timeout-minutes: 60
# Use ubuntu-latest for jobs that will be skipped
runs-on: ${{ matrix.type.should-run == 'true' && matrix.type.os || 'ubuntu-latest' }}
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Enable S3 Cache for Self-Hosted Runners
uses: runs-on/action@742bf56072eb4845a0f94b3394673e4903c90ff0 # v2.1.0
with:
metrics: cpu,network,memory,disk
- name: Checkout the repo
if: ${{ matrix.type.should-run == 'true' }}
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Go
if: ${{ matrix.type.should-run == 'true' }}
uses: ./.github/actions/setup-go
with:
# race/fuzz tests don't benefit repeated caching, so restore from develop's build cache
restore-build-cache-only: ${{ matrix.type.cmd == 'go_core_fuzz' || matrix.type.cmd == 'go_core_race_tests' }}
build-cache-version: ${{ matrix.type.cmd }}
go-version-file: ${{ matrix.type.go-mod-directory }}go.mod
go-module-file: ${{ matrix.type.go-mod-directory }}go.sum
- name: Setup Solana
if: ${{ matrix.type.should-run == 'true' && matrix.type.setup-solana == 'true' }}
uses: ./.github/actions/setup-solana
- name: Setup Aptos
if: ${{ matrix.type.should-run == 'true' && matrix.type.setup-aptos == 'true' }}
uses: aptos-labs/actions/install-aptos-cli@63740b290d839b87ecfafbcf75ed03a36a54a29f # jan 15, 2025
with:
CLI_VERSION: 8.1.0
- name: Setup Sui CLI v1.69.2
if: ${{ matrix.type.should-run == 'true' && matrix.type.setup-sui == 'true' }}
uses: ./.github/actions/setup-sui
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: mainnet-v1.69.2
- name: Setup wasmd
if: ${{ matrix.type.should-run == 'true' }}
uses: ./.github/actions/setup-wasmd
- name: Setup Postgres
if: ${{ matrix.type.should-run == 'true' }}
uses: smartcontractkit/.github/actions/setup-postgres@setup-postgres/v1
with:
tmpfs: "true"
image-tag: "16-alpine"
- name: Touching core/web/assets/index.html
if: ${{ matrix.type.should-run == 'true' }}
run: mkdir -p core/web/assets && touch core/web/assets/index.html
- name: Download Go vendor packages
if: ${{ matrix.type.should-run == 'true' }}
run: go mod download
- name: Setup DB
if: ${{ matrix.type.should-run == 'true' }}
run: go run ./core/store/cmd/preparetest
env:
CL_DATABASE_URL: ${{ env.DB_URL }}
- name: Install LOOP Plugins
if: ${{ matrix.type.should-run == 'true' && matrix.type.install-loopps == 'true' }}
run: make install-plugins
- name: Increase Timeouts for Fuzz/Race
# Increase timeouts for scheduled runs only
if: ${{ github.event.schedule != '' && matrix.type.should-run == 'true' }}
run: |
echo "TIMEOUT=10m" >> $GITHUB_ENV
echo "COUNT=50" >> $GITHUB_ENV
echo "FUZZ_TIMEOUT_MINUTES=10">> $GITHUB_ENV
- name: Run tests
if: ${{ matrix.type.should-run == 'true' }}
timeout-minutes: 50
continue-on-error: ${{ matrix.type.trunk-auto-quarantine == 'true' }}
id: run-tests
shell: bash
env:
CL_DATABASE_URL: ${{ env.DB_URL }}
OUTPUT_FILE: ./output.txt
PRODUCE_JUNIT_XML: ${{ matrix.type.trunk-auto-quarantine }}
TRUNK_AUTO_QUARANTINE: ${{ matrix.type.trunk-auto-quarantine }}
RUN_QUARANTINED_TESTS: "true" # always run quarantined tests in CI
JUNIT_FILE: ${{ github.workspace }}/junit.xml
run: |
GODEBUG=goindex=0 ./tools/bin/${{ matrix.type.cmd }} ./...
# See: https://github.com/golang/go/issues/69179
- name: Analyze and upload test results
if: ${{ matrix.type.should-run == 'true' && matrix.type.trunk-auto-quarantine == 'true' && !cancelled() }}
uses: smartcontractkit/.github/actions/branch-out-upload@branch-out-upload/v1
with:
junit-file-path: "./junit.xml"
trunk-org-slug: chainlink
trunk-token: ${{ secrets.TRUNK_API_KEY }}
trunk-previous-step-outcome: ${{ steps.run-tests.outcome }}
# when auto-quarantine is enabled, allow this to determine test failures
trunk-upload-only: ${{ matrix.type.trunk-auto-quarantine != 'true' }}
# unique name per matrix job to avoid 409 conflict when multiple jobs upload in the same workflow run
artifact-name: ${{ matrix.type.cmd }}_test_logs
- name: Print Races
id: print-races
if: ${{ failure() && matrix.type.cmd == 'go_core_race_tests' && matrix.type.should-run == 'true' }}
env:
GH_REPO: ${{ github.repository }}
GH_RUN_ID: ${{ github.run_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
find race.* | xargs cat >> races.txt
if [[ -s races.txt ]]; then
cat races.txt
echo "post_to_slack=true" | tee -a "$GITHUB_OUTPUT"
else
echo "post_to_slack=false" | tee -a "$GITHUB_OUTPUT"
fi
echo "github.event_name: ${{ github.event_name }}"
echo "github.ref: ${{ github.ref }}"
- name: Print postgres logs
if: ${{ always() && matrix.type.should-run == 'true' }}
uses: smartcontractkit/.github/actions/setup-postgres@setup-postgres/v1
with:
print-logs: "true"
- name: Store logs artifacts
if: ${{ always() && matrix.type.should-run == 'true' }}
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.type.cmd }}_logs
path: |
./output.txt
./output-short.txt
./race.*
./coverage.txt
./postgres_logs.txt
./junit.xml
./deployment/junit.xml
retention-days: 7
- name: Notify Slack on Race Test Failure
if: |
failure() &&
matrix.type.cmd == 'go_core_race_tests' &&
steps.print-races.outputs.post_to_slack == 'true' &&
(github.event_name == 'merge_group' || github.ref == 'refs/heads/develop') &&
matrix.type.should-run == 'true'
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.QA_SLACK_API_KEY }}
payload: |
channel: ${{ secrets.SLACK_TOPIC_DATA_RACES_CHANNEL_ID}}
text: "Race Tests Failed: <${{ format('https://github.com/{0}/actions/runs/{1}/job/{2}', github.repository, github.run_id, job.check_run_id) }}|Run>"
core-scripts-tests:
name: test-scripts
needs: [filter]
runs-on: ubuntu-latest
if: ${{ needs.filter.outputs.should-run-core-tests == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: ./.github/actions/setup-go
with:
go-version-file: core/scripts/go.mod
go-module-file: core/scripts/go.sum
- name: Run Tests
env:
OUTPUT_FILE: ./output.txt
run: ./tools/bin/go_core_scripts_tests ./...
- name: Store test report artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: go_core_scripts_tests_logs
path: |
./output.txt
./coverage.txt
retention-days: 7
scan:
name: SonarQube Scan
needs: [golangci, core, core-scripts-tests]
# If core is cancelled, skip this to not delay the cancellation of the workflow.
if: ${{ always() && !cancelled() && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0 # fetches all history for all tags and branches to provide more metadata for sonar reports
- name: Download all workflow artifacts
uses: actions/download-artifact@v4
- name: Check and Set SonarQube Report Paths
shell: bash
run: |
# Check and assign paths for coverage/test reports in go_core_tests_logs
core_artifact="go_core_tests_logs"
if [ -d "$core_artifact" ]; then
echo "Found $core_artifact"
sonarqube_coverage_report_paths=$(find "$core_artifact" -name coverage.txt | paste -sd "," -)
sonarqube_tests_report_paths=$(find "$core_artifact" -name output.txt | paste -sd "," -)
echo "Coverage report paths: $sonarqube_coverage_report_paths"
echo "Tests report paths: $sonarqube_tests_report_paths"
else
echo "Did not find $core_artifact"
sonarqube_coverage_report_paths=""
sonarqube_tests_report_paths=""
fi
# Check and assign paths for coverage/test reports in go_core_tests_integration_logs
integration_tests_artifact="go_core_tests_integration_logs"
if [ -d "$integration_tests_artifact" ]; then
echo "Found $integration_tests_artifact"
integration_coverage_paths=$(find "$integration_tests_artifact" -name coverage.txt | paste -sd "," -)
integration_tests_paths=$(find "$integration_tests_artifact" -name output.txt | paste -sd "," -)
# Append to existing paths if they are set, otherwise assign directly
sonarqube_coverage_report_paths="${sonarqube_coverage_report_paths:+$sonarqube_coverage_report_paths,}$integration_coverage_paths"
sonarqube_tests_report_paths="${sonarqube_tests_report_paths:+$sonarqube_tests_report_paths,}$integration_tests_paths"
fi
# Check and assign paths for coverage/test reports in go_core_scripts_tests_logs
scripts_tests_artifact="go_core_scripts_tests_logs"
if [ -d "$scripts_tests_artifact" ]; then
echo "Found $scripts_tests_artifact"
scripts_coverage_paths=$(find "$scripts_tests_artifact" -name coverage.txt | paste -sd "," -)
scripts_tests_paths=$(find "$scripts_tests_artifact" -name output.txt | paste -sd "," -)
# Append to existing paths if they are set, otherwise assign directly
sonarqube_coverage_report_paths="${sonarqube_coverage_report_paths:+$sonarqube_coverage_report_paths,}$scripts_coverage_paths"
sonarqube_tests_report_paths="${sonarqube_tests_report_paths:+$sonarqube_tests_report_paths,}$scripts_tests_paths"
fi
# Check and assign paths for lint reports
# To find reports in the folders named differently (because of the matrix strategy),
# We need to loop through the artifacts. It allows usage of RegExp folders (skipped if not found).
for golang_lint_artifact in golangci-lint-report*
do
echo "Found golangci-lint-report artifacts"
sonarqube_lint_report_paths=$(find -type f -name 'golangci-lint-report.xml' -printf "%p,")
echo "Lint report paths: $sonarqube_lint_report_paths"
break
done
ARGS=""
if [[ -z "$sonarqube_tests_report_paths" ]]; then
echo "::warning::No test report paths found, will not pass to sonarqube"
else
echo "Found test report paths: $sonarqube_tests_report_paths"
ARGS="$ARGS -Dsonar.go.tests.reportPaths=$sonarqube_tests_report_paths"
fi
if [[ -z "$sonarqube_coverage_report_paths" ]]; then
echo "::warning::No coverage report paths found, will not pass to sonarqube"
else
echo "Found coverage report paths: $sonarqube_coverage_report_paths"
ARGS="$ARGS -Dsonar.go.coverage.reportPaths=$sonarqube_coverage_report_paths"
fi
if [[ -z "$sonarqube_lint_report_paths" ]]; then
echo "::warning::No lint report paths found, will not pass to sonarqube"
else
echo "Found lint report paths: $sonarqube_lint_report_paths"
ARGS="$ARGS -Dsonar.go.golangci-lint.reportPaths=$sonarqube_lint_report_paths"
fi
echo "Final SONARQUBE_ARGS: $ARGS"
echo "SONARQUBE_ARGS=$ARGS" >> $GITHUB_ENV
- name: SonarQube Scan
if: ${{ env.SONARQUBE_ARGS != '' }}
uses: sonarsource/sonarqube-scan-action@aecaf43ae57e412bd97d70ef9ce6076e672fe0a9 # v2.3.0
with:
args: ${{ env.SONARQUBE_ARGS }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_SCANNER_OPTS: "-Xms6g -Xmx8g"
clean:
name: Clean Go Tidy & Generate
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu22.04-8cores-32GB
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Go
uses: ./.github/actions/setup-go
with:
only-modules: "true"
- name: Install protoc-gen-go-wsrpc
run: curl https://github.com/smartcontractkit/wsrpc/raw/main/cmd/protoc-gen-go-wsrpc/protoc-gen-go-wsrpc --output $HOME/go/bin/protoc-gen-go-wsrpc && chmod +x $HOME/go/bin/protoc-gen-go-wsrpc
- name: make generate
run: |
make rm-mocked
make generate
- name: Ensure clean after generate
run: |
git add --all
if ! git diff --cached --quiet; then
echo "::error::Tree is dirty after 'make generate'. Full diff below:"
git diff --cached
exit 1
fi
- run: make gomodtidy
- name: Ensure clean after tidy
run: |
git add --all
if ! git diff --cached --quiet; then
echo "::error::Tree is dirty after 'make gomodtidy'. Full diff below:"
git diff --cached
exit 1
fi
run-frequency:
name: Run frequency
outputs:
one-per-day-frequency: ${{ steps.check-time.outputs.one-per-day-frequency || 'false' }}
runs-on: ubuntu-latest
steps:
- name: Check time and set frequencies
id: check-time
shell: bash
run: |
if [ "$GITHUB_EVENT_NAME" != "schedule" ]; then
# Not a scheduled event - no frequencies to set. They default to false.
exit 0
fi
# Scheduled event, check current time for frequencies
current_hour=$(date +"%H")
# Check if the current hour is 00 (one per day)
if [ "$current_hour" -eq "00" ]; then
echo "one-per-day-frequency=true" | tee -a $GITHUB_OUTPUT
fi
misc:
# Catchall job for miscellaneous steps.
name: Misc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup go
uses: ./.github/actions/setup-go
##
# Plugins (LOOPPs) are defined in ./plugins/plugins.*.yaml files.
# Some plugins such as chainlink-data-streams, chainlink-feeds,
# and chainlink-solana are also dependencies in the go.mod file.
# This job is to ensure that the versions defined in the go.mod file are
# in sync with the gitRef field in the plugins YAML files.
#
# If you update the version of a module in the go.mod file, you must
# update the gitRef for the corresponding module in the plugins YAML file
# to match.
##
- name: Plugins Sync Check (Plugout)
run: |
echo "Check for out of sync plugins"
go run ./tools/plugout/ \
--go-mod ./go.mod \
--plugin-file ./plugins/plugins.public.yaml