Skip to content

Commit

Permalink
Fixes #16: Non-verbose logging (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Janos Bonic authored Dec 6, 2021
1 parent e42098d commit e504464
Show file tree
Hide file tree
Showing 14 changed files with 451 additions and 222 deletions.
41 changes: 23 additions & 18 deletions .gotestfmt/downloads.gotpl
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
{{- /*gotype: github.com/haveyoudebuggedit/gotestfmt/parser.Downloads*/ -}}
{{- /*gotype: github.com/haveyoudebuggedit/gotestfmt/v2/renderer.Downloads*/ -}}
{{- /*
This template contains the format for a package download.
*/ -}}
{{- $settings := .Settings -}}
{{- if .Packages -}}
{{- if .Failed -}}
{{ "\033" }}[0;31m❌
{{- else -}}
{{ "\033" }}[0;34mπŸ“₯
{{- end -}}
{{ " " }}Dependency downloads
{{- "\033" }}[0m{{ "\n" -}}

{{- range .Packages -}}
{{- " " -}}
{{- if or (not $settings.HideSuccessfulDownloads) .Failed -}}
{{- if .Failed -}}
{{ "\033" }}[0;31m❌
{{- else -}}
πŸ“¦
{{ "\033" }}[0;34mπŸ“₯
{{- end -}}
{{- " " -}}
{{- .Package }} {{ .Version -}}
{{- "\033" }}[0m
{{- "\n" -}}
{{ with .Reason -}}
{{- " " -}}{{ . -}}{{ "\n" -}}
{{ " " }}Dependency downloads
{{- "\033" }}[0m{{ "\n" -}}

{{- range .Packages -}}
{{- if or (not $settings.HideSuccessfulDownloads) .Failed -}}
{{- " " -}}
{{- if .Failed -}}
{{ "\033" }}[0;31m❌
{{- else -}}
πŸ“¦
{{- end -}}
{{- " " -}}
{{- .Package }} {{ .Version -}}
{{- "\033" }}[0m
{{- "\n" -}}
{{ with .Reason -}}
{{- " " -}}{{ . -}}{{ "\n" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
43 changes: 24 additions & 19 deletions .gotestfmt/github/downloads.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,35 @@
{{- /*
This template contains the format for a package download.
*/ -}}
{{- $settings := .Settings -}}
{{- if .Packages -}}
::group::
{{- if .Failed -}}
{{ "\033" }}[0;31m❌
{{- else -}}
{{ "\033" }}[0;34mπŸ“₯
{{- end -}}
{{ " " }}Dependency downloads
{{- "\033" }}[0m{{ "\n" -}}

{{- range .Packages -}}
{{- " " -}}
{{- if or (not .Settings.HideSuccessfulDownloads) .Failed -}}
::group::
{{- if .Failed -}}
{{ "\033" }}[0;31m❌
{{- else -}}
πŸ“¦
{{ "\033" }}[0;34mπŸ“₯
{{- end -}}
{{- " " -}}
{{- .Package }} {{ .Version -}}
{{- "\033" }}[0m
{{- "\n" -}}
{{ with .Reason -}}
{{- " " -}}{{ . -}}{{ "\n" -}}
{{ " " }}Dependency downloads
{{- "\033" }}[0m{{ "\n" -}}

{{- range .Packages -}}
{{- if or (not $settings.HideSuccessfulDownloads) .Failed -}}
{{- " " -}}
{{- if .Failed -}}
{{ "\033" }}[0;31m❌
{{- else -}}
πŸ“¦
{{- end -}}
{{- " " -}}
{{- .Package }} {{ .Version -}}
{{- "\033" }}[0m
{{- "\n" -}}
{{ with .Reason -}}
{{- " " -}}{{ . -}}{{ "\n" -}}
{{- end -}}
{{- end -}}
{{- end -}}
::endgroup::
{{- end -}}
::endgroup::
{{- end -}}
81 changes: 43 additions & 38 deletions .gotestfmt/github/package.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,49 @@
This template contains the format for an individual package. GitHub actions does not currently support nested groups so
we are creating a stylized header for each package.
*/ -}}
{{- if eq .Result "PASS" -}}
{{ "\033" }}[0;32m
{{- else if eq .Result "SKIP" -}}
{{ "\033" }}[0;33m
{{- else -}}
{{ "\033" }}[0;31m
{{- end -}}
πŸ“¦ {{ .Name }}{{ "\033" }}[0m{{- "\n" -}}
{{- with .Reason -}}
πŸ›‘ {{ . -}}{{- "\n" -}}
{{- end -}}
{{- with .Output -}}
{{- . -}}{{- "\n" -}}
{{- end -}}
{{- with .TestCases -}}
{{- range . -}}
::group::
{{- if eq .Result "PASS" -}}
{{ "\033" }}[0;32mβœ…
{{- else if eq .Result "SKIP" -}}
{{ "\033" }}[0;33m🚧
{{- else -}}
{{ "\033" }}[0;31m❌
{{- end -}}
{{ " " }}{{- .Name -}}
{{- "\033" -}}[0;37m ({{ .Duration -}}
{{- with .Coverage -}}
, coverage: {{ . }}%
{{- end -}})
{{- "\033" -}}[0m
{{- "\n" -}}
{{- $settings := .Settings -}}
{{- if and (or (not $settings.HideSuccessfulPackages) (ne .Result "PASS")) (or (not $settings.HideEmptyPackages) (ne .Result "SKIP") (ne (len .TestCases) 0)) -}}
{{- if eq .Result "PASS" -}}
{{ "\033" }}[0;32m
{{- else if eq .Result "SKIP" -}}
{{ "\033" }}[0;33m
{{- else -}}
{{ "\033" }}[0;31m
{{- end -}}
πŸ“¦ {{ .Name }}{{ "\033" }}[0m{{- "\n" -}}
{{- with .Reason -}}
{{- " " -}}πŸ›‘ {{ . -}}{{- "\n" -}}
{{- end -}}
{{- with .Output -}}
{{- . -}}{{- "\n" -}}
{{- end -}}
{{- with .TestCases -}}
{{- range . -}}
{{- if or (not $settings.HideSuccessfulTests) (ne .Result "PASS") -}}
::group::
{{- if eq .Result "PASS" -}}
{{ "\033" }}[0;32mβœ…
{{- else if eq .Result "SKIP" -}}
{{ "\033" }}[0;33m🚧
{{- else -}}
{{ "\033" }}[0;31m❌
{{- end -}}
{{ " " }}{{- .Name -}}
{{- "\033" -}}[0;37m ({{ .Duration -}}
{{- with .Coverage -}}
, coverage: {{ . }}%
{{- end -}})
{{- "\033" -}}[0m
{{- "\n" -}}

{{- with .Output -}}
{{- . -}}
{{- "\n" -}}
{{- end -}}
{{- with .Output -}}
{{- . -}}
{{- "\n" -}}
{{- end -}}

::endgroup::{{- "\n" -}}
::endgroup::{{- "\n" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- "\n" -}}
{{- "\n" -}}
{{- end -}}
43 changes: 24 additions & 19 deletions .gotestfmt/gitlab/downloads.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,35 @@
{{- /*
This template contains the format for a package download.
*/ -}}
{{- $settings := .Settings -}}
{{- if .Packages -}}
{{- "\033" }}[0Ksection_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:dependency_downloads{{ "\r\033" }}[0K{{- "\n" -}}
{{- if .Failed -}}
{{ "\033" }}[0;31m❌
{{- else -}}
{{ "\033" }}[0;34mπŸ“₯
{{- end -}}
{{ " " }}Dependency downloads
{{- "\033" }}[0m{{ "\n" -}}

{{- range .Packages -}}
{{- " " -}}
{{- if or (not .Settings.HideSuccessfulDownloads) .Failed -}}
{{- "\033" }}[0Ksection_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:dependency_downloads{{ "\r\033" }}[0K{{- "\n" -}}
{{- if .Failed -}}
{{ "\033" }}[0;31m❌
{{- else -}}
πŸ“¦
{{ "\033" }}[0;34mπŸ“₯
{{- end -}}
{{- " " -}}
{{- .Package }} {{ .Version -}}
{{- "\033" }}[0m
{{- "\n" -}}
{{ with .Reason -}}
{{- " " -}}{{ . -}}{{ "\n" -}}
{{ " " }}Dependency downloads
{{- "\033" }}[0m{{ "\n" -}}

{{- range .Packages -}}
{{- if or (not $settings.HideSuccessfulDownloads) .Failed -}}
{{- " " -}}
{{- if .Failed -}}
{{ "\033" }}[0;31m❌
{{- else -}}
πŸ“¦
{{- end -}}
{{- " " -}}
{{- .Package }} {{ .Version -}}
{{- "\033" }}[0m
{{- "\n" -}}
{{ with .Reason -}}
{{- " " -}}{{ . -}}{{ "\n" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- "\033" }}[0Ksection_start:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{ end }}:dependency_downloads{{ "\r\033" }}[0K{{- "\n" -}}
{{- end -}}
{{- "\033" }}[0Ksection_start:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{ end }}:dependency_downloads{{ "\r\033" }}[0K{{- "\n" -}}
{{- end -}}
77 changes: 41 additions & 36 deletions .gotestfmt/gitlab/package.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,47 @@
This template contains the format for an individual package. GitHub actions does not currently support nested groups so
we are creating a stylized header for each package.
*/ -}}
{{- "\033" }}[0Ksection_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}{{ "\r\033" }}[0K
{{- if eq .Result "PASS" -}}
{{- "\033" }}[0;32m
{{- else if eq .Result "SKIP" -}}
{{- "\033" }}[0;33m
{{- else -}}
{{- "\033" }}[0;31m
{{- end -}}
πŸ“¦ {{ .Name }}{{ "\033" }}[0m{{- "\n" -}}
{{- with .Reason }}
πŸ›‘ {{ . -}}{{- "\n" -}}
{{- end -}}
{{- with .Output -}}
{{- . -}}{{- "\n" -}}
{{- end -}}
{{- with .TestCases -}}
{{- range . -}}
{{- "\033[0K" }}section_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}[collapsed=true]{{- "\r\033[0K" -}}
{{- if eq .Result "PASS" -}}
{{- "\033[0;32m " }}βœ…
{{- else if eq .Result "SKIP" -}}
{{- "\033[0;33m " }}🚧
{{- else -}}
{{- "\033[0;31m " }}❌
{{- end -}}
{{- " " }}{{- .Name -}}
{{- with .Coverage -}}{{- " \033" -}}[0;37m (coverage: {{ . }}%){{- end -}}
{{- "\033" -}}[0m
{{- "\n" -}}
{{- $settings := .Settings -}}
{{- if and (or (not $settings.HideSuccessfulPackages) (ne .Result "PASS")) (or (not $settings.HideEmptyPackages) (ne .Result "SKIP") (ne (len .TestCases) 0)) -}}
{{- "\033" }}[0Ksection_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}{{ "\r\033" }}[0K
{{- if eq .Result "PASS" -}}
{{- "\033" }}[0;32m
{{- else if eq .Result "SKIP" -}}
{{- "\033" }}[0;33m
{{- else -}}
{{- "\033" }}[0;31m
{{- end -}}
πŸ“¦ {{ .Name }}{{ "\033" }}[0m{{- "\n" -}}
{{- with .Reason -}}
{{- " " -}}πŸ›‘ {{ . -}}{{- "\n" -}}
{{- end -}}
{{- with .Output -}}
{{- . -}}{{- "\n" -}}
{{- end -}}
{{- with .TestCases -}}
{{- range . -}}
{{- if or (not $settings.HideSuccessfulTests) (ne .Result "PASS") -}}
{{- "\033[0K" }}section_start:{{ with .StartTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}[collapsed=true]{{- "\r\033[0K" -}}
{{- if eq .Result "PASS" -}}
{{- "\033[0;32m " }}βœ…
{{- else if eq .Result "SKIP" -}}
{{- "\033[0;33m " }}🚧
{{- else -}}
{{- "\033[0;31m " }}❌
{{- end -}}
{{- " " }}{{- .Name -}}
{{- with .Coverage -}}{{- " \033" -}}[0;37m (coverage: {{ . }}%){{- end -}}
{{- "\033" -}}[0m
{{- "\n" -}}

{{- with .Output -}}
{{- . -}}
{{- "\n" -}}
{{- end -}}
{{- with .Output -}}
{{- . -}}
{{- "\n" -}}
{{- end -}}

{{- "\033[0K" }}section_end:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}{{ "\r\033[0K" }}{{- "\n" -}}
{{- "\033[0K" }}section_end:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{ end }}:{{ .ID }}{{ "\r\033[0K" }}{{- "\n" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- "\033[0K" }}section_end:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{end}}:{{ .ID }}{{ "\r\033[0K" }}{{- "\n" -}}
{{- "\033[0K" }}section_end:{{ with .EndTime }}{{ .Unix }}{{ else }}0{{end}}:{{ .ID }}{{ "\r\033[0K" }}{{- "\n" -}}
{{- end -}}
Loading

0 comments on commit e504464

Please sign in to comment.