-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
62 lines (55 loc) · 1.87 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# yaml-language-server: $schema=https://taskfile.dev/schema.json
# docs: https://taskfile.dev
#
# Windows:
# winget install Task.Task
#
# Linux:
# sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
# echo 'command -v task >/dev/null || export PATH="$PATH:$HOME/.local/bin"' >> ~/.profile
# source ~/.profile
#
# macOS:
# brew install go-task/tap/go-task
---
version: "3"
vars:
PWSH: pwsh -NonInteractive -NoProfile -NoLogo -Command
tasks:
test:
desc: Run tests
cmds:
- go clean -testcache
- '{{if eq .GITHUB_ACTIONS "true"}}gotestsum --format-hivis --format github-actions --junitfile "testresults.xml" -- ./... -p 4 -timeout 10m -coverprofile="coverage.out" -covermode atomic{{end}}'
- '{{if ne .GITHUB_ACTIONS "true"}}gotestsum --format-hivis --format pkgname-and-test-fails --junitfile "testresults.xml" -- ./... -p 4 -timeout 10m -coverprofile="coverage.out" -covermode atomic{{end}}'
- task: test:getcover
test:getcover:
desc: Get test coverage results
internal: true
cmds:
- gocov convert coverage.out > coverage.json
- gocov report coverage.json > coverage.txt
- cmd: |
{{ .PWSH }} 'Get-Content coverage.json | gocov-xml > coverage.xml'
platforms: [windows]
- cmd: gocov-xml < coverage.json > coverage.xml
platforms: [linux, darwin]
- go tool cover -html coverage.out -o coverage.html
test:tools:
desc: Install Test Tools
dir: "{{.goSdkOutput}}"
cmds:
- for: [gotestsum, gocov, gocov-xml]
task: install:{{.ITEM}}
install:gotestsum:
desc: Install GoTestSum
cmds:
- go install gotest.tools/gotestsum@latest
install:gocov:
desc: Install gocov
cmds:
- go install github.com/axw/gocov/gocov@latest
install:gocov-xml:
desc: Install gocov-xml
cmds:
- go install github.com/AlekSi/gocov-xml@latest