From 8ca3a34ed2b9c9186152931a63a33c0a70fe88cd Mon Sep 17 00:00:00 2001 From: Tate Date: Thu, 7 Mar 2024 12:47:02 -0700 Subject: [PATCH] [TT-974] Setup e2e workflow to be called from chainlink-evm (#12326) * [TT-974] Setup workflows to be called from chainlink-evm * fix loki url * fix merge conflicts * loki url change again --- .../actions/build-chainlink-image/action.yml | 8 +- .github/workflows/integration-tests.yml | 100 ++++++++++++++---- 2 files changed, 86 insertions(+), 22 deletions(-) diff --git a/.github/actions/build-chainlink-image/action.yml b/.github/actions/build-chainlink-image/action.yml index 324a5353b24..75a5147248a 100644 --- a/.github/actions/build-chainlink-image/action.yml +++ b/.github/actions/build-chainlink-image/action.yml @@ -15,13 +15,16 @@ inputs: description: "AWS region to use for ECR" AWS_ROLE_TO_ASSUME: description: "AWS role to assume for ECR" + dep_evm_sha: + description: The chainlink-evm commit sha to use in go deps + required: false runs: using: composite steps: - name: Check if image exists id: check-image - uses: smartcontractkit/chainlink-github-actions/docker/image-exists@c67a09566412d153ff7640d99f96b43aa03abc04 # v2.3.6 + uses: smartcontractkit/chainlink-github-actions/docker/image-exists@5bee84d30d90295010bda68b0cd46be3a1eea917 # v2.3.8 with: repository: chainlink tag: ${{ inputs.git_commit_sha }}${{ inputs.tag_suffix }} @@ -29,7 +32,7 @@ runs: AWS_ROLE_TO_ASSUME: ${{ inputs.AWS_ROLE_TO_ASSUME }} - name: Build Image if: steps.check-image.outputs.exists == 'false' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-image@c67a09566412d153ff7640d99f96b43aa03abc04 # v2.3.6 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-image@5bee84d30d90295010bda68b0cd46be3a1eea917 # v2.3.8 with: cl_repo: smartcontractkit/chainlink cl_ref: ${{ inputs.git_commit_sha }} @@ -37,6 +40,7 @@ runs: push_tag: ${{ env.CHAINLINK_IMAGE }}:${{ inputs.git_commit_sha }}${{ inputs.tag_suffix }} QA_AWS_REGION: ${{ inputs.AWS_REGION }} QA_AWS_ROLE_TO_ASSUME: ${{ inputs.AWS_ROLE_TO_ASSUME }} + dep_evm_sha: ${{ inputs.dep_evm_sha }} - name: Print Chainlink Image Built shell: sh run: | diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 26b308c7369..d7efe66fae8 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -6,6 +6,41 @@ on: tags: - "*" workflow_dispatch: + inputs: + cl_ref: + description: 'The ref to checkout, defaults to the calling branch' + required: false + type: string + dep_evm_sha: + description: 'The sha of the chainlink-evm commit to use if wanted' + required: false + type: string + set_changes_output: + description: 'Set the changes output' + required: false + type: string + default: 'true' + workflow_call: + inputs: + cl_ref: + description: 'The ref to checkout' + required: false + type: string + default: 'develop' + dep_evm_sha: + description: 'The sha of the chainlink-evm commit to use if wanted' + required: false + type: string + set_changes_output: + description: 'Set the changes output' + required: false + type: string + default: 'true' + run_solana: + description: 'Run solana tests' + required: false + type: string + default: 'false' # Only run 1 of this workflow at a time per PR concurrency: @@ -28,8 +63,12 @@ jobs: # We don't directly merge dependabot PRs, so let's not waste the resources if: github.actor != 'dependabot[bot]' steps: + - run: echo "${{github.event_name}}" - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref }} - name: Check Merge Group Condition id: condition-check run: | @@ -61,6 +100,9 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref }} - uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0 id: changes with: @@ -84,7 +126,7 @@ jobs: this-job-name: Check Paths That Require Tests To Run continue-on-error: true outputs: - src: ${{ steps.changes.outputs.src }} + src: ${{ inputs.set_changes_output || steps.changes.outputs.src }} build-lint-integration-tests: name: Build and Lint integration-tests @@ -103,6 +145,9 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref }} - name: Setup Go uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@c67a09566412d153ff7640d99f96b43aa03abc04 # v2.3.6 with: @@ -158,7 +203,8 @@ jobs: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Build Chainlink Image if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch' uses: ./.github/actions/build-chainlink-image @@ -168,6 +214,7 @@ jobs: git_commit_sha: ${{ github.sha }} AWS_REGION: ${{ secrets.QA_AWS_REGION }} AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} + dep_evm_sha: ${{ inputs.dep_evm_sha }} build-test-image: if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'schedule' || contains(join(github.event.pull_request.labels.*.name, ' '), 'build-test-image') @@ -192,7 +239,8 @@ jobs: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Build Test Image if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch' uses: ./.github/actions/build-test-image @@ -216,6 +264,9 @@ jobs: exit 0 - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref }} - name: Compare Test Lists run: | cd ./integration-tests @@ -285,7 +336,8 @@ jobs: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Build Go Test Command id: build-go-test-command run: | @@ -306,9 +358,9 @@ jobs: pyroscopeServer: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725 pyroscopeEnvironment: ${{ matrix.product.pyroscope_env }} pyroscopeKey: ${{ secrets.QA_PYROSCOPE_KEY }} - lokiEndpoint: ${{ secrets.LOKI_URL }} - lokiTenantId: ${{ vars.LOKI_TENANT_ID }} - lokiBasicAuth: ${{ secrets.LOKI_BASIC_AUTH }} + lokiEndpoint: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push + lokiTenantId: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + lokiBasicAuth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} logstreamLogTargets: ${{ vars.LOGSTREAM_LOG_TARGETS }} grafanaUrl: ${{ vars.GRAFANA_URL }} grafanaDashboardUrl: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs" @@ -373,7 +425,8 @@ jobs: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Build Go Test Command id: build-go-test-command run: | @@ -394,9 +447,9 @@ jobs: pyroscopeServer: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725 pyroscopeEnvironment: ${{ matrix.product.pyroscope_env }} pyroscopeKey: ${{ secrets.QA_PYROSCOPE_KEY }} - lokiEndpoint: ${{ secrets.LOKI_URL }} - lokiTenantId: ${{ vars.LOKI_TENANT_ID }} - lokiBasicAuth: ${{ secrets.LOKI_BASIC_AUTH }} + lokiEndpoint: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push + lokiTenantId: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + lokiBasicAuth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} logstreamLogTargets: ${{ vars.LOGSTREAM_LOG_TARGETS }} grafanaUrl: ${{ vars.GRAFANA_URL }} grafanaDashboardUrl: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs" @@ -507,7 +560,8 @@ jobs: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Build Go Test Command id: build-go-test-command run: | @@ -580,9 +634,9 @@ jobs: pyroscopeServer: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725 pyroscopeEnvironment: ${{ matrix.product.pyroscope_env }} pyroscopeKey: ${{ secrets.QA_PYROSCOPE_KEY }} - lokiEndpoint: ${{ secrets.LOKI_URL }} - lokiTenantId: ${{ vars.LOKI_TENANT_ID }} - lokiBasicAuth: ${{ secrets.LOKI_BASIC_AUTH }} + lokiEndpoint: https://${{ secrets.GRAFANA_INTERNAL_HOST }}/loki/api/v1/push + lokiTenantId: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + lokiBasicAuth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} logstreamLogTargets: ${{ vars.LOGSTREAM_LOG_TARGETS }} grafanaUrl: ${{ vars.GRAFANA_URL }} grafanaDashboardUrl: "/d/ddf75041-1e39-42af-aa46-361fe4c36e9e/ci-e2e-tests-logs" @@ -674,6 +728,9 @@ jobs: - name: Checkout repo if: ${{ github.event_name == 'pull_request' }} uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref }} - name: 🧼 Clean up Environment if: ${{ github.event_name == 'pull_request' }} @@ -705,7 +762,8 @@ jobs: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Run Setup uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@c67a09566412d153ff7640d99f96b43aa03abc04 # v2.3.6 with: @@ -744,7 +802,8 @@ jobs: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Get Latest Version id: get_latest_version run: | @@ -800,18 +859,19 @@ jobs: ## Solana Section get_solana_sha: + # We don't directly merge dependabot PRs, so let's not waste the resources + if: ${{ github.actor != 'dependabot[bot]' && inputs.run_solana != 'false' }} name: Get Solana Sha From Go Mod environment: Integration runs-on: ubuntu-latest - # We don't directly merge dependabot PRs, so let's not waste the resources - if: github.actor != 'dependabot[bot]' outputs: sha: ${{ steps.getsha.outputs.sha }} steps: - name: Checkout the repo uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + repository: smartcontractkit/chainlink + ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Setup Go uses: ./.github/actions/setup-go with: