From 8e780c034ba32ba0444a4ce02cb1e23331ab2735 Mon Sep 17 00:00:00 2001 From: aalu1418 <50029043+aalu1418@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:16:33 -0600 Subject: [PATCH] enable running when changes detected --- .github/workflows/e2e_custom_cl.yml | 122 ++++++++++++++++++++++++++-- 1 file changed, 115 insertions(+), 7 deletions(-) diff --git a/.github/workflows/e2e_custom_cl.yml b/.github/workflows/e2e_custom_cl.yml index 489b24599..02e10b32d 100644 --- a/.github/workflows/e2e_custom_cl.yml +++ b/.github/workflows/e2e_custom_cl.yml @@ -47,6 +47,21 @@ jobs: id: psversion uses: ./.github/actions/projectserum_version + contract-changes: + name: check for contract changes from develop + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.changes.outputs.contracts == 'true' }} + steps: + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changes + with: + base: develop + list-files: csv + filters: | + contracts: + - 'contracts/**' + solana-test-image-exists: environment: integration permissions: @@ -92,13 +107,18 @@ jobs: id-token: write contents: read runs-on: ubuntu-latest-32cores-128GB - needs: [e2e_custom_build_artifacts, get_projectserum_version] + needs: [contract-changes,e2e_custom_build_artifacts, get_projectserum_version] steps: + # TODO: make this if conditional control workflow execution + - name: Changes to develop branch detected + if: needs.contract-changes.output.changed + run: | + echo "changes detected!" - name: Checkout previous release uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: - # ref: v1.0.2 - ref: v1.1.0 + ref: v1.0.2 # pinned to latest deployed release + # ref: v1.1.0 - uses: actions/download-artifact@v4 with: name: artifacts @@ -113,9 +133,11 @@ jobs: - name: build contracts id: previous run: | - # TODO: make dynamic container - # docker run -d -v "$(pwd)":/repo --name build-container projectserum/build:v0.25.0 tail -f /dev/null - docker run -d -v "$(pwd)":/repo --name build-container backpackapp/build:${{ needs.get_projectserum_version.outputs.projectserum_version }} tail -f /dev/null + # for use with 1.0.2 release + docker run -d -v "$(pwd)":/repo --name build-container projectserum/build:v0.25.0 tail -f /dev/null + # for use with 1.1.0 release and onward + # docker run -d -v "$(pwd)":/repo --name build-container backpackapp/build:${{ needs.get_projectserum_version.outputs.projectserum_version }} tail -f /dev/null + # build with keys docker exec build-container bash -c "\ export RUSTUP_HOME=\"/root/.rustup\" &&\ @@ -284,7 +306,7 @@ jobs: - name: Run Tests uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@b49a9d04744b0237908831730f8553f26d73a94b # v2.3.17 with: - test_command_to_run: cd ./integration-tests && go test -timeout 24h -count=1 -run TestSolanaOCRV2Smoke -json $(args) ./smoke 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage + test_command_to_run: cd ./integration-tests && go test -timeout 24h -count=1 -run TestSolanaOCRV2Smoke -json $(args) ./smoke 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci= -singlepackage=true -hidepassingtests=false -hidepassinglogs=false test_download_vendor_packages_command: cd ./integration-tests && go mod download download_contract_artifacts_path: ${{ env.CONTRACT_ARTIFACTS_PATH }} go_mod_path: ./integration-tests/go.mod @@ -299,3 +321,89 @@ jobs: QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }} cache_key_id: solana-e2e-${{ env.MOD_CACHE_VERSION }} cache_restore_only: "false" + + e2e_program_upgrade_tests: + name: E2E Program Upgrade Tests + environment: integration + permissions: + checks: write + pull-requests: write + id-token: write + contents: read + runs-on: ubuntu-latest-16cores-64GB + + needs: [contract-changes,e2e_custom_build_previous_artifacts,e2e_custom_build_artifacts, e2e_custom_build_custom_chainlink_image, check_test_compilation] + env: + TEST_SUITE: smoke + TEST_ARGS: -test.timeout 30m + TEST_LOG_LEVEL: debug + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + # TODO: make this if conditional control workflow execution + - name: Changes to develop branch detected + if: needs.contract-changes.output.changed + run: | + echo "changes detected!" + - name: Collect Metrics + id: collect-gha-metrics + uses: smartcontractkit/push-gha-metrics-action@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0 + with: + id: solana-e2e-program-upgrade + org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} + hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} + this-job-name: E2E Program Upgrade Tests + test-results-file: '{"testType":"go","filePath":"/tmp/gotest.log"}' + continue-on-error: true + - name: Get core ref from PR body + if: github.event_name == 'pull_request' + run: | + comment="$(gh pr view https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} --json body -q '.body')" + # shellcheck disable=SC2086 + core_ref="$(echo $comment | grep -oP 'core ref: \K\S+' || true)" + if [ -n "$core_ref" ]; then + echo "CUSTOM_CORE_REF=${core_ref}" >> "${GITHUB_ENV}" + fi + - name: Checkout the repo + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + - name: Install Solana CLI # required for ensuring the local test validator is configured correctly + run: ./scripts/install-solana-ci.sh + - name: Install gauntlet + uses: ./.github/actions/build-gauntlet + - name: Generate config overrides + run: | # https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/config/README.md + cat << EOF > config.toml + [ChainlinkImage] + image="${{ env.CL_ECR }}" + version="solana.${{ env.CUSTOM_CORE_REF || github.event.inputs.cl_branch_ref || github.sha }}" + [Common] + user="${{ github.actor }}" + internal_docker_repo = "${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com" + EOF + + # shellcheck disable=SC2002 + BASE64_CONFIG_OVERRIDE=$(cat config.toml | base64 -w 0) + # shellcheck disable=SC2086 + echo ::add-mask::$BASE64_CONFIG_OVERRIDE + # shellcheck disable=SC2086 + echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV + - name: Run Upgrade Test + run: | + echo "TODO: implement OCR2 upgrade test!" + # uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@b49a9d04744b0237908831730f8553f26d73a94b # v2.3.17 + # with: + # test_command_to_run: cd ./integration-tests && go test -timeout 24h -count=1 -run TestSolanaOCRV2Smoke -json $(args) ./smoke 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci= -singlepackage=true -hidepassingtests=false -hidepassinglogs=false + # test_download_vendor_packages_command: cd ./integration-tests && go mod download + # download_contract_artifacts_path: ${{ env.CONTRACT_ARTIFACTS_PATH }} + # go_mod_path: ./integration-tests/go.mod + # cl_repo: ${{ env.CL_ECR }} + # cl_image_tag: solana.${{ env.CUSTOM_CORE_REF || github.event.inputs.cl_branch_ref || github.sha }} + # token: ${{ secrets.GITHUB_TOKEN }} + # aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} + # artifacts_name: smoke-test-logs + # artifacts_location: ./integration-tests/smoke/logs/ + # QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }} + # QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} + # QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }} + # cache_key_id: solana-e2e-${{ env.MOD_CACHE_VERSION }} + # cache_restore_only: "false"