Skip to content

Commit

Permalink
update setup env action
Browse files Browse the repository at this point in the history
  • Loading branch information
erikburt committed Nov 27, 2024
1 parent bc5f28c commit 3ebea69
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 76 deletions.
32 changes: 22 additions & 10 deletions .github/actions/setup-ci-core-tests/action.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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 != ''}}
Expand All @@ -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
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/ci-core-partial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 }}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
69 changes: 7 additions & 62 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3ebea69

Please sign in to comment.