diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2020-04-02 13:10:28 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2020-04-02 13:10:28 +0300 |
commit | b594443c634101551d2aebe79e4c3fc222177502 (patch) | |
tree | 71604b428ae057e0447d840f96b92b90ccad435c | |
parent | 45ed32c5c0836ab104f94fa6c886eb5b8b203b22 (diff) | |
parent | 8ce07c1d3a05a837bc873a67f7d11b35a04dff62 (diff) |
Merge branch 'po-junit-reports' into 'master'
Add JUnit style test reports
See merge request gitlab-org/gitaly!2005
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .gitlab-ci.yml | 10 | ||||
-rw-r--r-- | _support/Makefile.template | 11 | ||||
-rw-r--r-- | _support/makegen.go | 3 |
4 files changed, 21 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore index 782c7958b..dcae30693 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ gitaly.pid /vendor /gitaly-*.gem /gitaly-blackbox +report-*.xml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 522c13448..09e6159b5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -79,6 +79,11 @@ danger-review: - git version - make test - echo 'make test-gitaly-remote TODO https://gitlab.com/gitlab-org/gitaly/issues/1706' + artifacts: + paths: + - report-${CI_JOB_NAME}.xml + reports: + junit: report-${CI_JOB_NAME}.xml verify: <<: *ruby_definition @@ -156,6 +161,11 @@ race: - go version - git version - make race-go + artifacts: + paths: + - report-${CI_JOB_NAME}.xml + reports: + junit: report-${CI_JOB_NAME}.xml cover: <<: *ruby_definition diff --git a/_support/Makefile.template b/_support/Makefile.template index 60f334e0e..7bbf2d4c1 100644 --- a/_support/Makefile.template +++ b/_support/Makefile.template @@ -122,8 +122,8 @@ prepare-tests: {{ .GitlabShellDir }}/config.yml {{ .TestRepo }} {{ .GitTestRepo test: test-go rspec rspec-gitlab-shell .PHONY: test-go -test-go: prepare-tests - @cd {{ .SourceDir }} && go test -tags "$(BUILD_TAGS)" -count=1 {{ join .AllPackages " " }} # count=1 bypasses go 1.10 test caching +test-go: prepare-tests {{ .GoJunitReport }} + @cd {{ .SourceDir }} && go test -v -tags "$(BUILD_TAGS)" -count=1 {{ join .AllPackages " " }} 2>&1 | {{ .GoJunitReport }} > report-${CI_JOB_NAME}.xml .PHONY: test-with-proxies test-with-proxies: prepare-tests @@ -137,8 +137,8 @@ test-with-praefect: build prepare-tests GITALY_TEST_PRAEFECT_BIN={{ .BuildDir }}/bin/praefect go test -tags "$(BUILD_TAGS)" -count=1 {{ join .AllPackages " " }} # count=1 bypasses go 1.10 test caching .PHONY: race-go -race-go: prepare-tests - @cd {{ .SourceDir }} && go test -tags "$(BUILD_TAGS)" -race {{ join .AllPackages " " }} +race-go: prepare-tests {{ .GoJunitReport }} + @cd {{ .SourceDir }} && go test -v -tags "$(BUILD_TAGS)" -race {{ join .AllPackages " " }} 2>&1 | {{ .GoJunitReport }} > report-${CI_JOB_NAME}.xml .PHONY: rspec rspec: assemble-go prepare-tests @@ -178,6 +178,9 @@ check-formatting: {{ .GitalyFmt }} {{ .GoImports }}: {{ .MakegenDep }} go get golang.org/x/tools/cmd/goimports@2538eef75904eff384a2551359968e40c207d9d2 +{{ .GoJunitReport }}: {{ .MakegenDep }} + go get github.com/jstemmer/go-junit-report@984a47ca6b0a7d704c4b589852051b4d7865aa17 + .PHONY: {{ .GitalyFmt }} {{ .GitalyFmt }}: @cd {{ .SourceDir }} && go build -o $@ ./internal/cmd/gitalyfmt diff --git a/_support/makegen.go b/_support/makegen.go index 870184741..d9e975bbe 100644 --- a/_support/makegen.go +++ b/_support/makegen.go @@ -78,6 +78,9 @@ func (gm *gitalyMake) GoLicenses() string { return "bin/go-licenses" } func (gm *gitalyMake) StaticCheck() string { return filepath.Join(gm.BuildDir(), "bin/staticcheck") } func (gm *gitalyMake) ProtoC() string { return filepath.Join(gm.BuildDir(), "protoc/bin/protoc") } func (gm *gitalyMake) ProtoCGenGo() string { return filepath.Join(gm.BuildDir(), "bin/protoc-gen-go") } +func (gm *gitalyMake) GoJunitReport() string { + return filepath.Join(gm.BuildDir(), "bin/go-junit-report") +} func (gm *gitalyMake) ProtoCGenGitaly() string { return filepath.Join(gm.BuildDir(), "bin/protoc-gen-gitaly") } |