forked from arduino/arduino-create-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
106 lines (96 loc) · 3.98 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
version: '3'
tasks:
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go-task/Taskfile.yml
go:build:
desc: Build the project, to use a specific version use `task build TAG_VERSION=x.x.x`
dir: "{{.DEFAULT_GO_MODULE_PATH}}"
cmds:
- go build -v -i {{default "" .ADDITIONAL_FLAGS}} -o {{default "arduino-create-agent" .APP_NAME}} -ldflags '-X main.version={{default .TAG_TEST .TAG_VERSION}} -X main.git_revision={{.COMMIT}} {{default "" .WIN_FLAGS}}'
vars:
COMMIT:
sh: git log -n 1 --format=%h
go:build-cli:
desc: Build the project without tray icon support
cmds:
- task: go:build
vars:
APP_NAME: arduino-create-agent_cli
ADDITIONAL_FLAGS: -tags cli
go:build-win:
desc: Build the project for win, to build 32bit `export GOARCH=386` and for 64 bit `export GOARCH=amd64` before `task build-win`
cmds:
- rsrc -arch {{.GOARCH}} -manifest manifest.xml # GOARCH shoud be either amd64 or 386
- task: go:build
vars:
APP_NAME: arduino-create-agent.exe
WIN_FLAGS: -H=windowsgui
- rm *.syso # rm file to avoid compilation problems on other platforms
go:build-win-cli:
desc: Build the project fow win without tray icon support
cmds:
- task: go:build
vars:
APP_NAME: arduino-create-agent_cli.exe
ADDITIONAL_FLAGS: -tags cli
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-task/Taskfile.yml
go:test:
desc: Run unit tests
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
cmds:
- |
go test \
-v \
-short \
-run '{{default ".*" .GO_TEST_REGEX}}' \
{{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} \
-coverprofile=coverage_unit.txt \
{{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-integration-task/Taskfile.yml
go:test-integration:
desc: Run integration tests
deps:
# - task: go:build # we build it in the CI and not in the task because _cli version is required and build procedure is different on win
- task: poetry:install-deps
cmds:
- poetry run pytest tests
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:install-deps:
desc: Install dependencies managed by Poetry
cmds:
- poetry install --no-root
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:update-deps:
desc: Update all dependencies managed by Poetry to their newest versions
cmds:
- poetry update
check:
desc: Check fmt and lint
cmds:
- go version
- go fmt {{ default .DEFAULT_TARGETS .TARGETS }}
- test -z $(go fmt {{ default .DEFAULT_TARGETS .TARGETS }})
- echo 'test ok'
- go vet {{ default .DEFAULT_TARGETS .TARGETS }}
- echo 'vet ok'
# FIXME: too many suggestions are failing the check, I'll fix these one in
# another PR.
# - "'{{.GOLINTBIN}}' {{.GOLINTFLAGS}} {{ default .DEFAULT_TARGETS .TARGETS }}"
# - task: i18n:check
# - task: python:check
# - task: docs:check
# - task: config:check
vars:
TAG_TEST: "0.0.0-dev"
GOARCH:
sh: go env GOARCH
# all modules of this project except for "gen/..." module
DEFAULT_TARGETS:
sh: echo `go list ./... | grep -v 'arduino-create-agent/gen/' | tr '\n' ' '`
DEFAULT_GO_MODULE_PATH: ./
DEFAULT_GO_PACKAGES:
sh: |
echo $(cd {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}} && go list ./... | tr '\n' ' ' || echo '"ERROR: Unable to discover Go packages"')
# check-lint vars
GOLINTBIN:
sh: go list -f {{"{{"}}".Target{{"}}"}}" golang.org/x/lint/golint
GOLINTFLAGS: "-min_confidence 0.8 -set_exit_status"