Skip to content

Commit

Permalink
ci: add gotestfmt templates
Browse files Browse the repository at this point in the history
  • Loading branch information
gbotrel committed Oct 12, 2023
1 parent 4fc5102 commit c7970a7
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .gotestfmt/downloads.gotpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- /*gotype: github.com/gotesttools/gotestfmt/v2/parser.Downloads*/ -}}
{{- /*
This template contains the format for a package download.
*/ -}}
{{- $settings := .Settings -}}
{{- if or .Packages .Reason -}}
{{- if or (not .Settings.HideSuccessfulDownloads) .Failed -}}
::group::
{{- 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 -}}
📦
{{- end -}}
{{- " " -}}
{{- .Package }} {{ .Version -}}
{{- "\033" }}[0m
{{- "\n" -}}
{{ with .Reason -}}
{{- " " -}}{{ . -}}{{ "\n" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- with .Reason -}}
{{- " " -}}{{- "\033" }}[0;31m🛑 {{ . }}{{- "\033" }}[0m{{ "\n" -}}
{{- end -}}
::endgroup::
{{- end -}}
{{- end -}}
42 changes: 42 additions & 0 deletions .gotestfmt/package.gotpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- /*gotype: github.com/gotesttools/gotestfmt/v2/parser.Package*/ -}}

{{- $settings := .Settings -}}
{{- if and (or (not $settings.HideSuccessfulPackages) (ne .Result "PASS")) (or (not $settings.HideEmptyPackages) (ne .Result "SKIP") (ne (len .TestCases) 0)) -}}
📦 `{{ .Name }}`
{{- with .Coverage -}}
({{ . }}% coverage)
{{- end -}}
{{- "\n" -}}
{{- with .Reason -}}
{{- " " -}}🛑 {{ . -}}{{- "\n" -}}
{{- end -}}
{{- with .Output -}}
```{{- "\n" -}}
{{- . -}}{{- "\n" -}}
```{{- "\n" -}}
{{- end -}}
{{- with .TestCases -}}
{{- range . -}}
{{- if or (not $settings.HideSuccessfulTests) (ne .Result "PASS") -}}
{{- if eq .Result "PASS" -}}
{{- else if eq .Result "SKIP" -}}
🚧
{{- else -}}
{{- end -}}
{{ " " }}`{{- .Name -}}` {{ .Duration -}}
{{- "\n" -}}

{{- with .Output -}}
```{{- "\n" -}}
{{- formatTestOutput . $settings -}}{{- "\n" -}}
```{{- "\n" -}}
{{- end -}}

{{- "\n" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- "\n" -}}
{{- end -}}

0 comments on commit c7970a7

Please sign in to comment.