diff --git a/.github/workflows/run-e2e-tests.yml b/.github/workflows/run-e2e-tests.yml index fc6d331cf..7fca8c4f4 100644 --- a/.github/workflows/run-e2e-tests.yml +++ b/.github/workflows/run-e2e-tests.yml @@ -184,6 +184,14 @@ on: required: false type: number default: 60 + prebuilt_e2e_test_binaries_artifact: + description: | + When non-empty, the name of a workflow artifact (uploaded by the caller) that + contains e2e-test-binaries.tar.gz produced from integration-tests/.e2e-test-bin. + Matrix jobs extract it and run tests via precompiled binaries (see e2e-tests.yml). + required: false + type: string + default: "" outputs: test_results: description: "Test results from all executed tests" @@ -747,6 +755,21 @@ jobs: persist-credentials: false ref: ${{ inputs.chainlink_version }} + - name: Download prebuilt E2E test binaries + if: inputs.prebuilt_e2e_test_binaries_artifact != '' + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.prebuilt_e2e_test_binaries_artifact }} + path: downloaded-e2e-bins + + - name: Extract prebuilt E2E test binaries + if: inputs.prebuilt_e2e_test_binaries_artifact != '' + shell: bash + run: | + tar xzf downloaded-e2e-bins/e2e-test-binaries.tar.gz -C integration-tests + find integration-tests/.e2e-test-bin -name '*.test' -exec chmod +x {} \; + echo "PREBUILT_E2E_BINARIES=true" >> "$GITHUB_ENV" + - name: Show test config override path in summary if: ${{ env.TEST_CONFIG_OVERRIDE_PATH }} shell: bash @@ -852,7 +875,7 @@ jobs: - name: Run tests id: run_tests timeout-minutes: ${{ matrix.tests.timeout_minutes || inputs.test-timeout-minutes }} - uses: smartcontractkit/.github/actions/ctf-run-tests@ctf-run-tests/0.11.0 + uses: smartcontractkit/.github/actions/ctf-run-tests@fd6d3af35a8d36bff54eac8babde688c31fd39cf # jankiness because: github.com/actions/runner/issues/1492 + github.com/actions/runner/issues/2418 continue-on-error: ${{ fromJSON(env.QUARANTINE) }} env: @@ -877,6 +900,7 @@ jobs: test_go_project_path: ${{ matrix.tests.test_go_project_path }} test_command_to_run: ${{ matrix.tests.test_cmd }} ${{ matrix.tests.test_cmd_opts }} test_download_vendor_packages_command: cd $(dirname ${{ matrix.tests.path }}) && go mod download + skip_go_modules_download: ${{ inputs.prebuilt_e2e_test_binaries_artifact != '' && 'true' || 'false' }} test_secrets_override_base64: ${{ steps.aws-test-secrets.outputs.secret_value || secrets.TEST_SECRETS_OVERRIDE_BASE64 }} test_config_override_path: ${{ env.TEST_CONFIG_OVERRIDE_PATH }} @@ -1114,6 +1138,21 @@ jobs: with: persist-credentials: false + - name: Download prebuilt E2E test binaries + if: inputs.prebuilt_e2e_test_binaries_artifact != '' + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.prebuilt_e2e_test_binaries_artifact }} + path: downloaded-e2e-bins + + - name: Extract prebuilt E2E test binaries + if: inputs.prebuilt_e2e_test_binaries_artifact != '' + shell: bash + run: | + tar xzf downloaded-e2e-bins/e2e-test-binaries.tar.gz -C integration-tests + find integration-tests/.e2e-test-bin -name '*.test' -exec chmod +x {} \; + echo "PREBUILT_E2E_BINARIES=true" >> "$GITHUB_ENV" + - name: Show test config override path in summary if: ${{ env.TEST_CONFIG_OVERRIDE_PATH }} run: | @@ -1171,7 +1210,7 @@ jobs: - name: Run tests id: run_tests timeout-minutes: ${{ matrix.tests.timeout_minutes || inputs.test-timeout-minutes }} - uses: smartcontractkit/.github/actions/ctf-run-tests@ctf-run-tests/0.11.0 + uses: smartcontractkit/.github/actions/ctf-run-tests@fd6d3af35a8d36bff54eac8babde688c31fd39cf # jankiness because: github.com/actions/runner/issues/1492 + github.com/actions/runner/issues/2418 continue-on-error: ${{ fromJSON(env.QUARANTINE) }} env: @@ -1203,6 +1242,7 @@ jobs: with: test_command_to_run: ${{ matrix.tests.test_cmd }} ${{ matrix.tests.test_cmd_opts }} test_download_vendor_packages_command: make gomod + skip_go_modules_download: ${{ inputs.prebuilt_e2e_test_binaries_artifact != '' && 'true' || 'false' }} test_secrets_override_base64: ${{ steps.aws-test-secrets.outputs.secret_value || secrets.TEST_SECRETS_OVERRIDE_BASE64 }} test_config_override_path: ${{ env.TEST_CONFIG_OVERRIDE_PATH }} @@ -1316,6 +1356,21 @@ jobs: with: persist-credentials: false + - name: Download prebuilt E2E test binaries + if: inputs.prebuilt_e2e_test_binaries_artifact != '' + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.prebuilt_e2e_test_binaries_artifact }} + path: downloaded-e2e-bins + + - name: Extract prebuilt E2E test binaries + if: inputs.prebuilt_e2e_test_binaries_artifact != '' + shell: bash + run: | + tar xzf downloaded-e2e-bins/e2e-test-binaries.tar.gz -C integration-tests + find integration-tests/.e2e-test-bin -name '*.test' -exec chmod +x {} \; + echo "PREBUILT_E2E_BINARIES=true" >> "$GITHUB_ENV" + - name: Set dynamic env vars for tests shell: bash run: | @@ -1342,7 +1397,7 @@ jobs: - name: Run tests id: run_tests timeout-minutes: ${{ matrix.tests.timeout_minutes || inputs.test-timeout-minutes }} - uses: smartcontractkit/.github/actions/ctf-run-tests@ctf-run-tests/0.11.0 + uses: smartcontractkit/.github/actions/ctf-run-tests@fd6d3af35a8d36bff54eac8babde688c31fd39cf # jankiness because: github.com/actions/runner/issues/1492 + github.com/actions/runner/issues/2418 continue-on-error: ${{ fromJSON(env.QUARANTINE) }} env: @@ -1351,6 +1406,7 @@ jobs: test_go_project_path: ${{ matrix.tests.test_go_project_path }} test_command_to_run: ${{ matrix.tests.test_cmd }} ${{ matrix.tests.test_cmd_opts }} test_download_vendor_packages_command: cd $(dirname ${{ matrix.tests.path }}) && go mod download + skip_go_modules_download: ${{ inputs.prebuilt_e2e_test_binaries_artifact != '' && 'true' || 'false' }} test_type: ${{ matrix.tests.test_env_vars.TEST_TYPE }} test_suite: ${{ matrix.tests.test_env_vars.TEST_SUITE }} artifacts_name: ${{ env.TEST_ID }}-test-logs diff --git a/actions/ctf-run-tests/CHANGELOG.md b/actions/ctf-run-tests/CHANGELOG.md index 0b09537ae..15baeabe9 100644 --- a/actions/ctf-run-tests/CHANGELOG.md +++ b/actions/ctf-run-tests/CHANGELOG.md @@ -1,5 +1,15 @@ # ctf-run-tests +## 0.13.0 + +### Minor Changes + +- Add optional inputs `go_necessary` and `skip_go_modules_download` for workflows that run + precompiled `go test -c` binaries (for example E2E matrix jobs). When + `skip_go_modules_download` is true, module download is skipped while Go remains available + for `gotestsum` / `gotestloghelper`. Use `gotestsum --raw-command -- ./pkg.test -test.json ...` + in `test_command_to_run` for test2json output. + ## 0.12.0 ### Minor Changes diff --git a/actions/ctf-run-tests/README.md b/actions/ctf-run-tests/README.md index 427290bfd..aaf054a01 100644 --- a/actions/ctf-run-tests/README.md +++ b/actions/ctf-run-tests/README.md @@ -1,3 +1,7 @@ # ctf-run-tests > Common runner for chainlink-testing-framework based tests + +Precompiled tests: set `skip_go_modules_download` to skip `go mod download`, and pass a +`test_command_to_run` that uses `gotestsum --raw-command -- /path/to/pkg.test -test.v -test.json …` +so junit/json output still works. diff --git a/actions/ctf-run-tests/action.yml b/actions/ctf-run-tests/action.yml index d607daad8..2690115e9 100644 --- a/actions/ctf-run-tests/action.yml +++ b/actions/ctf-run-tests/action.yml @@ -220,6 +220,18 @@ inputs: description: | Whether to setup the database before running the tests. Typically used for in-memory tests. default: "false" + go_necessary: + required: false + description: | + Whether to install Go and run module download (via test_download_vendor_packages_command). + Set to "false" only if the runner already has a compatible Go toolchain and modules are not needed. + default: "true" + skip_go_modules_download: + required: false + description: | + When "true", replaces the module download step with a no-op. Use with precompiled test + binaries; Go is still installed for gotestsum/gotestloghelper unless go_necessary is false. + default: "false" runs: using: composite @@ -231,9 +243,10 @@ runs: uses: smartcontractkit/.github/actions/ctf-setup-run-tests-environment@ctf-setup-run-tests-environment/0.8.0 with: test_download_vendor_packages_command: - ${{ inputs.test_download_vendor_packages_command }} + ${{ inputs.skip_go_modules_download == 'true' && 'echo Skipping go mod download \(prebuilt E2E binaries\); true' || inputs.test_download_vendor_packages_command }} go_version: ${{ inputs.go_version }} go_mod_path: ${{ inputs.go_mod_path }} + go_necessary: ${{ inputs.go_necessary }} cache_restore_only: ${{ inputs.cache_restore_only }} cache_key_id: ${{ inputs.cache_key_id }} aws_registries: ${{ inputs.aws_registries }} diff --git a/actions/ctf-run-tests/package.json b/actions/ctf-run-tests/package.json index 0aec566aa..da80c4bf1 100644 --- a/actions/ctf-run-tests/package.json +++ b/actions/ctf-run-tests/package.json @@ -1,6 +1,6 @@ { "name": "ctf-run-tests", - "version": "0.12.0", + "version": "0.13.0", "description": "", "private": true, "scripts": {},