Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Windows support #57

Merged
merged 8 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on: [push]
name: Unit tests
jobs:
unit-testing:
runs-on: windows-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x
- name: Check out repository code
uses: actions/checkout@v2
- name: Run tests
run: |
go get ./...
go install gotest.tools/gotestsum@latest
gotestsum --format short-verbose --packages="./..." -- -p 1
41 changes: 38 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,59 @@
project_name: test-results

before:
hooks:
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
- id: non-windows-build
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- 386
- amd64
- arm
- arm64
- id: windows-build
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.VERSION={{.Tag}}
goos:
- windows
goarch:
- 386
- amd64
- arm
- arm64

archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
- id: non-windows-archive
builds:
- non-windows-build
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
darwin: Darwin
linux: Linux
386: i386
amd64: x86_64
- id: windows-archive
builds:
- windows-build
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
386: i386
amd64: x86_64
windows: Windows

checksum:
name_template: '{{ .ProjectName }}_checksums.txt'

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ test.watch:
build:
CGO_ENABLED=0 go build -o bin/test-results

build.windows:
CGO_ENABLED=0 GOOS=windows go build -o bin/test-results

release.major:
git fetch --tags
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
Expand Down
2 changes: 1 addition & 1 deletion cmd/gen-pipeline-report.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var genPipelineReportCmd = &cobra.Command{
}

if len(args) == 0 {
dir, err = ioutil.TempDir("/tmp", "test-results")
dir, err = ioutil.TempDir("", "test-results")
if err != nil {
logger.Error("Creating temporary directory failed %v", err)
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func WriteToFile(data []byte, path string) (string, error) {

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

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