Skip to content

Commit

Permalink
chore: cleanup ci-core
Browse files Browse the repository at this point in the history
  • Loading branch information
erikburt committed Dec 19, 2024
1 parent 06a4445 commit 4a6d1ba
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 155 deletions.
178 changes: 23 additions & 155 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,34 @@ on:
pull_request:
schedule:
- cron: "0 0,6,12,18 * * *"
workflow_dispatch:
inputs:
distinct_run_name:
description: "A unique identifier for this run, used when running from other repos"
required: false
type: string
evm-ref:
description: The chainlink-evm reference to use when testing against a specific version for compatibliity
required: false
default: ""
type: string

jobs:
filter:
name: Detect Changes
permissions:
pull-requests: read
outputs:
affected-packages: ${{ steps.resolved-modules.outputs.module_names }}
affected-modules: ${{ steps.resolved-modules.outputs.module_names }}
deployment-changes: ${{ steps.match-some.outputs.deployment == 'true' }}
scripts-changes: ${{ steps.match-some.outputs.scripts == 'true' }}
should-run-ci-core: ${{ steps.match-some.outputs.core-ci == 'true' || steps.match-every.outputs.non-ignored == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
should-run-golangci: ${{ steps.match-some.outputs.golang-ci == 'true' || steps.match-every.outputs.non-ignored == 'true' || github.event_name == 'workflow_dispatch' }}
should-run-ci-core: >-
${{
steps.match-some.outputs.core-ci == 'true' ||
steps.match-every.outputs.non-ignored == 'true' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
}}
should-run-golangci: >-
${{
steps.match-some.outputs.golang-ci == 'true' ||
steps.match-every.outputs.non-ignored == 'true'
}}
should-run-scripts-test: >-
${{
steps.match-some.outputs.scripts == 'true' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
}}
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
Expand Down Expand Up @@ -125,7 +130,7 @@ jobs:
strategy:
fail-fast: false
matrix:
modules: ${{ fromJson(needs.filter.outputs.affected-packages) }}
modules: ${{ fromJson(needs.filter.outputs.affected-modules) }}
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -148,8 +153,6 @@ jobs:
golangci-matrix-results-validation:
name: lint
needs: [golangci]
# We don't directly merge dependabot PRs to not waste the resources.
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'schedule') && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Check Golangci-lint Matrix Results
Expand Down Expand Up @@ -212,11 +215,6 @@ jobs:
restore-build-cache-only: ${{ matrix.type.cmd == 'go_core_fuzz' }}
build-cache-version: ${{ matrix.type.cmd }}

- name: Replace chainlink-evm deps
if: ${{ needs.filter.outputs.should-run-ci-core == 'true' && inputs.evm-ref != ''}}
shell: bash
run: go get github.com/smartcontractkit/chainlink-integrations/evm/relayer@${{ inputs.evm-ref }}

- name: Setup Solana
if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }}
uses: ./.github/actions/setup-solana
Expand Down Expand Up @@ -329,7 +327,7 @@ jobs:
name: test-scripts
needs: [filter]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' || needs.filter.outputs.scripts-changes == 'true' }}
if: ${{ needs.filter.outputs.should-run-scripts-test == 'true' }}
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -346,7 +344,7 @@ jobs:
run: ./tools/bin/go_core_scripts_tests ./...

- name: Store test report artifacts
if: ${{ always() && needs.filter.outputs.should-run-ci-core == 'true' }}
if: ${{ always() }}
uses: actions/[email protected]
with:
name: go_core_scripts_tests_logs
Expand All @@ -355,94 +353,6 @@ jobs:
./coverage.txt
retention-days: 7

detect-flakey-tests:
needs: [filter, core, core-scripts-tests]
name: Flakey Test Detection
runs-on: ubuntu-latest
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
env:
CL_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable
permissions:
id-token: write
contents: read
steps:
- name: Checkout the repo
uses: actions/[email protected]

- name: Setup node
uses: actions/[email protected]

- 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: Replace chainlink-evm deps
if: ${{ github.event_name == 'workflow_dispatch' && inputs.evm-ref != ''}}
shell: bash
run: go get github.com/smartcontractkit/chainlink-integrations/evm/relayer@${{ inputs.evm-ref }}

- name: Build binary
run: go build -o chainlink.test .

- name: Setup DB
run: ./chainlink.test local db preparetest

- name: Load test outputs
uses: actions/[email protected]
with:
name: go_core_tests_logs
path: ./artifacts

- name: Delete go_core_tests_logs/coverage.txt
shell: bash
run: |
# Need to delete coverage.txt so the disk doesn't fill up
rm -f ./artifacts/go_core_tests_logs/coverage.txt
- name: Build flakey test runner
run: go build ./tools/flakeytests/cmd/runner

- name: Re-run tests
env:
GRAFANA_INTERNAL_BASIC_AUTH: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }}
GITHUB_EVENT_PATH: ${{ github.event_path }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: |
./runner \
-grafana_auth=$GRAFANA_INTERNAL_BASIC_AUTH \
-grafana_host=$GRAFANA_INTERNAL_HOST \
-gh_sha=$GITHUB_SHA \
-gh_event_path=$GITHUB_EVENT_PATH \
-gh_event_name=$GITHUB_EVENT_NAME \
-gh_run_id=$GITHUB_RUN_ID \
-gh_repo=$GITHUB_REPO \
-command=./tools/bin/go_core_tests \
`ls -R ./artifacts/output.txt`
- name: Store logs artifacts
if: ${{ always() }}
uses: actions/[email protected]
with:
name: flakey_test_runner_logs
path: |
./output.txt
retention-days: 7

scan:
name: SonarQube Scan
needs: [golangci, core, core-scripts-tests]
Expand Down Expand Up @@ -544,56 +454,14 @@ jobs:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_SCANNER_OPTS: "-Xms6g -Xmx8g"

trigger-flaky-test-detection-for-root-project:
name: Flakeguard Root Project
uses: ./.github/workflows/flakeguard.yml
if: ${{ github.event_name == 'pull_request' }}
with:
repoUrl: 'https://github.com/smartcontractkit/chainlink'
projectPath: '.'
baseRef: ${{ github.base_ref }}
headRef: ${{ github.head_ref }}
maxPassRatio: '1.0'
findByTestFilesDiff: true
findByAffectedPackages: false
slackNotificationAfterTestsChannelId: 'C07TRF65CNS' #flaky-test-detector-notifications
extraArgs: '{ "skipped_tests": "TestChainComponents", "run_with_race": "true", "print_failed_tests": "true", "test_repeat_count": "3", "omit_test_outputs_on_success": "true" }'
secrets:
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

trigger-flaky-test-detection-for-deployment-project:
name: Flakeguard Deployment Project
uses: ./.github/workflows/flakeguard.yml
needs: [filter]
if: ${{ github.event_name == 'pull_request' && needs.filter.outputs.deployment-changes == 'true'}}
with:
repoUrl: 'https://github.com/smartcontractkit/chainlink'
projectPath: 'deployment'
baseRef: ${{ github.base_ref }}
headRef: ${{ github.head_ref }}
maxPassRatio: '1.0'
findByTestFilesDiff: true
findByAffectedPackages: false
slackNotificationAfterTestsChannelId: 'C07TRF65CNS' #flaky-test-detector-notifications
extraArgs: '{ "skipped_tests": "TestAddLane", "run_with_race": "true", "print_failed_tests": "true", "test_repeat_count": "3", "omit_test_outputs_on_success": "true" }'
secrets:
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

clean:
name: Clean Go Tidy & Generate
if: ${{ !contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') && github.actor != 'dependabot[bot]' }}
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu22.04-8cores-32GB
defaults:
run:
shell: bash
steps:
- name: Check for Skip Tests Label
if: contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests')
run: |
echo "## \`skip-smoke-tests\` label is active, skipping E2E smoke tests" >>$GITHUB_STEP_SUMMARY
exit 0
- uses: actions/[email protected]
with:
fetch-depth: 0
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/ci-flakes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI - Flakes

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:
pull_request:

jobs:

detect-changes:
name: Detect Changes
permissions:
pull-requests: read
outputs:
deployment-changes: ${{ steps.some.outputs.deployment == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/[email protected]
with:
persist-credentials: false
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: some
with:
filters: |
deployment:
- 'deployment/**'
trigger-flaky-test-detection-for-root-project:
name: Flakeguard Root Project
uses: ./.github/workflows/flakeguard.yml
with:
repoUrl: 'https://github.com/smartcontractkit/chainlink'
projectPath: '.'
baseRef: ${{ github.base_ref }}
headRef: ${{ github.head_ref }}
maxPassRatio: '1.0'
findByTestFilesDiff: true
findByAffectedPackages: false
slackNotificationAfterTestsChannelId: 'C07TRF65CNS' #flaky-test-detector-notifications
extraArgs: '{ "skipped_tests": "TestChainComponents", "run_with_race": "true", "print_failed_tests": "true", "test_repeat_count": "3", "omit_test_outputs_on_success": "true" }'
secrets:
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

trigger-flaky-test-detection-for-deployment-project:
name: Flakeguard Deployment Project
uses: ./.github/workflows/flakeguard.yml
needs: [detect-changes]
if: ${{ needs.detect-changes.outputs.deployment-changes == 'true'}}
with:
repoUrl: 'https://github.com/smartcontractkit/chainlink'
projectPath: 'deployment'
baseRef: ${{ github.base_ref }}
headRef: ${{ github.head_ref }}
maxPassRatio: '1.0'
findByTestFilesDiff: true
findByAffectedPackages: false
slackNotificationAfterTestsChannelId: 'C07TRF65CNS' #flaky-test-detector-notifications
extraArgs: '{ "skipped_tests": "TestAddLane", "run_with_race": "true", "print_failed_tests": "true", "test_repeat_count": "3", "omit_test_outputs_on_success": "true" }'
secrets:
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 4a6d1ba

Please sign in to comment.