diff --git a/.github/actions/setup-ci-core-tests/action.yml b/.github/actions/setup-ci-core-tests/action.yml index cb74230f810..378cc7477e7 100644 --- a/.github/actions/setup-ci-core-tests/action.yml +++ b/.github/actions/setup-ci-core-tests/action.yml @@ -1,11 +1,13 @@ name: Setup CI Core Tests description: Shared setup steps for ci-core inputs: - test-suite: - description: | - The test suite's name - required: true + go-mod-download-directory: + description: | + The directory to run go mod download in. If not provided, it will not run go mod download. + required: false + default: "" + evm-ref-override: description: | Overrides the evm/relayer dependency version @@ -16,6 +18,17 @@ inputs: The expected database URL required: true + build-cache-version: + description: | + The version of the build cache to use. Used for scoping build caches. + required: false + + restore-build-cache-only: + description: | + Whether to create a build cache + required: false + default: "false" + runs: using: composite steps: @@ -27,9 +40,8 @@ runs: - name: Setup Go uses: ./.github/actions/setup-go with: - # only restore for now - restore-build-cache-only: "true" - build-cache-version: ${{ inputs.test-suite }} + build-cache-version: ${{ inputs.build-cache-version }} + restore-build-cache-only: ${{ inputs.restore-build-cache-only }} - name: Replace chainlink-evm deps if: ${{ inputs.evm-ref-override != ''}} @@ -53,10 +65,10 @@ runs: shell: bash run: go mod download - - name: Go Mod Download (deployment) - if: ${{ matrix.type.test-suite == 'ccip-deployment' }} + - name: Go Mod Download (optional) + if: ${{ inputs.go-mod-download-directory != '' }} shell: bash - working-directory: "./deployment" + working-directory: ${{ inputs.go-mod-download-directory }} run: go mod download - name: Build binary diff --git a/.github/workflows/ci-core-partial.yml b/.github/workflows/ci-core-partial.yml index 3866ff13af5..e994f492989 100644 --- a/.github/workflows/ci-core-partial.yml +++ b/.github/workflows/ci-core-partial.yml @@ -25,7 +25,6 @@ jobs: module-directory: "./" build-flags: "-tags=integration" - test-suite: "ccip-deployment" - tag-filter: "" module-directory: "./deployment" env: # We explicitly have this env var not be "CL_DATABASE_URL" to avoid having it be used by core related tests @@ -38,8 +37,10 @@ jobs: - name: Setup CI Core Environment uses: ./.github/actions/setup-ci-core-tests with: - test-suite: ${{ matrix.type.cmd }} + build-cache-version: ${{ matrix.type.test-suite }} + restore-build-cache-only: "true" db-url: ${{ env.DB_URL }} + go-mod-download-directory: ${{ matrix.type.test-suite == 'ccip-deployment' && matrix.type.module-directory || '' }} - name: Build Tests uses: smartcontractkit/.github/apps/go-test-caching@feat/go-test-binary-comparison @@ -68,6 +69,7 @@ jobs: uses: smartcontractkit/.github/apps/go-test-caching@feat/go-test-binary-comparison with: pipeline-step: "update" + force-update-index: "true" test-suite: ${{ matrix.type.test-suite }} github-token: ${{ secrets.GITHUB_TOKEN }} @@ -99,7 +101,7 @@ jobs: db-url: ${{ env.DB_URL }} - name: Increase Timeouts - if: ${{ github.event.schedule != ''}} + if: ${{ github.event_name == 'schedule'}} run: | echo "FUZZ_TIMEOUT_MINUTES=10">> $GITHUB_ENV @@ -136,7 +138,7 @@ jobs: db-url: ${{ env.DB_URL }} - name: Increase Timeouts - if: ${{ github.event.schedule != ''}} + if: ${{ github.event_name == 'schedule'}} run: | echo "TIMEOUT=10m" >> $GITHUB_ENV echo "COUNT=50" >> $GITHUB_ENV diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index c38ecd918ae..7ac82ab7908 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -154,74 +154,19 @@ jobs: uses: actions/checkout@v4.2.1 - name: Change Modtime of Files (cache optimization) + if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} shell: bash run: | find . -type f,d -exec touch -r {} -d '1970-01-01T00:00:01' {} \; || true - - - name: Setup NodeJS - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - uses: ./.github/actions/setup-nodejs - with: - prod: "true" - - - name: Setup Go + + - name: Setup CI Core Environment if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - uses: ./.github/actions/setup-go + uses: ./.github/actions/setup-ci-core-tests 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' }} + db-url: ${{ env.DB_URL }} + evm-ref-override: ${{ github.event.inputs.evm-ref }} 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 - - - name: Setup wasmd - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - uses: ./.github/actions/setup-wasmd - - - name: Setup Postgres - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - uses: ./.github/actions/setup-postgres - - - name: Touching core/web/assets/index.html - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - run: mkdir -p core/web/assets && touch core/web/assets/index.html - - - name: Download Go vendor packages - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - run: go mod download - - - name: Build binary - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - run: go build -o chainlink.test . - - - name: Setup DB - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - run: ./chainlink.test local db preparetest - env: - CL_DATABASE_URL: ${{ env.DB_URL }} - - - name: Install LOOP Plugins - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} - run: | - pushd $(go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-feeds) - go install ./cmd/chainlink-feeds - popd - pushd $(go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-data-streams) - go install ./mercury/cmd/chainlink-mercury - popd - pushd $(go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-solana) - go install ./pkg/solana/cmd/chainlink-solana - popd - pushd $(go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-starknet/relayer) - go install ./pkg/chainlink/cmd/chainlink-starknet - popd + restore-build-cache-only: ${{ matrix.type.cmd == 'go_core_fuzz' }} - name: Increase Timeouts for Fuzz/Race # Increase timeouts for scheduled runs only