Skip to content

Commit b037b93

Browse files
committed
github: Fix "no space left on device" issue in CI
1 parent 2680467 commit b037b93

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ jobs:
2424
name: Free Disk Space (Ubuntu)
2525
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
2626
with:
27-
# this might remove tools that are actually needed,
28-
# if set to "true" but frees about 6 GB
29-
tool-cache: false
27+
tool-cache: true
3028
android: true
3129
dotnet: true
3230
haskell: true

magefile.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ func flagEnv() map[string]string {
7070
}
7171
}
7272

73+
func emptyEnv() map[string]string {
74+
return map[string]string{}
75+
}
76+
7377
// Generate autogen packages
7478
func Generate() error {
7579
generatorPackages := []string{
@@ -138,6 +142,9 @@ func Docker() error {
138142
func Check() {
139143
if runtime.GOARCH == "amd64" && runtime.GOOS != "darwin" {
140144
mg.Deps(Test386)
145+
if isCI() {
146+
mg.Deps(CleanTest)
147+
}
141148
} else {
142149
fmt.Printf("Skip Test386 on %s and/or %s\n", runtime.GOARCH, runtime.GOOS)
143150
}
@@ -151,6 +158,9 @@ func Check() {
151158
// don't run two tests in parallel, they saturate the CPUs anyway, and running two
152159
// causes memory issues in CI.
153160
mg.Deps(TestRace)
161+
if isCI() {
162+
mg.Deps(CleanTest)
163+
}
154164
}
155165

156166
func testGoFlags() string {
@@ -161,6 +171,11 @@ func testGoFlags() string {
161171
return "-timeout=1m"
162172
}
163173

174+
// Clean Go's test cache.
175+
func CleanTest() error {
176+
return runCmd(emptyEnv(), goexe, "clean", "-testcache")
177+
}
178+
164179
// Run tests in 32-bit mode
165180
// Note that we don't run with the extended tag. Currently not supported in 32 bit.
166181
func Test386() error {

0 commit comments

Comments
 (0)