diff --git a/src/.gotestfmt/github/package.gotpl b/src/.gotestfmt/github/package.gotpl new file mode 100644 index 000000000..aa42f10ae --- /dev/null +++ b/src/.gotestfmt/github/package.gotpl @@ -0,0 +1,56 @@ +{{- /*gotype: github.com/gotesttools/gotestfmt/v2/parser.Package*/ -}} +{{- /* +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. +*/ -}} +{{- $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 + {{- with .Coverage -}} + {{- "\033" -}}[0;37m ({{ . }}% coverage){{- "\033" -}}[0m + {{- end -}} + {{- " " -}}({{- .Duration -}}) + {{- "\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 ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}} + {{- with .Coverage -}} + , coverage: {{ . }}% + {{- end -}}) + {{- "\033" -}}[0m + {{- "\n" -}} + + {{- with .Output -}} + {{- formatTestOutput . $settings -}} + {{- "\n" -}} + {{- end -}} + + ::endgroup::{{- "\n" -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- "\n" -}} +{{- end -}}