-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.dist.yaml
More file actions
198 lines (198 loc) · 5.78 KB
/
Taskfile.dist.yaml
File metadata and controls
198 lines (198 loc) · 5.78 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# Taskfile.dist.yaml
#
# Task is a task runner / build tool that aims to be simpler and easier to use than, for example, GNU Make.
# https://taskfile.dev/installation/
#
# To see all available tasks:
# $ task --list
#
version: '3'
vars:
BINNAME: dist/defacto2-server # build output, binary filename (without any extensions)
dotenv: ['./init/.env.local']
tasks:
_init:
silent: false
desc: 'Initialize this project for the first time after a git clone.'
cmds:
- cmd: go install github.com/goreleaser/goreleaser/v2@latest
- cmd: go install github.com/aarondl/sqlboiler/v4@latest
- cmd: go install github.com/aarondl/sqlboiler/v4/drivers/sqlboiler-psql@latest
- cmd: go mod tidy
assets:
desc: 'Build, compile and compress the web serve CSS and JS assets.'
cmds:
- echo "Building assets..."
- go run -modfile=runner/go.mod runner/runner.go
- echo "Done!"
aliases:
- 'js'
binary:
desc: 'Build the binary of the web server.'
deps: [assets]
cmds:
- cmd: echo "Building..."
- cmd: go build -o {{.BINNAME}} -v server.go
platforms: [linux, darwin, freebsd]
aliases:
- 'bin'
binaryr:
desc: 'Build the binary of the web server with race detection.'
deps: [assets]
cmds:
- cmd: echo "Building with race conditions..."
- cmd: go build -o {{.BINNAME}} -race -v server.go
platforms: [linux, darwin, freebsd]
- cmd: ./{{.BINNAME}} --version
platforms: [linux, darwin]
- cmd: echo "Done!"
aliases:
- 'race'
binary-run:
desc: 'Run the previously built binary.'
cmds:
- ./{{.BINNAME}}
platforms: [linux, darwin, freebsd]
aliases:
- 'run'
default:
desc: 'Task runner for the Defacto2 web server source code.'
cmds:
- task --list-all
silent: true
doc:
desc: 'Generate and browse the application module documentation.'
cmds:
- cmd: go tool pkgsite -http localhost:8090
silent: true
lint:
silent: false
desc: Runs the go formatter and lints the source code.
ignore_error: true
cmds:
- cmd: clear
platforms: [linux, darwin, freebsd]
- cmd: go tool gofumpt -l -w .
- cmd: go fix -diff ./...
- cmd: go fix ./...
- cmd: pnpm exec eslint assets/js/
- cmd: pnpm exec spectral lint public/json/openapi.json
- cmd: pnpm exec stylelint --fix assets/css/*.css
- cmd: golangci-lint run -c init/.golangci.yaml
linter:
silent: false
desc: Quickly lint the go source code.
ignore_error: true
cmds:
- cmd: clear
platforms: [linux, darwin, freebsd]
- cmd: golangci-lint run -c init/.golangci.yaml
nil:
desc: 'Run the static analysis techniques to catch Nil dereferences.'
cmds:
# ignore server/model package because the database uses nil values
# skip tests for performance
- go tool nilaway -test=false -exclude-pkgs=github.com/Defacto2/server/model ./...
pkg-patch:
aliases:
- 'patch'
silent: false
desc: Update and apply patches to the web server dependencies.
cmds:
- cmd: go get -u=patch -x
- cmd: go mod verify
- cmd: go mod tidy
build-release:
aliases:
- 'br'
desc: 'Build the release package of the web server embeded with the git version tag.'
deps: [assets]
cmds:
- cmd: echo "Git status results:"
- cmd: git status
- cmd: echo "Building snapshot..."
- cmd: goreleaser build --clean --config init/.goreleaser.yaml
- cmd: echo "Done!"
build-snapshot:
aliases:
- 'bs'
desc: 'Build the release package of the web server without a git version tag.'
deps: [assets]
cmds:
- cmd: echo "Building snapshot..."
- cmd: goreleaser build --snapshot --clean --config init/.goreleaser.yaml
- cmd: echo "Done!"
js-update:
desc: Update to the latest JavaScript dependencies.
cmds:
- cmd: pnpm up --interactive --latest
pkg-update:
aliases:
- 'update'
silent: false
desc: Update the web server dependencies.
cmds:
- cmd: go get -u -x
- cmd: go mod verify
- cmd: go mod tidy
serve-dev:
aliases:
- 'serve'
desc: 'Run the internal web server in development mode with live reload.'
cmds:
- task: serve-linux
serve-fix:
aliases:
- 'fix'
desc: 'Run the internal web server with the fix flag.'
cmds:
- cmd: go run server.go fix
serve-linux:
internal: true
platforms: [linux, freebsd, darwin]
env:
D2_PROD_MODE: false
PS_HOST: localhost
deps: [assets]
cmds:
- go tool air -c init/.air.toml
serve-prod:
aliases:
- 'server'
desc: 'Run the internal web server with live reload.'
cmds:
- task: serve-air-prod
serve-air-prod:
internal: true
platforms: [darwin, linux, freebsd]
env:
D2_PROD_MODE: true
cmds:
- go tool air -c init/.air.toml
spell:
desc: 'Run the spell checker on the markdown tidbits.'
cmds:
- cmd: clear
platforms: [linux, darwin, freebsd]
- cmd: find public/md/tidbit/ -name "*.md" | xargs pnpm exec mdspell --report --ignore-numbers --ignore-acronyms --en-us
test:
desc: 'Run the test suite.'
cmds:
#- set -o pipefail && go test ./... -json | tparse -all
- go test -count 1 ./...
testr:
desc: 'Run the test suite with the slower race detection.'
cmds:
#- set -o pipefail && go test ./... -json | tparse -all
- go test -count 1 -race ./...
ver:
silent: false
desc: Print the versions of the build and compiler tools.
ignore_error: true
cmds:
- cmd: go version
- cmd: go tool gofumpt --version
- cmd: task --version
- cmd: golangci-lint --version
- cmd: goreleaser --version
- cmd: go tool air -v