File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 41
41
type : unit-test-run-time
42
42
command : go test -race -v ./... -count=1 -coverprofile=coverage.out
43
43
record : runtime
44
+ - name : Benchmark Test
45
+ uses : kevincobain2000/action-coveritup@v2
46
+ with :
47
+ type : allocs-per-op
48
+ command : go test -count 1 -bench=. ./... -benchmem|grep allocs|awk '{ print $(--NF)}'
49
+ record : score
50
+ metric : alloc
44
51
45
52
- name : Coverage
46
53
run : gocov convert coverage.out | gocov-xml > coverage.xml
Original file line number Diff line number Diff line change 27
27
![ build-time] ( https://coveritup.app/badge?org=kevincobain2000&repo=gobrew&type=build-time&branch=master )
28
28
![ go-binary-size] ( https://coveritup.app/badge?org=kevincobain2000&repo=gobrew&type=go-binary-size&branch=master )
29
29
![ unit-test-run-time] ( https://coveritup.app/badge?org=kevincobain2000&repo=gobrew&type=unit-test-run-time&branch=master )
30
+ ![ allocs-per-op] ( https://coveritup.app/badge?org=kevincobain2000&repo=gobrew&type=allocs-per-op&branch=master )
30
31
31
32
![ go-mod-dependencies] ( https://coveritup.app/badge?org=kevincobain2000&repo=gobrew&type=go-mod-dependencies&branch=master )
32
33
![ go-sec-issues] ( https://coveritup.app/badge?org=kevincobain2000&repo=gobrew&type=go-sec-issues&branch=master )
37
38
![ go-mod-dependencies] ( https://coveritup.app/chart?org=kevincobain2000&repo=gobrew&type=go-mod-dependencies&branch=master&output=svg&width=160&height=160 )
38
39
![ go-sec-issues] ( https://coveritup.app/chart?org=kevincobain2000&repo=gobrew&type=go-sec-issues&branch=master&output=svg&width=160&height=160&line=fill )
39
40
![ unit-test-run-time] ( https://coveritup.app/chart?org=kevincobain2000&repo=gobrew&type=unit-test-run-time&branch=master&output=svg&width=160&height=160 )
40
-
41
+ ![ allocs-per-op ] ( https://coveritup.app/chart?org=kevincobain2000&repo=gobrew&type=allocs-per-op&output=svg&width=160&height=160&branch=master )
41
42
42
43
43
44
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import (
11
11
"github.com/stretchr/testify/assert"
12
12
)
13
13
14
- func setupGobrew ( t * testing.T , ts * httptest.Server ) GoBrew {
14
+ func setupGobrew [ T testing.TB ]( t T , ts * httptest.Server ) GoBrew {
15
15
tags , _ := url .JoinPath (ts .URL , "golang-tags.json" )
16
16
versionURL , _ := url .JoinPath (ts .URL , "latest" )
17
17
config := Config {
@@ -25,6 +25,17 @@ func setupGobrew(t *testing.T, ts *httptest.Server) GoBrew {
25
25
return gb
26
26
}
27
27
28
+ func BenchmarkInstallGo (t * testing.B ) {
29
+ ts := httptest .NewServer (http .FileServer (http .Dir ("testdata" )))
30
+ gb := setupGobrew (t , ts )
31
+ defer ts .Close ()
32
+ for i := 0 ; i < t .N ; i ++ {
33
+ gb .Install ("1.9" )
34
+ exists := gb .existsVersion ("1.9" )
35
+ assert .Equal (t , true , exists )
36
+ }
37
+ }
38
+
28
39
func TestInstallAndExistVersion (t * testing.T ) {
29
40
t .Parallel ()
30
41
ts := httptest .NewServer (http .FileServer (http .Dir ("testdata" )))
You can’t perform that action at this time.
0 commit comments