From 1b5ec8e5bd44cefc27dbd45f8b259741405a1824 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Mon, 15 Jul 2024 10:50:18 -0700 Subject: [PATCH] feat: gha cost reduction for ci-core (#1174) ## Motivation Reduce costs of CI-core while preserving reliability and speed. ## Solution https://github.com/smartcontractkit/chainlink/pull/13784 > ### Changes > * Set the runner type in the matrix for ci-core > * Downgrade the runners used for ci-core matrix > * core tests: 64 core -> 32 core > * Remove `short-tests` step due to it being re-run regardless (no caching) > * core race: 64 core -> 32 core > * 64 cores on overnight cron runs > * core fuzz: 64 core -> 8 core > >These runners were chosen for cost effectiveness, and reliability based on testing. > > ### Why > > Estimated 62% cost reduction per CI core run (7.04$ -> 2.64$), with a decrease in execution time. > > ``` > Cost estimation per run: > - 8 cores - 21 minutes = 0.336 (linting, clean, core_fuzz) > - 32 cores - 18 minutes = 2.304 (core_race, core_tests) > > 2.304 + 0.336 = 2.64$ (62.5% decrease) > ``` --- https://smartcontract-it.atlassian.net/browse/RE-2796 --- .github/workflows/ci-core.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index 3a552babf0..053aa7a04d 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -90,15 +90,19 @@ jobs: type: - cmd: go_core_tests id: core_unit + os: ubuntu22.04-32cores-128GB - cmd: go_core_race_tests id: core_race + # use 64cores for overnight runs only due to massive number of runs from PRs + os: ${{ github.event_name == 'schedule' && 'ubuntu-latest-64cores-256GB' || 'ubuntu-latest-32cores-128GB' }} - cmd: go_core_fuzz id: core_fuzz + os: ubuntu22.04-8cores-32GB name: Core Tests (${{ matrix.type.cmd }}) # We don't directly merge dependabot PRs, so let's not waste the resources if: github.actor != 'dependabot[bot]' needs: [filter] - runs-on: ubuntu-latest-64cores-256GB + runs-on: ${{ matrix.type.os }} steps: - name: Checkout the repo uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 @@ -113,9 +117,6 @@ jobs: - name: Setup Go if: ${{ needs.filter.outputs.changes == 'true' }} uses: ./.github/actions/setup-go - - name: Run short tests - if: ${{ needs.filter.outputs.changes == 'true' && matrix.type.cmd == 'go_core_tests' }} - run: go test -short ./... - name: Setup Solana if: ${{ needs.filter.outputs.changes == 'true' }} uses: ./.github/actions/setup-solana