Skip to content

Commit ee30982

Browse files
authored
build: faster gh actions workflow, no ubuntu on appveyor (#32829)
This PR does a few things: - Sets the gh actions runner sizes for lint (s) and test (l) workflows - Runs the tests on gh actions in parallel - Skips fetching the spec tests when unnecessary (on windows in appveyor) - Removes ubuntu appveyor runner since it's essentially duplicate of the gh action workflow now The gh test seems to go down from ~35min to ~13min.
1 parent 477ee58 commit ee30982

File tree

3 files changed

+21
-35
lines changed

3 files changed

+21
-35
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
lint:
1212
name: Lint
13-
runs-on: self-hosted-ghr
13+
runs-on: [self-hosted-ghr, size-s-x64]
1414
steps:
1515
- uses: actions/checkout@v4
1616
with:
@@ -37,7 +37,7 @@ jobs:
3737
test:
3838
name: Test
3939
needs: lint
40-
runs-on: self-hosted-ghr
40+
runs-on: [self-hosted-ghr, size-l-x64]
4141
strategy:
4242
matrix:
4343
go:
@@ -55,4 +55,4 @@ jobs:
5555
cache: false
5656

5757
- name: Run tests
58-
run: go run build/ci.go test
58+
run: go run build/ci.go test -p 8

appveyor.yml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ clone_depth: 5
22
version: "{branch}.{build}"
33

44
image:
5-
- Ubuntu
65
- Visual Studio 2019
76

87
environment:
@@ -17,25 +16,6 @@ install:
1716
- go version
1817

1918
for:
20-
# Linux has its own script without -arch and -cc.
21-
# The linux builder also runs lint.
22-
- matrix:
23-
only:
24-
- image: Ubuntu
25-
build_script:
26-
- go run build/ci.go lint
27-
- go run build/ci.go check_generate
28-
- go run build/ci.go check_baddeps
29-
- go run build/ci.go install -dlgo
30-
test_script:
31-
- go run build/ci.go test -dlgo -short
32-
33-
# linux/386 is disabled.
34-
- matrix:
35-
exclude:
36-
- image: Ubuntu
37-
GETH_ARCH: 386
38-
3919
# Windows builds for amd64 + 386.
4020
- matrix:
4121
only:
@@ -56,4 +36,4 @@ for:
5636
- go run build/ci.go archive -arch %GETH_ARCH% -type zip -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
5737
- go run build/ci.go nsis -arch %GETH_ARCH% -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
5838
test_script:
59-
- go run build/ci.go test -dlgo -arch %GETH_ARCH% -cc %GETH_CC% -short
39+
- go run build/ci.go test -dlgo -arch %GETH_ARCH% -cc %GETH_CC% -short -skip-spectests

build/ci.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -281,20 +281,26 @@ func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (
281281

282282
func doTest(cmdline []string) {
283283
var (
284-
dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
285-
arch = flag.String("arch", "", "Run tests for given architecture")
286-
cc = flag.String("cc", "", "Sets C compiler binary")
287-
coverage = flag.Bool("coverage", false, "Whether to record code coverage")
288-
verbose = flag.Bool("v", false, "Whether to log verbosely")
289-
race = flag.Bool("race", false, "Execute the race detector")
290-
short = flag.Bool("short", false, "Pass the 'short'-flag to go test")
291-
cachedir = flag.String("cachedir", "./build/cache", "directory for caching downloads")
284+
dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
285+
arch = flag.String("arch", "", "Run tests for given architecture")
286+
cc = flag.String("cc", "", "Sets C compiler binary")
287+
coverage = flag.Bool("coverage", false, "Whether to record code coverage")
288+
verbose = flag.Bool("v", false, "Whether to log verbosely")
289+
race = flag.Bool("race", false, "Execute the race detector")
290+
short = flag.Bool("short", false, "Pass the 'short'-flag to go test")
291+
cachedir = flag.String("cachedir", "./build/cache", "directory for caching downloads")
292+
skipspectests = flag.Bool("skip-spectests", false, "Skip downloading execution-spec-tests fixtures")
293+
threads = flag.Int("p", 1, "Number of CPU threads to use for testing")
292294
)
293295
flag.CommandLine.Parse(cmdline)
294296

295-
// Get test fixtures.
297+
// Load checksums file (needed for both spec tests and dlgo)
296298
csdb := download.MustLoadChecksums("build/checksums.txt")
297-
downloadSpecTestFixtures(csdb, *cachedir)
299+
300+
// Get test fixtures.
301+
if !*skipspectests {
302+
downloadSpecTestFixtures(csdb, *cachedir)
303+
}
298304

299305
// Configure the toolchain.
300306
tc := build.GoToolchain{GOARCH: *arch, CC: *cc}
@@ -315,7 +321,7 @@ func doTest(cmdline []string) {
315321

316322
// Test a single package at a time. CI builders are slow
317323
// and some tests run into timeouts under load.
318-
gotest.Args = append(gotest.Args, "-p", "1")
324+
gotest.Args = append(gotest.Args, "-p", fmt.Sprintf("%d", *threads))
319325
if *coverage {
320326
gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover")
321327
}

0 commit comments

Comments
 (0)