pulumi/.github/workflows
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
..
ci-build-binaries.yml Merge #13298 2023-06-29 16:13:37 +00:00
ci-build-sdks.yml CI: Node 14 => Node 16 2023-05-09 17:02:08 -04:00
ci-info.yml ci: Update post-release PR to align with release process 2022-10-18 22:45:59 -07:00
ci-lint.yml Upgrade the golangci-lint version used in CI 2023-06-28 13:57:25 +02:00
ci-prepare-release.yml feat: sign pulumi binaries with cosign 2022-12-16 09:32:51 -08:00
ci-run-test.yml ci: Track code coverage 2023-06-28 13:30:13 -07:00
ci-test-docs-generation.yml Replace deprecated command with environment file 2023-02-20 11:14:39 +09:00
ci.yml ci: Track code coverage 2023-06-28 13:30:13 -07:00
command-dispatch.yml ci: ensure trunk is always green 2022-09-13 13:38:14 -07:00
download-pulumi-cron.yml Fix Download Pulumi Cron workflow 2023-03-17 16:38:38 -07:00
on-community-pr.yml ci: fix community contributor workflows 2022-09-21 17:39:15 -07:00
on-merge.yml feat: sign pulumi binaries with cosign 2022-12-16 09:32:51 -08:00
on-pr-changelog.yml ci: fix community contributor workflows 2022-09-21 17:39:15 -07:00
on-pr-default.yml Fix regex 2023-03-23 11:31:31 -04:00
on-pr-target.yml ci: Refactor linear-history check to run on pull request target for community PRs 2022-11-15 15:17:35 -08:00
on-pr.yml Don't run tests on .version changes. 2023-03-22 19:59:16 -04:00
on-release.yml ci: Update post-release PR to align with release process 2022-10-18 22:45:59 -07:00
pr-test-acceptance-on-dispatch.yml Rename "Smoke" test to "Acceptance" tests 2023-01-30 15:38:37 -05:00
pr-test-docs-gen-on-pr.yml ci: Clean up excess permissions, fix acceptance tests job 2022-09-15 17:48:16 -07:00
pr-test-docs-generation-on-dispatch.yml Replace deprecated command with environment file 2023-02-20 11:14:39 +09:00
rebase.yml ci/rebase: Run for members and owners 2023-02-19 18:18:06 -08:00
release-homebrew-tap.yml ci: Enable gh cli in every step of job 2022-10-04 23:23:43 -07:00
release-pr.yml ci: Update post-release PR to align with release process 2022-10-18 22:45:59 -07:00
release.pub ci: ensure trunk is always green 2022-09-13 13:38:14 -07:00
release.yml CI: Node 14 => Node 16 2023-05-09 17:02:08 -04:00
trigger-homebrew-event.yml ci: Reenable Brew publishing after GH runners removed brew from path 2022-09-27 11:10:38 -07:00
trigger-release-docs-event.yml Enable command dispatch workflow for dealing with PRs (#5851) 2020-12-07 19:29:04 +00:00