-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskfile.yml
More file actions
110 lines (96 loc) · 3.45 KB
/
Taskfile.yml
File metadata and controls
110 lines (96 loc) · 3.45 KB
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
107
108
109
110
version: "3"
tasks:
install:
cmds:
- cmd: go install github.com/go-swagger/go-swagger/cmd/swagger@latest
generate:
cmds:
- cmd: mkdir -p ./build
- cmd: go generate ./...
build-server:
dir: ../server
cmds:
- cmd: task build
- cmd: cp build/deweb-server{{.BIN_EXT}} ../plugin/build
vars:
BIN_EXT: '{{if eq .OS "windows"}}.exe{{end}}'
run:
cmds:
- cmd: ./build/deweb-plugin
build-frontend:
dir: home
cmds:
- cmd: npm run build
build-backend:
cmds:
- task: build:internal
vars:
APP_NAME: plugin
BIN_DIR: build
build:
cmds:
- task: build-frontend
- task: build-backend
build:internal:
build:
desc: Internal build task
internal: true
cmds:
- cmd: echo Building DeWeb {{.APP_NAME}} for {{.OS | default OS}}/{{.ARCH | default ARCH}}
silent: true
- cmd: 'echo Mode: {{if eq .PRODUCTION "true"}}Production{{else}}Development{{end}}'
silent: true
- cmd: 'echo Version: {{.VERSION | default "Development"}}'
silent: true
- cmd: go build {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/deweb-{{.APP_NAME}}{{.BIN_EXT}} ./main.go
vars:
# We need this check for nil and empty string because a simple check for empty string doesn't work as expected
VERSION_FLAG: '{{if ne .VERSION nil}}{{if ne .VERSION ""}}-X github.com/massalabs/deweb-plugin/int/config.Version=v{{.VERSION}}{{end}}{{end}}'
BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production {{end}}-ldflags="{{.VERSION_FLAG}}{{if eq .PRODUCTION "true"}} -w -s{{end}}"'
BIN_EXT: '{{if eq .OS "windows"}}.exe{{end}}'
env:
GOOS: "{{.OS | default OS}}"
GOARCH: "{{.ARCH | default ARCH}}"
PRODUCTION: '{{.PRODUCTION | default "false"}}'
VERSION: "{{.VERSION | default nil}}"
clean:
cmds:
- cmd: rm -rf build
install-plugin:
cmds:
- cmd: mkdir -p /usr/local/share/massastation/plugins/deweb-plugin
platforms: [linux, darwin]
- cmd: cp build/deweb-plugin /usr/local/share/massastation/plugins/deweb-plugin
platforms: [linux, darwin]
- cmd: cp build/deweb-server /usr/local/share/massastation/plugins/deweb-plugin
platforms: [linux, darwin]
- cmd: cp favicon.png /usr/local/share/massastation/plugins/deweb-plugin
platforms: [linux, darwin]
- cmd: cp manifest.json /usr/local/share/massastation/plugins/deweb-plugin
platforms: [linux, darwin]
- cmd: mkdir -p "C:/Program Files (x86)/MassaStation/plugins/deweb-plugin"
platforms: [windows]
- cmd: cp build/deweb-plugin.exe "C:/Program Files (x86)/MassaStation/plugins/deweb-plugin"
platforms: [windows]
- cmd: cp build/deweb-server.exe "C:/Program Files (x86)/MassaStation/plugins/deweb-plugin"
platforms: [windows]
- cmd: cp favicon.png "C:/Program Files (x86)/MassaStation/plugins/deweb-plugin"
platforms: [windows]
- cmd: cp manifest.json "C:/Program Files (x86)/MassaStation/plugins/deweb-plugin"
platforms: [windows]
test:
cmds:
- cmd: go test ./...
install:tools:
cmds:
- cmd: go install mvdan.cc/gofumpt@latest
- cmd: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
lint:
cmds:
- cmd: golangci-lint run
fmt:
cmds:
- cmd: go mod tidy
- cmd: gofumpt -l -w .
- cmd: gci write . --skip-generated
- cmd: golangci-lint run --fix