Skip to content

Commit e504464

Browse files
author
Janos Bonic
authored
Fixes #16: Non-verbose logging (#17)
1 parent e42098d commit e504464

File tree

14 files changed

+451
-222
lines changed

14 files changed

+451
-222
lines changed

.gotestfmt/downloads.gotpl

+23-18
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
{{- /*gotype: github.com/haveyoudebuggedit/gotestfmt/parser.Downloads*/ -}}
1+
{{- /*gotype: github.com/haveyoudebuggedit/gotestfmt/v2/renderer.Downloads*/ -}}
22
{{- /*
33
This template contains the format for a package download.
44
*/ -}}
5+
{{- $settings := .Settings -}}
56
{{- if .Packages -}}
6-
{{- if .Failed -}}
7-
{{ "\033" }}[0;31m❌
8-
{{- else -}}
9-
{{ "\033" }}[0;34m📥
10-
{{- end -}}
11-
{{ " " }}Dependency downloads
12-
{{- "\033" }}[0m{{ "\n" -}}
13-
14-
{{- range .Packages -}}
15-
{{- " " -}}
7+
{{- if or (not $settings.HideSuccessfulDownloads) .Failed -}}
168
{{- if .Failed -}}
179
{{ "\033" }}[0;31m❌
1810
{{- else -}}
19-
📦
11+
{{ "\033" }}[0;34m📥
2012
{{- end -}}
21-
{{- " " -}}
22-
{{- .Package }} {{ .Version -}}
23-
{{- "\033" }}[0m
24-
{{- "\n" -}}
25-
{{ with .Reason -}}
26-
{{- " " -}}{{ . -}}{{ "\n" -}}
13+
{{ " " }}Dependency downloads
14+
{{- "\033" }}[0m{{ "\n" -}}
15+
16+
{{- range .Packages -}}
17+
{{- if or (not $settings.HideSuccessfulDownloads) .Failed -}}
18+
{{- " " -}}
19+
{{- if .Failed -}}
20+
{{ "\033" }}[0;31m❌
21+
{{- else -}}
22+
📦
23+
{{- end -}}
24+
{{- " " -}}
25+
{{- .Package }} {{ .Version -}}
26+
{{- "\033" }}[0m
27+
{{- "\n" -}}
28+
{{ with .Reason -}}
29+
{{- " " -}}{{ . -}}{{ "\n" -}}
30+
{{- end -}}
31+
{{- end -}}
2732
{{- end -}}
2833
{{- end -}}
2934
{{- end -}}

.gotestfmt/github/downloads.gotpl

+24-19
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@
22
{{- /*
33
This template contains the format for a package download.
44
*/ -}}
5+
{{- $settings := .Settings -}}
56
{{- if .Packages -}}
6-
::group::
7-
{{- if .Failed -}}
8-
{{ "\033" }}[0;31m❌
9-
{{- else -}}
10-
{{ "\033" }}[0;34m📥
11-
{{- end -}}
12-
{{ " " }}Dependency downloads
13-
{{- "\033" }}[0m{{ "\n" -}}
14-
15-
{{- range .Packages -}}
16-
{{- " " -}}
7+
{{- if or (not .Settings.HideSuccessfulDownloads) .Failed -}}
8+
::group::
179
{{- if .Failed -}}
1810
{{ "\033" }}[0;31m❌
1911
{{- else -}}
20-
📦
12+
{{ "\033" }}[0;34m📥
2113
{{- end -}}
22-
{{- " " -}}
23-
{{- .Package }} {{ .Version -}}
24-
{{- "\033" }}[0m
25-
{{- "\n" -}}
26-
{{ with .Reason -}}
27-
{{- " " -}}{{ . -}}{{ "\n" -}}
14+
{{ " " }}Dependency downloads
15+
{{- "\033" }}[0m{{ "\n" -}}
16+
17+
{{- range .Packages -}}
18+
{{- if or (not $settings.HideSuccessfulDownloads) .Failed -}}
19+
{{- " " -}}
20+
{{- if .Failed -}}
21+
{{ "\033" }}[0;31m❌
22+
{{- else -}}
23+
📦
24+
{{- end -}}
25+
{{- " " -}}
26+
{{- .Package }} {{ .Version -}}
27+
{{- "\033" }}[0m
28+
{{- "\n" -}}
29+
{{ with .Reason -}}
30+
{{- " " -}}{{ . -}}{{ "\n" -}}
31+
{{- end -}}
32+
{{- end -}}
2833
{{- end -}}
34+
::endgroup::
2935
{{- end -}}
30-
::endgroup::
3136
{{- end -}}

.gotestfmt/github/package.gotpl

+43-38
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,49 @@
33
This template contains the format for an individual package. GitHub actions does not currently support nested groups so
44
we are creating a stylized header for each package.
55
*/ -}}
6-
{{- if eq .Result "PASS" -}}
7-
{{ "\033" }}[0;32m
8-
{{- else if eq .Result "SKIP" -}}
9-
{{ "\033" }}[0;33m
10-
{{- else -}}
11-
{{ "\033" }}[0;31m
12-
{{- end -}}
13-
📦 {{ .Name }}{{ "\033" }}[0m{{- "\n" -}}
14-
{{- with .Reason -}}
15-
🛑 {{ . -}}{{- "\n" -}}
16-
{{- end -}}
17-
{{- with .Output -}}
18-
{{- . -}}{{- "\n" -}}
19-
{{- end -}}
20-
{{- with .TestCases -}}
21-
{{- range . -}}
22-
::group::
23-
{{- if eq .Result "PASS" -}}
24-
{{ "\033" }}[0;32m✅
25-
{{- else if eq .Result "SKIP" -}}
26-
{{ "\033" }}[0;33m🚧
27-
{{- else -}}
28-
{{ "\033" }}[0;31m❌
29-
{{- end -}}
30-
{{ " " }}{{- .Name -}}
31-
{{- "\033" -}}[0;37m ({{ .Duration -}}
32-
{{- with .Coverage -}}
33-
, coverage: {{ . }}%
34-
{{- end -}})
35-
{{- "\033" -}}[0m
36-
{{- "\n" -}}
6+
{{- $settings := .Settings -}}
7+
{{- if and (or (not $settings.HideSuccessfulPackages) (ne .Result "PASS")) (or (not $settings.HideEmptyPackages) (ne .Result "SKIP") (ne (len .TestCases) 0)) -}}
8+
{{- if eq .Result "PASS" -}}
9+
{{ "\033" }}[0;32m
10+
{{- else if eq .Result "SKIP" -}}
11+
{{ "\033" }}[0;33m
12+
{{- else -}}
13+
{{ "\033" }}[0;31m
14+
{{- end -}}
15+
📦 {{ .Name }}{{ "\033" }}[0m{{- "\n" -}}
16+
{{- with .Reason -}}
17+
{{- " " -}}🛑 {{ . -}}{{- "\n" -}}
18+
{{- end -}}
19+
{{- with .Output -}}
20+
{{- . -}}{{- "\n" -}}
21+
{{- end -}}
22+
{{- with .TestCases -}}
23+
{{- range . -}}
24+
{{- if or (not $settings.HideSuccessfulTests) (ne .Result "PASS") -}}
25+
::group::
26+
{{- if eq .Result "PASS" -}}
27+
{{ "\033" }}[0;32m✅
28+
{{- else if eq .Result "SKIP" -}}
29+
{{ "\033" }}[0;33m🚧
30+
{{- else -}}
31+
{{ "\033" }}[0;31m❌
32+
{{- end -}}
33+
{{ " " }}{{- .Name -}}
34+
{{- "\033" -}}[0;37m ({{ .Duration -}}
35+
{{- with .Coverage -}}
36+
, coverage: {{ . }}%
37+
{{- end -}})
38+
{{- "\033" -}}[0m
39+
{{- "\n" -}}
3740

38-
{{- with .Output -}}
39-
{{- . -}}
40-
{{- "\n" -}}
41-
{{- end -}}
41+
{{- with .Output -}}
42+
{{- . -}}
43+
{{- "\n" -}}
44+
{{- end -}}
4245

43-
::endgroup::{{- "\n" -}}
46+
::endgroup::{{- "\n" -}}
47+
{{- end -}}
48+
{{- end -}}
4449
{{- end -}}
45-
{{- end -}}
46-
{{- "\n" -}}
50+
{{- "\n" -}}
51+
{{- end -}}

.gotestfmt/gitlab/downloads.gotpl

+24-19
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@
22
{{- /*
33
This template contains the format for a package download.
44
*/ -}}
5+
{{- $settings := .Settings -}}
56
{{- if .Packages -}}
6-
{{- "\033" }}[0Ksection_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:dependency_downloads{{ "\r\033" }}[0K{{- "\n" -}}
7-
{{- if .Failed -}}
8-
{{ "\033" }}[0;31m❌
9-
{{- else -}}
10-
{{ "\033" }}[0;34m📥
11-
{{- end -}}
12-
{{ " " }}Dependency downloads
13-
{{- "\033" }}[0m{{ "\n" -}}
14-
15-
{{- range .Packages -}}
16-
{{- " " -}}
7+
{{- if or (not .Settings.HideSuccessfulDownloads) .Failed -}}
8+
{{- "\033" }}[0Ksection_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:dependency_downloads{{ "\r\033" }}[0K{{- "\n" -}}
179
{{- if .Failed -}}
1810
{{ "\033" }}[0;31m❌
1911
{{- else -}}
20-
📦
12+
{{ "\033" }}[0;34m📥
2113
{{- end -}}
22-
{{- " " -}}
23-
{{- .Package }} {{ .Version -}}
24-
{{- "\033" }}[0m
25-
{{- "\n" -}}
26-
{{ with .Reason -}}
27-
{{- " " -}}{{ . -}}{{ "\n" -}}
14+
{{ " " }}Dependency downloads
15+
{{- "\033" }}[0m{{ "\n" -}}
16+
17+
{{- range .Packages -}}
18+
{{- if or (not $settings.HideSuccessfulDownloads) .Failed -}}
19+
{{- " " -}}
20+
{{- if .Failed -}}
21+
{{ "\033" }}[0;31m❌
22+
{{- else -}}
23+
📦
24+
{{- end -}}
25+
{{- " " -}}
26+
{{- .Package }} {{ .Version -}}
27+
{{- "\033" }}[0m
28+
{{- "\n" -}}
29+
{{ with .Reason -}}
30+
{{- " " -}}{{ . -}}{{ "\n" -}}
31+
{{- end -}}
32+
{{- end -}}
2833
{{- end -}}
34+
{{- "\033" }}[0Ksection_start:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{ end }}:dependency_downloads{{ "\r\033" }}[0K{{- "\n" -}}
2935
{{- end -}}
30-
{{- "\033" }}[0Ksection_start:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{ end }}:dependency_downloads{{ "\r\033" }}[0K{{- "\n" -}}
3136
{{- end -}}

.gotestfmt/gitlab/package.gotpl

+41-36
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,47 @@
33
This template contains the format for an individual package. GitHub actions does not currently support nested groups so
44
we are creating a stylized header for each package.
55
*/ -}}
6-
{{- "\033" }}[0Ksection_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}{{ "\r\033" }}[0K
7-
{{- if eq .Result "PASS" -}}
8-
{{- "\033" }}[0;32m
9-
{{- else if eq .Result "SKIP" -}}
10-
{{- "\033" }}[0;33m
11-
{{- else -}}
12-
{{- "\033" }}[0;31m
13-
{{- end -}}
14-
📦 {{ .Name }}{{ "\033" }}[0m{{- "\n" -}}
15-
{{- with .Reason }}
16-
🛑 {{ . -}}{{- "\n" -}}
17-
{{- end -}}
18-
{{- with .Output -}}
19-
{{- . -}}{{- "\n" -}}
20-
{{- end -}}
21-
{{- with .TestCases -}}
22-
{{- range . -}}
23-
{{- "\033[0K" }}section_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}[collapsed=true]{{- "\r\033[0K" -}}
24-
{{- if eq .Result "PASS" -}}
25-
{{- "\033[0;32m " }}✅
26-
{{- else if eq .Result "SKIP" -}}
27-
{{- "\033[0;33m " }}🚧
28-
{{- else -}}
29-
{{- "\033[0;31m " }}❌
30-
{{- end -}}
31-
{{- " " }}{{- .Name -}}
32-
{{- with .Coverage -}}{{- " \033" -}}[0;37m (coverage: {{ . }}%){{- end -}}
33-
{{- "\033" -}}[0m
34-
{{- "\n" -}}
6+
{{- $settings := .Settings -}}
7+
{{- if and (or (not $settings.HideSuccessfulPackages) (ne .Result "PASS")) (or (not $settings.HideEmptyPackages) (ne .Result "SKIP") (ne (len .TestCases) 0)) -}}
8+
{{- "\033" }}[0Ksection_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}{{ "\r\033" }}[0K
9+
{{- if eq .Result "PASS" -}}
10+
{{- "\033" }}[0;32m
11+
{{- else if eq .Result "SKIP" -}}
12+
{{- "\033" }}[0;33m
13+
{{- else -}}
14+
{{- "\033" }}[0;31m
15+
{{- end -}}
16+
📦 {{ .Name }}{{ "\033" }}[0m{{- "\n" -}}
17+
{{- with .Reason -}}
18+
{{- " " -}}🛑 {{ . -}}{{- "\n" -}}
19+
{{- end -}}
20+
{{- with .Output -}}
21+
{{- . -}}{{- "\n" -}}
22+
{{- end -}}
23+
{{- with .TestCases -}}
24+
{{- range . -}}
25+
{{- if or (not $settings.HideSuccessfulTests) (ne .Result "PASS") -}}
26+
{{- "\033[0K" }}section_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}[collapsed=true]{{- "\r\033[0K" -}}
27+
{{- if eq .Result "PASS" -}}
28+
{{- "\033[0;32m " }}✅
29+
{{- else if eq .Result "SKIP" -}}
30+
{{- "\033[0;33m " }}🚧
31+
{{- else -}}
32+
{{- "\033[0;31m " }}❌
33+
{{- end -}}
34+
{{- " " }}{{- .Name -}}
35+
{{- with .Coverage -}}{{- " \033" -}}[0;37m (coverage: {{ . }}%){{- end -}}
36+
{{- "\033" -}}[0m
37+
{{- "\n" -}}
3538

36-
{{- with .Output -}}
37-
{{- . -}}
38-
{{- "\n" -}}
39-
{{- end -}}
39+
{{- with .Output -}}
40+
{{- . -}}
41+
{{- "\n" -}}
42+
{{- end -}}
4043

41-
{{- "\033[0K" }}section_end:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}{{ "\r\033[0K" }}{{- "\n" -}}
44+
{{- "\033[0K" }}section_end:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}{{ "\r\033[0K" }}{{- "\n" -}}
45+
{{- end -}}
46+
{{- end -}}
4247
{{- end -}}
43-
{{- end -}}
44-
{{- "\033[0K" }}section_end:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{end}}:{{ .ID }}{{ "\r\033[0K" }}{{- "\n" -}}
48+
{{- "\033[0K" }}section_end:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{end}}:{{ .ID }}{{ "\r\033[0K" }}{{- "\n" -}}
49+
{{- end -}}

0 commit comments

Comments
 (0)