Skip to content

Commit

Permalink
TEMP: just install gotestsum in ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison committed Sep 12, 2024
1 parent 7490542 commit 861daa9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest

- name: Create junit-xml directory
run: mkdir junit-xml

Expand Down
14 changes: 3 additions & 11 deletions internal/cmd/build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ func (b *builder) integrationTest() error {
return fmt.Errorf("failed parsing flags: %w", err)
}

gotestsum, err := b.getInstalledTool("gotest.tools/gotestsum")
if err != nil {
return fmt.Errorf("failed getting gotestsum: %w", err)
}
// Also accept coverage file as env var
if env := strings.TrimSpace(os.Getenv("TEMPORAL_COVERAGE_FILE")); *coverageFileFlag == "" && env != "" {
*coverageFileFlag = env
Expand Down Expand Up @@ -176,7 +172,7 @@ func (b *builder) integrationTest() error {
}

// Run integration test
args := []string{gotestsum, "-tags", "protolegacy", "-count", "1", "-race", "-v", "-timeout", "10m"}
args := []string{"gotestsum", "-tags", "protolegacy", "-count", "1", "-race", "-v", "-timeout", "10m"}
if *junitFileFlag != "" {
args = append(args, "--junitfile", *junitFileFlag+"-integration-test.xml")
}
Expand Down Expand Up @@ -247,14 +243,10 @@ func (b *builder) unitTest() error {
return fmt.Errorf("failed parsing flags: %w", err)
}

gotestsum, err := b.getInstalledTool("gotest.tools/gotestsum")
if err != nil {
return fmt.Errorf("failed getting gotestsum: %w", err)
}
// Find every non ./test-prefixed package that has a test file
testDirMap := map[string]struct{}{}
var testDirs []string
err = fs.WalkDir(os.DirFS(b.rootDir), ".", func(p string, d fs.DirEntry, err error) error {
err := fs.WalkDir(os.DirFS(b.rootDir), ".", func(p string, d fs.DirEntry, err error) error {
if !strings.HasPrefix(p, "test") && strings.HasSuffix(p, "_test.go") {
dir := path.Dir(p)
if _, ok := testDirMap[dir]; !ok {
Expand All @@ -280,7 +272,7 @@ func (b *builder) unitTest() error {
log.Printf("Running unit tests in dirs: %v", testDirs)
for _, testDir := range testDirs {
// Run unit test
args := []string{gotestsum, "-tags", "protolegacy", "-count", "1", "-race", "-v", "-timeout", "15m"}
args := []string{"gotestsum", "-tags", "protolegacy", "-count", "1", "-race", "-v", "-timeout", "15m"}
if *junitFileFlag != "" {
args = append(args, "--junitfile", *junitFileFlag+strings.ReplaceAll(testDir, "/", "-")+"unit-test.xml")
}
Expand Down

0 comments on commit 861daa9

Please sign in to comment.