Skip to content

Commit 6c80eb7

Browse files
authored
feat: Windows support (#57)
1 parent f7e0272 commit 6c80eb7

File tree

5 files changed

+60
-5
lines changed

5 files changed

+60
-5
lines changed

.github/workflows/test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
on: [push]
2+
name: Unit tests
3+
jobs:
4+
unit-testing:
5+
runs-on: windows-latest
6+
steps:
7+
- name: Install Go
8+
uses: actions/setup-go@v2
9+
with:
10+
go-version: 1.18.x
11+
- name: Check out repository code
12+
uses: actions/checkout@v2
13+
- name: Run tests
14+
run: |
15+
go get ./...
16+
go install gotest.tools/gotestsum@latest
17+
gotestsum --format short-verbose --packages="./..." -- -p 1

.goreleaser.yml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,59 @@
11
project_name: test-results
2+
23
before:
34
hooks:
45
- go generate ./...
6+
57
builds:
6-
- env:
7-
- CGO_ENABLED=0
8+
- id: non-windows-build
9+
env:
10+
- CGO_ENABLED=0
811
goos:
912
- linux
1013
- darwin
14+
goarch:
15+
- 386
16+
- amd64
17+
- arm
18+
- arm64
19+
- id: windows-build
20+
env:
21+
- CGO_ENABLED=0
22+
ldflags:
23+
- -s -w -X main.VERSION={{.Tag}}
24+
goos:
25+
- windows
26+
goarch:
27+
- 386
28+
- amd64
29+
- arm
30+
- arm64
31+
1132
archives:
12-
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
33+
- id: non-windows-archive
34+
builds:
35+
- non-windows-build
36+
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
1337
replacements:
1438
darwin: Darwin
1539
linux: Linux
1640
386: i386
1741
amd64: x86_64
42+
- id: windows-archive
43+
builds:
44+
- windows-build
45+
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
46+
replacements:
47+
386: i386
48+
amd64: x86_64
49+
windows: Windows
50+
1851
checksum:
1952
name_template: '{{ .ProjectName }}_checksums.txt'
53+
2054
snapshot:
2155
name_template: "{{ .Tag }}-next"
56+
2257
changelog:
2358
sort: asc
2459
filters:

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ test.watch:
2121
build:
2222
go build -o bin/test-results
2323

24+
build.windows:
25+
CGO_ENABLED=0 GOOS=windows go build -o bin/test-results
26+
2427
release.major:
2528
git fetch --tags
2629
latest=$$(git tag | sort --version-sort | tail -n 1); new=$$(echo $$latest | cut -c 2- | awk -F '.' '{ print "v" $$1+1 ".0.0" }'); echo $$new; git tag $$new; git push origin $$new

cmd/gen-pipeline-report.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var genPipelineReportCmd = &cobra.Command{
5353
}
5454

5555
if len(args) == 0 {
56-
dir, err = ioutil.TempDir("/tmp", "test-results")
56+
dir, err = ioutil.TempDir("", "test-results")
5757
if err != nil {
5858
logger.Error("Creating temporary directory failed %v", err)
5959
return err

pkg/cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func WriteToFile(data []byte, path string) (string, error) {
147147

148148
// WriteToTmpFile saves data to temporary file
149149
func WriteToTmpFile(data []byte) (string, error) {
150-
file, err := ioutil.TempFile("/tmp", "test-results")
150+
file, err := ioutil.TempFile("", "test-results")
151151

152152
if err != nil {
153153
logger.Error("Opening file %s: %v", file.Name(), err)

0 commit comments

Comments
 (0)