From 6e7645c2013c7b24f52202245c28b38378e4f38a Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Thu, 1 Feb 2024 20:58:22 -0500 Subject: [PATCH] CI: Tweak our code coverage profile behavior (#14967) Signed-off-by: Matt Lord --- .github/workflows/codecov.yml | 10 ++++-- Makefile | 2 +- codecov.yml | 50 ++++++++++++++++++++++++++ go/tools/releases/releases_test.go | 8 ----- go/vt/vttablet/tabletserver/report.xml | 0 go/vt/wrangler/vexec.go | 5 +-- 6 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 codecov.yml delete mode 100644 go/vt/vttablet/tabletserver/report.xml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 523002644f5..1d241b47725 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -9,7 +9,7 @@ permissions: read-all jobs: test: name: Code Coverage - runs-on: gh-hosted-runners-4cores-1 + runs-on: gh-hosted-runners-16cores-1 steps: - name: Check out code @@ -106,8 +106,14 @@ jobs: eatmydata -- make unit_test_cover + # Restore the files we deleted as codecov tries to fix their paths. + git reset --hard HEAD + - name: Upload coverage reports to codecov.io if: steps.changes.outputs.changed_files == 'true' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + verbose: true env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/Makefile b/Makefile index 7b09549ae79..e32204733f4 100644 --- a/Makefile +++ b/Makefile @@ -216,7 +216,7 @@ e2e_test: build # Run the code coverage tools, compute aggregate. unit_test_cover: build dependency_check demo source build.env - go test $(VT_GO_PARALLEL) -count=1 -coverprofile=coverage.out ./go/... + go test $(VT_GO_PARALLEL) -count=1 -failfast -covermode=atomic -coverpkg=vitess.io/vitess/go/... -coverprofile=coverage.out ./go/... # Handle go tool cover failures due to not handling `//line` directives, which # the goyacc compiler adds to the generated parser in sql.go. See: # https://github.com/golang/go/issues/41222 diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000000..61232ae9197 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,50 @@ +# https://docs.codecov.com/docs/ +# https://docs.codecov.com/docs/codecov-yaml + +codecov: + branch: main # Set the default branch + +parsers: + go: + partials_as_hits: true + +ignore: + # Ignore our end-to-end test code + - "go/flags/endtoend/**" + - "go/mysql/endtoend/**" + - "go/test/endtoend/**" + - "go/vt/vtctl/endtoend/**" + - "go/vt/vtctl/grpcvtctldserver/endtoend/**" + - "go/vt/vtgate/endtoend/**" + - "go/vt/vttablet/endtoend/**" + - "go/cmd/vttestserver/**" # This relies on end-to-end test packages + # Ignore generated code + - "go/**/cached_size.go" # Code generated by Sizegen + - "go/vt/sqlparser/ast_clone.go" # Code generated by ASTHelperGen + - "go/vt/sqlparser/ast_copy_on_rewrite.go" # Code generated by ASTHelperGen + - "go/vt/sqlparser/ast_equals.go" # Code generated by ASTHelperGen + - "go/vt/sqlparser/ast_format_fast.go" # Code generated by ASTFmtGen + - "go/vt/sqlparser/ast_rewrite.go" # Code generated by ASTHelperGen + - "go/vt/sqlparser/ast_visit.go" # Code generated by ASTHelperGen + - "go/vt/vttablet/tabletserver/txthrottler/mock_healthcheck_test.go" # Code generated by MockGen + - "go/vt/vttablet/tabletserver/txthrottler/mock_throttler_test.go" # Code generated by MockGen + - "go/vt/sqlparser/sql.go" # Code generated by goyacc + - "go/mysql/collations/charset/korean/tables.go" # Code generated by go run maketables.go + - "go/mysql/collations/charset/simplifiedchinese/tables.go" # Code generated by go run maketables.go + - "go/mysql/collations/colldata/mysqldata.go" # Code generated by makecolldata + - "go/mysql/collations/colldata/mysqlucadata.go" # Code generated by makecolldata + - "go/mysql/collations/internal/uca/fasttables.go" # Code generated by makecolldata + - "go/mysql/collations/mysqlversion.go" # Code generated by makecolldata + - "go/mysql/collations/supported.go" # Code generated by makecolldata + # Ignore proto files + - "go/vt/proto/**" + +comment: # https://docs.codecov.com/docs/pull-request-comments + hide_project_coverage: false + +coverage: + status: # https://docs.codecov.com/docs/commit-status + project: + default: + informational: true # Don't ever fail the codecov/project or codecov/patch tests + diff --git a/go/tools/releases/releases_test.go b/go/tools/releases/releases_test.go index 7d050d7c964..19b3f7df88e 100644 --- a/go/tools/releases/releases_test.go +++ b/go/tools/releases/releases_test.go @@ -38,14 +38,6 @@ func TestGetDirs(t *testing.T) { currentDir: dir{ Path: "./", }, - expectedErr: "", - }, - { - name: "Temp dir", - currentDir: dir{ - Path: "/tmp", - }, - expectedErr: "open /tmp/snap-private-tmp: permission denied", }, } diff --git a/go/vt/vttablet/tabletserver/report.xml b/go/vt/vttablet/tabletserver/report.xml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/go/vt/wrangler/vexec.go b/go/vt/wrangler/vexec.go index 49b6c442f60..2c279c5c6cf 100644 --- a/go/vt/wrangler/vexec.go +++ b/go/vt/wrangler/vexec.go @@ -880,8 +880,9 @@ func (wr *Wrangler) ListAllWorkflows(ctx context.Context, keyspace string, activ } // ShowWorkflow will return all of the relevant replication related information for the given workflow. -func (wr *Wrangler) ShowWorkflow(ctx context.Context, workflow, keyspace string, shards []string) (*ReplicationStatusResult, error) { - replStatus, err := wr.getStreams(ctx, workflow, keyspace, shards) +// If shardSubset is nil, then all shards will be queried. +func (wr *Wrangler) ShowWorkflow(ctx context.Context, workflow, keyspace string, shardSubset []string) (*ReplicationStatusResult, error) { + replStatus, err := wr.getStreams(ctx, workflow, keyspace, shardSubset) if err != nil { return nil, err }