Update contracts.json #1211
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: CI Core | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
# Run on key branches to make sure integration is good, otherwise run on all PR's | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- 'release/*' | |
- staging | |
- trying | |
- rollup | |
merge_group: | |
pull_request: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
golangci-changes: | |
name: detect changes for lint | |
runs-on: ubuntu-latest | |
outputs: | |
src: ${{ steps.golangci-changes.outputs.src }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 | |
id: golangci-changes | |
with: | |
filters: | | |
src: | |
- '**/*.go' | |
- '**/go.mod' | |
- '**/go.sum' | |
- '.golangci.yml' | |
- '.github/workflows/ci-core.yml' | |
init: | |
name: initialize | |
runs-on: ubuntu-latest | |
needs: [golangci-changes] | |
defaults: | |
run: | |
shell: bash | |
outputs: | |
# Determine if `on` event should trigger linting to run | |
on_trigger_lint: ${{ steps.golangci-lint.outputs.on_trigger }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Check if event should trigger lint | |
id: golangci-lint | |
env: | |
GITHUB_EVENT_NAME: ${{ github.event_name }} | |
GITHUB_BASE_REF: ${{ github.base_ref }} | |
GITHUB_REF: ${{ github.ref }} | |
SRC_CHANGED: ${{ needs.golangci-changes.outputs.src }} | |
run: ./.github/scripts/bash/ontriggerlint.sh | tee -a $GITHUB_OUTPUT | |
golangci: | |
name: lint | |
runs-on: ubuntu-latest | |
needs: [init] | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v4 | |
if: needs.init.outputs.on_trigger_lint == 'true' | |
with: | |
go-version-file: 'go.mod' | |
# If cache is set to true (default), the "prepare environment" will | |
# silently fail with these errors: | |
# Error: /usr/bin/tar: <...>: Cannot open: File exists | |
cache: false | |
- name: golangci-lint | |
if: needs.init.outputs.on_trigger_lint == 'true' | |
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0 | |
with: | |
version: v1.53.3 | |
only-new-issues: ${{ github.event.schedule == '' }} # show only new issues, unless it's a scheduled run | |
args: --out-format checkstyle:golangci-lint-report.xml | |
- name: Print lint report artifact | |
if: always() | |
run: test -f golangci-lint-report.xml && cat golangci-lint-report.xml || true | |
- name: Store lint report artifact | |
if: always() | |
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 | |
with: | |
name: golangci-lint-report | |
path: golangci-lint-report.xml | |
- name: Collect Metrics | |
if: always() | |
id: collect-gha-metrics | |
uses: smartcontractkit/push-gha-metrics-action@d2c2b7bdc9012651230b2608a1bcb0c48538b6ec | |
with: | |
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} | |
this-job-name: lint | |
continue-on-error: true | |
split-packages: | |
name: Split Go Tests | |
runs-on: ubuntu-latest | |
outputs: | |
splits: ${{ steps.split.outputs.splits }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go | |
with: | |
only-modules: "true" | |
- name: Touching core/web/assets/index.html | |
run: mkdir -p core/web/assets && touch core/web/assets/index.html | |
- name: Generate splits | |
id: split | |
uses: ./.github/actions/split-tests | |
with: | |
config: ./ci.json | |
- name: Collect Metrics | |
if: always() | |
id: collect-gha-metrics | |
uses: smartcontractkit/push-gha-metrics-action@d2c2b7bdc9012651230b2608a1bcb0c48538b6ec | |
with: | |
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} | |
this-job-name: Split Go Tests | |
continue-on-error: true | |
core: | |
needs: [split-packages] | |
strategy: | |
fail-fast: false | |
matrix: | |
cmd: ["go_core_tests", "go_core_race_tests"] | |
split: ${{ fromJson(needs.split-packages.outputs.splits) }} | |
name: Core Tests (${{ matrix.cmd }}) ${{ matrix.split.id }} | |
runs-on: ubuntu-latest | |
env: | |
CL_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
- name: Setup NodeJS | |
uses: ./.github/actions/setup-nodejs | |
with: | |
prod: "true" | |
- name: Setup Go | |
uses: ./.github/actions/setup-go | |
- name: Setup Solana | |
uses: ./.github/actions/setup-solana | |
- name: Setup wasmd | |
uses: ./.github/actions/setup-wasmd | |
- name: Setup Postgres | |
uses: ./.github/actions/setup-postgres | |
- name: Touching core/web/assets/index.html | |
run: mkdir -p core/web/assets && touch core/web/assets/index.html | |
- name: Download Go vendor packages | |
run: go mod download | |
- name: Build binary | |
run: go build -tags test -o chainlink.test . | |
- name: Setup DB | |
run: ./chainlink.test local db preparetest | |
- name: Increase Race Timeout | |
if: github.event.schedule != '' | |
run: | | |
echo "TIMEOUT=10m" >> $GITHUB_ENV | |
echo "COUNT=50" >> $GITHUB_ENV | |
- name: Run tests | |
id: run-tests | |
env: | |
OUTPUT_FILE: ./output.txt | |
USE_TEE: false | |
run: ./tools/bin/${{ matrix.cmd }} "${{ matrix.split.pkgs }}" | |
- name: Print Filtered Test Results | |
if: failure() | |
uses: smartcontractkit/chainlink-github-actions/go/go-test-results-parsing@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 | |
with: | |
results-file: ./output.txt | |
output-file: ./output-short.txt | |
- name: Store logs artifacts | |
if: always() | |
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 | |
with: | |
name: ${{ matrix.cmd }}_${{ matrix.split.idx }}_logs | |
path: | | |
./output.txt | |
./output-short.txt | |
./race.* | |
./coverage.txt | |
- name: Print postgres logs | |
if: always() | |
run: docker compose logs postgres | |
working-directory: ./.github/actions/setup-postgres | |
- name: Collect Metrics | |
if: always() | |
id: collect-gha-metrics | |
uses: smartcontractkit/push-gha-metrics-action@d2c2b7bdc9012651230b2608a1bcb0c48538b6ec | |
with: | |
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} | |
this-job-name: Core Tests (${{ matrix.cmd }}) ${{ matrix.split.id }} | |
test-results-file: '{"testType":"go","filePath":"./output.txt"}' | |
continue-on-error: true | |
# Satisfy required check for core tests | |
# while still allowing for adjustable splitting | |
core-complete: | |
needs: [core] | |
name: Core Tests (${{ matrix.cmd }}) | |
runs-on: ubuntu-latest | |
if: always() | |
strategy: | |
fail-fast: false | |
matrix: | |
cmd: ["go_core_tests", "go_core_race_tests"] | |
steps: | |
- run: echo "${{ matrix.cmd }} have finished" | |
- name: Check test results | |
if: needs.core.result != 'success' | |
run: exit 1 | |
- name: Notify Slack | |
if: ${{ failure() && matrix.cmd == 'go_core_race_tests' && github.event.schedule != '' }} | |
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0 | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} | |
with: | |
channel-id: '#topic-data-races' | |
slack-message: "Race tests failed: ${{ job.html_url }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url || format('https://github.com/smartcontractkit/chainlink/commit/{0}', github.sha) }}" | |
- name: Collect Metrics | |
if: always() | |
id: collect-gha-metrics | |
uses: smartcontractkit/push-gha-metrics-action@d2c2b7bdc9012651230b2608a1bcb0c48538b6ec | |
with: | |
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} | |
this-job-name: Core Tests (${{ matrix.cmd }}) | |
continue-on-error: true | |
detect-flakey-tests: | |
needs: [core] | |
name: Flakey Test Detection | |
runs-on: ubuntu-latest | |
if: always() | |
env: | |
CL_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
- name: Setup NodeJS | |
uses: ./.github/actions/setup-nodejs | |
with: | |
prod: "true" | |
- name: Setup Go | |
uses: ./.github/actions/setup-go | |
- name: Setup Postgres | |
uses: ./.github/actions/setup-postgres | |
- name: Touching core/web/assets/index.html | |
run: mkdir -p core/web/assets && touch core/web/assets/index.html | |
- name: Download Go vendor packages | |
run: go mod download | |
- name: Build binary | |
run: go build -tags test -o chainlink.test . | |
- name: Setup DB | |
run: ./chainlink.test local db preparetest | |
- name: Load test outputs | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./artifacts | |
- name: Build flakey test runner | |
run: go build ./tools/flakeytests/cmd/runner | |
- name: Re-run tests | |
env: | |
GRAFANA_CLOUD_BASIC_AUTH: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | |
GRAFANA_CLOUD_HOST: ${{ secrets.GRAFANA_CLOUD_HOST }} | |
GITHUB_EVENT_PATH: ${{ github.event_path }} | |
run: | | |
./runner \ | |
-grafana_auth=$GRAFANA_CLOUD_BASIC_AUTH \ | |
-grafana_host=$GRAFANA_CLOUD_HOST \ | |
-gh_sha=$GITHUB_SHA \ | |
-gh_event_path=$GITHUB_EVENT_PATH \ | |
-command=./tools/bin/go_core_tests \ | |
`ls -R ./artifacts/go_core_tests*/output-short.txt` | |
- name: Store logs artifacts | |
if: always() | |
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 | |
with: | |
name: flakey_test_runner_logs | |
path: | | |
./output.txt | |
scan: | |
name: SonarQube Scan | |
needs: [core] | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 # fetches all history for all tags and branches to provide more metadata for sonar reports | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 | |
- name: Set SonarQube Report Paths | |
id: sonarqube_report_paths | |
shell: bash | |
run: | | |
echo "sonarqube_tests_report_paths=$(find go_core_tests_*_logs -name output.txt | paste -sd "," -)" >> $GITHUB_OUTPUT | |
echo "sonarqube_coverage_report_paths=$(find go_core_tests_*_logs -name coverage.txt | paste -sd "," -)" >> $GITHUB_OUTPUT | |
- name: SonarQube Scan | |
uses: sonarsource/sonarqube-scan-action@4b0bfc149f5e285930eeb5e917327e66660c6e92 # v2.0.0 | |
with: | |
args: > | |
-Dsonar.go.tests.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_tests_report_paths }} | |
-Dsonar.go.coverage.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_coverage_report_paths }} | |
-Dsonar.go.golangci-lint.reportPaths=golangci-lint-report/golangci-lint-report.xml | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
- name: Collect Metrics | |
if: always() | |
id: collect-gha-metrics | |
uses: smartcontractkit/push-gha-metrics-action@d2c2b7bdc9012651230b2608a1bcb0c48538b6ec | |
with: | |
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} | |
this-job-name: SonarQube Scan | |
continue-on-error: true | |
clean: | |
name: Clean Go Tidy & Generate | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go | |
with: | |
only-modules: "true" | |
- name: Setup NodeJS | |
uses: ./.github/actions/setup-nodejs | |
- run: make generate # generate install go deps | |
- name: Ensure clean after generate | |
run: git diff --stat --exit-code | |
- run: make gomodtidy | |
- name: Ensure clean after tidy | |
run: git diff --minimal --exit-code | |
- name: Collect Metrics | |
if: always() | |
id: collect-gha-metrics | |
uses: smartcontractkit/push-gha-metrics-action@d2c2b7bdc9012651230b2608a1bcb0c48538b6ec | |
with: | |
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} | |
this-job-name: Clean Go Tidy & Generate | |
continue-on-error: true |