Skip to content

Commit d743fd1

Browse files
authored
QUA-1062: Release test reporter for windows (#511)
1 parent a599269 commit d743fd1

File tree

230 files changed

+21667
-349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+21667
-349
lines changed

.circleci/config.yml

+31-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
version: 2
1+
version: 2.1
2+
3+
orbs:
4+
win: circleci/[email protected]
25

36
linux_image: &linux_image
47
docker:
58
- image: circleci/golang:1.15
69
working_directory: /go/src/github.com/codeclimate/test-reporter
7-
setup_remote_docker:
8-
docker_layer_caching: true
10+
steps:
11+
- setup_remote_docker:
12+
docker_layer_caching: true
913

1014
macos_image: &macos_image
1115
macos:
@@ -54,12 +58,36 @@ jobs:
5458
make build-darwin VERSION=head
5559
make publish-head
5660
61+
test_windows:
62+
executor: win/default
63+
steps:
64+
- checkout:
65+
path: ..\go\src\github.com\codeclimate\test-reporter
66+
- run:
67+
name: Install GVM
68+
command: |
69+
[Net.ServicePointManager]::SecurityProtocol = "tls12"
70+
Invoke-WebRequest -URI https://github.com/andrewkroh/gvm/releases/download/v0.5.0/gvm-windows-amd64.exe -Outfile gvm.exe
71+
- run:
72+
name: Install golang 1.15
73+
command: |
74+
.\gvm install 1.15
75+
.\gvm --format=powershell 1.15 | Invoke-Expression
76+
go version
77+
- run:
78+
name: Run Tests
79+
command: |
80+
.\gvm --format=powershell 1.15 | Invoke-Expression
81+
cd ..\go\src\github.com\codeclimate\test-reporter
82+
go test $(go list ./...)
83+
5784
workflows:
5885
version: 2
5986
build_deploy:
6087
jobs:
6188
- test_linux
6289
- test_macos
90+
- test_windows
6391
- release_head_linux:
6492
requires:
6593
- test_linux

Gopkg.lock

+73-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ build-docker-linux-cgo:
105105
$(MAKE) build-docker GOOS=linux GOARCH=amd64 CGO_ENABLED=1 \
106106
BUILD_TAGS="netcgo" BINARY_SUFFIX=-$(VERSION)-netcgo-linux-amd64
107107

108+
build-docker-windows:
109+
$(MAKE) build-docker GOOS=windows GOARCH=amd64 CGO_ENABLED=0
110+
108111
test-docker:
109112
$(DOCKER_RUN) \
110113
--env GOPATH=/ \
@@ -167,6 +170,9 @@ gen-linux-cgo-checksum:
167170
gen-darwin-checksum:
168171
$(call gen_signed_checksum,darwin-amd64)
169172

173+
gen-windows-checksum:
174+
$(call gen_signed_checksum,windows-amd64)
175+
170176
clean:
171177
sudo $(RM) -r ./artifacts
172178
$(RM) $(MAN_PAGES)
@@ -180,18 +186,22 @@ manual-release:
180186
$(MAKE) build-docker-linux
181187
$(MAKE) build-docker-linux-arm64
182188
$(MAKE) build-docker-linux-cgo
189+
$(MAKE) build-docker-windows
183190
$(MAKE) build-darwin
184191
$(MAKE) gen-linux-checksum
185192
$(MAKE) gen-linux-arm64-checksum
186193
$(MAKE) gen-linux-cgo-checksum
194+
$(MAKE) gen-windows-checksum
187195
$(MAKE) gen-darwin-checksum
188196
$(MAKE) build-docker-linux VERSION=latest
189197
$(MAKE) build-docker-linux-arm64 VERSION=latest
190198
$(MAKE) build-docker-linux-cgo VERSION=latest
199+
$(MAKE) build-docker-windows VERSION=latest
191200
$(MAKE) build-darwin VERSION=latest
192201
$(MAKE) gen-linux-checksum VERSION=latest
193202
$(MAKE) gen-linux-arm64-checksum VERSION=latest
194203
$(MAKE) gen-linux-cgo-checksum VERSION=latest
204+
$(MAKE) gen-windows-checksum VERSION=latest
195205
$(MAKE) gen-darwin-checksum VERSION=latest
196206
$(MAKE) publish-version
197207
$(MAKE) publish-latest

formatters/gocov/gocov.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (r Formatter) Format() (formatters.Report, error) {
5555

5656
gitHead, _ := env.GetHead()
5757
for _, p := range profiles {
58-
n := strings.TrimPrefix(p.FileName, basePackage+string(os.PathSeparator))
58+
n := strings.TrimPrefix(filepath.FromSlash(p.FileName), basePackage+string(os.PathSeparator))
5959
sf, err := formatters.NewSourceFile(n, gitHead)
6060
if err != nil {
6161
return rep, errors.WithStack(err)

formatters/gocov/gocov_test.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package gocov
33
import (
44
"testing"
55

6+
"path/filepath"
7+
68
"gopkg.in/src-d/go-git.v4/plumbing/object"
79

810
"github.com/codeclimate/test-reporter/env"
@@ -25,7 +27,8 @@ func Test_Parse(t *testing.T) {
2527

2628
r.Len(rep.SourceFiles, 4)
2729

28-
sf := rep.SourceFiles["github.com/codeclimate/test-reporter/formatters/source_file.go"]
30+
sf := rep.SourceFiles[filepath.FromSlash("github.com/codeclimate/test-reporter/formatters/source_file.go")]
31+
2932
r.InDelta(75.8, sf.CoveredPercent, 1)
3033
r.Len(sf.Coverage, 115)
3134
r.False(sf.Coverage[5].Valid)
@@ -51,14 +54,14 @@ func Test_Parse(t *testing.T) {
5154

5255
r := require.New(t)
5356

54-
f := &Formatter{Path: "./example/foobar_test.out"}
57+
f := &Formatter{Path: filepath.Join("example", "foobar_test.out")}
5558
rep, err := f.Format()
5659
r.NoError(err)
5760

5861
r.Len(rep.SourceFiles, 2)
5962

60-
sfFoo := rep.SourceFiles["example/foo/foo.go"]
61-
sfBar := rep.SourceFiles["example/bar/bar.go"]
63+
sfFoo := rep.SourceFiles[filepath.Join("example","foo","foo.go")]
64+
sfBar := rep.SourceFiles[filepath.Join("example","bar","bar.go")]
6265

6366
r.EqualValues(85, rep.CoveredPercent)
6467
r.EqualValues(100, sfFoo.CoveredPercent)

0 commit comments

Comments
 (0)