-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
12 changed files
with
111 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...-pkg-testing--programtest-dropped-the-coverprofile-option-as-its-no-longer-necessary.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
changes: | ||
- type: chore | ||
scope: pkg/testing | ||
description: ProgramTest dropped the CoverProfile option as it's no longer necessary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,54 @@ | ||
comment: false | ||
|
||
coverage: | ||
status: | ||
|
||
# Project tracks and reports the project-level coverage. | ||
project: | ||
default: false | ||
default: | ||
informational: true | ||
|
||
# Pulumi core | ||
core: | ||
informational: true | ||
paths: | ||
- "pkg/*" | ||
- "sdk/go/common/*" | ||
- "sdk/go/auto/*" | ||
- "sdk/proto/*" | ||
- "pkg" | ||
- "sdk/go/common" | ||
- "sdk/go/auto" | ||
|
||
sdk-go: | ||
informational: true | ||
paths: | ||
- "sdk/go/pulumi/*" | ||
- "sdk/go/pulumi-language-go/*" | ||
- "sdk/go/pulumi" | ||
- "sdk/go/pulumi-language-go" | ||
sdk-nodejs: | ||
informational: true | ||
paths: | ||
- "sdk/nodejs/*" | ||
- "sdk/nodejs" | ||
sdk-python: | ||
informational: true | ||
paths: | ||
- "sdk/python/*" | ||
- "sdk/python" | ||
|
||
# Patch tracks the coverage of the changes in a single patch. | ||
patch: | ||
default: | ||
informational: true | ||
|
||
ignore: | ||
# Integration tests and codegen test data | ||
# should not count against coverage. | ||
- "tests/" | ||
- "pkg/codegen/testing/test/testdata" | ||
|
||
# Don't count protobuf-generated code against coverage. | ||
- "sdk/proto" | ||
|
||
# More generally, none of the test data | ||
# should count against coverage. | ||
- "**/testdata" | ||
|
||
# Don't comment on PRs. | ||
comment: false | ||
|
||
# Don't post annotations to GitHub. | ||
github_checks: | ||
annotations: false |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.