pulumi/changelog/pending
bors[bot] af1cbee4fb
Merge #13298
13298: ci: Track code coverage r=abhinav a=abhinav

**Overview**

This re-enables tracking of code coverage.
For Go, there are two kinds of coverage at play:
unit test and integration test coverage.

Unit tests follow the usual pattern of running
`go test -cover -coverprofile=whatever.cov`.

For integration tests, we use the new integration test profiling support
[added in Go 1.20](https://go.dev/testing/coverage/).
In short, the way it works is:

    # Build a coverage instrumented binary:
    go build -cover

    # Set GOCOVERDIR to a directory and run the integration tests
    # that will invoke this coverage-instrumented binary.
    GOCOVERDIR=$(pwd)/coverage
    go test ./tests

    # $GOCOVERDIR will now be filled with coverage data
    # from every invocation of the coverage-instrumented binary.
    # Combine it into a single coverage file:
    go tool covdata textfmt -i=$(GOCOVERDIR) -o=out.cov

    # The resulting file can be uploaded to codecov as-is.

The above replaces the prior, partially working hacks we had in place
to get coverage-instrumented binaries with `go test -c`
and hijacking the TestMain.

**Notable changes**

- TestMain hijacking is deleted from the Pulumi CLI.
  We no longer need this to build coverage-instrumented binaries.
- ProgramTest no longer tracks or passes PULUMI_TEST_COVERAGE_PATH
  because the Pulumi binary no longer accepts a test.coverprofile flag.
  This information is now in the GOCOVERDIR environment variable.
- We add an `enable-coverage` parameter to the `ci-build-binaries`
  workflow to mirror some of the other workflows.
  It will produce coverage-instrumented binaries if this is true.
  These binaries are then used by `ci-run-test` which will set
  `GOCOVERDIR` and merge the coverage results from it.
- Coverage configuration no longer counts tests, testdata,
  and Protobuf-generated code against coverage.
- go-wrapper.sh:
  Because we're no longer relying on the `go test -c` hack,
  this no longer excludes Windows and language providers
  from coverage tracking.
- go-test.py and go-wrapper.sh will include pulumi-language-go and
  pulumi-language-nodejs in covered packages.

*Other changes*

- go-test.py:
  Fixed a bug where `args` parameters added for coverage were ignored.

Note that this change DOES NOT track coverage for calls made to Pulumi
packages by plugins downloaded from external sources,
e.g. provider plugins. Arguably, that's out of scope of coverage
trackcing for the Pulumi repository.

Resolves #8615, #11419

Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
2023-06-29 16:13:37 +00:00
..
20230601--cli-state--the-upgrade-command-now-prompts-the-user.yaml cli(state upgrade): Prompt for project names for detached stacks 2023-06-22 13:45:13 -07:00
20230609--engine--old-inputs-are-sent-to-provider-diff-functions-as-well-as-the-old-outputs.yaml Send old inputs to diff and update 2023-06-21 21:04:50 +01:00
20230620--programgen-go--fix-aliasing-package-names-using-dashes-when-schema-doesnt-include-go-package-info-override.yaml Fix aliasing package names using dashes when schema doesn't include go package info override 2023-06-20 18:11:47 +02:00
20230622--cli--stack-output-on-the-console-no-longer-escapes-html-characters-inside-json-strings.yaml fix(cli/stack output): Don't escape HTML characters 2023-06-23 09:11:20 -07:00
20230622--cli-state--disallow-renaming-resources-to-invalid-names-that-will-corrupt-the-state.yaml cli(state/rename): Validate new name before renaming 2023-06-22 14:23:59 -07:00
20230622--programgen-go--use-raw-string-literals-for-long-multi-line-strings.yaml fix(codegen/go): Use raw string literals for multiline-strings 2023-06-22 10:55:45 -07:00
20230622--programgen-nodejs-python--prefer-output-versioned-invokes-in-generated-programs-for-nodejs-and-python.yaml Prefer output-versioned invokes in generated programs for nodejs and python 2023-06-23 02:42:18 +02:00
20230622--sdk-go-nodejs-python--missing-config-error-text-includes-secret-if-requiresecret-was-used.yaml Add --secret to config set hints when needed 2023-06-22 17:25:30 +01:00
20230622--sdk-nodejs--update-atgrpc-grpc-js-to-1-8-16.yaml Update @grpc/grpc-js 2023-06-22 09:08:48 +01:00
20230623--cli-display--print-the-summary-event-for-previews-that-contain-non-error-level-diagnostic-messages.yaml Print update summary in preview even if there are diagnostics. 2023-06-23 15:14:30 -07:00
20230623--engine--engine-marks-outputs-secret-if-an-output-of-the-same-name-is-marked-secret.yaml Mark outputs secret if there is a matching secret input. 2023-06-23 09:24:21 -07:00
20230624--auto-nodejs--adds-a-better-error-message-for-invalid-nodejs-autoapi-workdir.yaml Add a better error message for invalid NodeJS AutoAPI workdir 2023-06-24 11:57:22 -07:00
20230624--sdk-nodejs--support-loading-package-json-from-parent-directory.yaml [sdk/nodejs] Support loading package.json from parent dir 2023-06-29 07:57:43 -07:00
20230626--cli--improve-the-cli-stack-validation-error-message.yaml Improve the stack validation error message 2023-06-28 00:48:19 +02:00
20230626--cli-package--fixes-resolving-plugins-when-they-are-not-yet-installed-in-plugin-cache.yaml Fixes resolving plugins with package get-schema and get-mapping when they are not yet installed in plugin cache 2023-06-26 11:21:38 +02:00
20230628--cli-display--fix-diffs-sometimes-not-showing-even-in-details-view.yaml Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
20230628--cli-state--add-interactive-urn-selection-to-pulumi-state-rename-unprotect-delete.yaml CL 2023-06-28 13:42:00 +02:00
20230628--pkg-testing--programtest-dropped-the-coverprofile-option-as-its-no-longer-necessary.yaml ci: Track code coverage 2023-06-28 13:30:13 -07:00
20230628--sdkgen--fix-loading-schemas-from-providers-on-path.yaml Don't try to install provider during schema loading unless missing 2023-06-28 14:12:17 +01:00