Skip to content

Commit 30dc75e

Browse files
committed
github: More disk space saving optimizations
1 parent 6bc8e6f commit 30dc75e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

‎magefile.go‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,27 @@ func Test() error {
188188
// Run tests with race detector
189189
func TestRace() error {
190190
env := map[string]string{"GOFLAGS": testGoFlags()}
191-
return runCmd(env, goexe, "test", "-p", "2", "-race", "./...", "-tags", buildTags())
191+
if isCI() {
192+
// We have space issues on GitHub Actions (lots tests, incresing usage of Go generics).
193+
// Test each package separately and clean up in between.
194+
pkgs, err := hugoPackages()
195+
if err != nil {
196+
return err
197+
}
198+
for _, pkg := range pkgs {
199+
if pkg == "." {
200+
continue
201+
}
202+
if err := runCmd(env, goexe, "test", "-p", "2", "-race", pkg, "-tags", buildTags()); err != nil {
203+
return err
204+
}
205+
mg.Deps(CleanTest, UninstallAll)
206+
}
207+
return nil
208+
209+
} else {
210+
return runCmd(env, goexe, "test", "-p", "2", "-race", "./...", "-tags", buildTags())
211+
}
192212
}
193213

194214
// Run gofmt linter

0 commit comments

Comments
 (0)