Skip to content

Commit 85f5544

Browse files
committed
Install gotestsum locally
1 parent b7ff8a3 commit 85f5544

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ jobs:
3636
with:
3737
go-version: ${{ matrix.go-version }}
3838

39-
- name: Install gotestsum
40-
run: go install gotest.tools/gotestsum@latest
41-
4239
- name: Create junit-xml directory
4340
run: mkdir junit-xml
4441

internal/cmd/build/main.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ func (b *builder) integrationTest() error {
122122
return fmt.Errorf("failed parsing flags: %w", err)
123123
}
124124

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

174178
// Run integration test
175-
args := []string{"gotestsum", "--junitfile", *junitFileFlag + "-integration-test.xml", "--", "-tags", "protolegacy", "-count", "1", "-race", "-v", "-timeout", "10m"}
179+
args := []string{
180+
gotestsum,
181+
"--junitfile", *junitFileFlag + "-integration-test.xml",
182+
"--",
183+
"-tags", "protolegacy", "-count", "1", "-race", "-v", "-timeout", "10m",
184+
}
176185
if *runFlag != "" {
177186
args = append(args, "-run", *runFlag)
178187
}
@@ -240,10 +249,14 @@ func (b *builder) unitTest() error {
240249
return fmt.Errorf("failed parsing flags: %w", err)
241250
}
242251

252+
gotestsum, err := b.getInstalledTool("gotest.tools/gotestsum")
253+
if err != nil {
254+
return fmt.Errorf("failed getting gotestsum: %w", err)
255+
}
243256
// Find every non ./test-prefixed package that has a test file
244257
testDirMap := map[string]struct{}{}
245258
var testDirs []string
246-
err := fs.WalkDir(os.DirFS(b.rootDir), ".", func(p string, d fs.DirEntry, err error) error {
259+
err = fs.WalkDir(os.DirFS(b.rootDir), ".", func(p string, d fs.DirEntry, err error) error {
247260
if !strings.HasPrefix(p, "test") && strings.HasSuffix(p, "_test.go") {
248261
dir := path.Dir(p)
249262
if _, ok := testDirMap[dir]; !ok {
@@ -270,8 +283,9 @@ func (b *builder) unitTest() error {
270283
for _, testDir := range testDirs {
271284
// Run unit test
272285
args := []string{
273-
"gotestsum",
274-
"--junitfile", *junitFileFlag + strings.ReplaceAll(testDir, "/", "-") + "unit-test.xml", "--",
286+
gotestsum,
287+
"--junitfile", *junitFileFlag + strings.ReplaceAll(testDir, "/", "-") + "unit-test.xml",
288+
"--",
275289
"-tags", "protolegacy", "-count", "1", "-race", "-v", "-timeout", "15m",
276290
}
277291
if *runFlag != "" {

0 commit comments

Comments
 (0)