From fca8a00bef2d4735e3a9f184de12c641345ff234 Mon Sep 17 00:00:00 2001 From: Tate Date: Sat, 29 Jun 2024 09:40:16 -0600 Subject: [PATCH] Add an input base path to the setup actions --- .github/actions/setup-nodejs/action.yaml | 10 +++-- .github/actions/setup-postgres/action.yml | 9 ++++- .github/actions/setup-solana/action.yml | 8 +++- .github/actions/setup-wasmd/action.yml | 8 +++- .github/workflows/ci-core.yml | 48 ++--------------------- 5 files changed, 32 insertions(+), 51 deletions(-) diff --git a/.github/actions/setup-nodejs/action.yaml b/.github/actions/setup-nodejs/action.yaml index 9dc1cf375d3..e0de9b01382 100644 --- a/.github/actions/setup-nodejs/action.yaml +++ b/.github/actions/setup-nodejs/action.yaml @@ -3,6 +3,10 @@ inputs: prod: default: "false" description: Set to 'true' to do a prod only install + base-path: + description: Path to the base of the repo + required: false + default: . description: Setup pnpm for contracts runs: using: composite @@ -15,16 +19,16 @@ runs: with: node-version: "20" cache: "pnpm" - cache-dependency-path: "contracts/pnpm-lock.yaml" + cache-dependency-path: "${{ inputs.base-path }}/contracts/pnpm-lock.yaml" - if: ${{ inputs.prod == 'false' }} name: Install dependencies shell: bash run: pnpm i - working-directory: contracts + working-directory: ${{ inputs.base-path }}/contracts - if: ${{ inputs.prod == 'true' }} name: Install prod dependencies shell: bash run: pnpm i --prod - working-directory: contracts + working-directory: ${{ inputs.base-path }}/contracts diff --git a/.github/actions/setup-postgres/action.yml b/.github/actions/setup-postgres/action.yml index f683934d789..45bfba5965f 100644 --- a/.github/actions/setup-postgres/action.yml +++ b/.github/actions/setup-postgres/action.yml @@ -1,13 +1,18 @@ name: Setup Postgresql description: Setup postgres docker container via docker-compose, allowing usage of a custom command, see https://github.com/orgs/community/discussions/26688 +inputs: + base-path: + description: Path to the base of the repo + required: false + default: . runs: using: composite steps: - name: Start postgres service run: docker compose up -d shell: bash - working-directory: ./.github/actions/setup-postgres + working-directory: ${{ inputs.base-path }}/.github/actions/setup-postgres - name: Wait for postgres service to be healthy run: ./wait-for-healthy-postgres.sh shell: bash - working-directory: ./.github/actions/setup-postgres + working-directory: ${{ inputs.base-path }}/.github/actions/setup-postgres diff --git a/.github/actions/setup-solana/action.yml b/.github/actions/setup-solana/action.yml index 41c67a94197..02a0b85ca8b 100644 --- a/.github/actions/setup-solana/action.yml +++ b/.github/actions/setup-solana/action.yml @@ -1,5 +1,10 @@ name: Setup Solana CLI description: Setup solana CLI +inputs: + base-path: + description: Path to the base of the repo + required: false + default: . runs: using: composite steps: @@ -9,11 +14,12 @@ runs: with: path: | ~/.local/share/solana/install/active_release/bin - key: ${{ runner.os }}-solana-cli-${{ hashFiles('./tools/ci/install_solana') }} + key: ${{ runner.os }}-solana-cli-${{ hashFiles('${{ inputs.base-path }}tools/ci/install_solana') }} - if: ${{ steps.cache.outputs.cache-hit != 'true' }} name: Install solana cli shell: bash + working-directory: ${{ inputs.base-path }} run: ./tools/ci/install_solana - name: Export solana path to env diff --git a/.github/actions/setup-wasmd/action.yml b/.github/actions/setup-wasmd/action.yml index 3e3846a70eb..ae31cf2395a 100644 --- a/.github/actions/setup-wasmd/action.yml +++ b/.github/actions/setup-wasmd/action.yml @@ -1,5 +1,10 @@ name: Setup Cosmos wasmd description: Setup Cosmos wasmd, used for integration tests +inputs: + base-path: + description: Path to the base of the repo + required: false + default: . runs: using: composite steps: @@ -10,11 +15,12 @@ runs: path: ~/wasmd-build # this caching works without cloning the repo because the install_wasmd contains # the commit hash. - key: ${{ runner.os }}-wasmd-cli-${{ hashFiles('./tools/ci/install_wasmd') }} + key: ${{ runner.os }}-wasmd-cli-${{ hashFiles('${{ inputs.base-path }}/tools/ci/install_wasmd') }} - if: ${{ steps.cache.outputs.cache-hit != 'true' }} name: Install wasmd shell: bash + working-directory: ${{ inputs.base-path }} run: ./tools/ci/install_wasmd - name: Export wasmd path to env diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index 8d084fe2c08..f4aeebd6bb1 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -114,30 +114,10 @@ jobs: - name: Setup Go if: ${{ needs.filter.outputs.changes == 'true' }} uses: ./.github/actions/setup-go - - - name: Setup Github Token - id: get-gh-token - uses: smartcontractkit/.github/actions/setup-github-token@ef78fa97bf3c77de6563db1175422703e9e6674f # setup-github-token@0.2.1 - with: - aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }} - aws-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }} - aws-region: ${{ secrets.AWS_REGION }} - set-git-config: "true" - - name: Replace the chainlink-integration deps + - name: Replace chainlink-evm deps if: ${{ needs.filter.outputs.changes == 'true' && inputs.evm-ref != ''}} shell: bash - env: - MODULE: github.com/smartcontractkit/chainlink-integrations/evm/relayer - COMMIT_HASH: ${{ inputs.evm-ref }} - run: | - # Update to the evm/relayer code we wish to test against - go env -w GOPRIVATE=github.com/smartcontractkit/chainlink-integrations - go get ${MODULE}@${COMMIT_HASH} - # push replace into core go.mod, remove this once the evm migration is complete - PSEUDO_VERSION=$(go list -m -mod=mod ${MODULE}@${COMMIT_HASH} | awk '{print $2}') - go mod edit -replace=github.com/smartcontractkit/chainlink/v2/core/chains/evm=${MODULE}@${PSEUDO_VERSION} - go mod tidy - + run: go get github.com/smartcontractkit/chainlink-integrations/evm/relayer@${{ inputs.evm-ref }} - name: Run short tests if: ${{ needs.filter.outputs.changes == 'true' && matrix.type.cmd == 'go_core_tests' }} run: go test -short ./... @@ -292,30 +272,10 @@ jobs: - name: Download Go vendor packages if: ${{ needs.filter.outputs.changes == 'true' }} run: go mod download - - - name: Setup Github Token - id: get-gh-token - uses: smartcontractkit/.github/actions/setup-github-token@ef78fa97bf3c77de6563db1175422703e9e6674f # setup-github-token@0.2.1 - with: - aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }} - aws-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }} - aws-region: ${{ secrets.AWS_REGION }} - set-git-config: "true" - - name: Replace the chainlink-integration deps + - name: Replace chainlink-evm deps if: ${{ needs.filter.outputs.changes == 'true' && inputs.evm-ref != ''}} shell: bash - env: - MODULE: github.com/smartcontractkit/chainlink-integrations/evm/relayer - COMMIT_HASH: ${{ inputs.evm-ref }} - run: | - # Update to the evm/relayer code we wish to test against - go env -w GOPRIVATE=github.com/smartcontractkit/chainlink-integrations - go get ${MODULE}@${COMMIT_HASH} - # push replace into core go.mod, remove this once the evm migration is complete - PSEUDO_VERSION=$(go list -m -mod=mod ${MODULE}@${COMMIT_HASH} | awk '{print $2}') - go mod edit -replace=github.com/smartcontractkit/chainlink/v2/core/chains/evm=${MODULE}@${PSEUDO_VERSION} - go mod tidy - + run: go get github.com/smartcontractkit/chainlink-integrations/evm/relayer@${{ inputs.evm-ref }} - name: Build binary if: ${{ needs.filter.outputs.changes == 'true' }} run: go build -o chainlink.test .