-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
132 lines (114 loc) · 3.21 KB
/
Taskfile.yml
File metadata and controls
132 lines (114 loc) · 3.21 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
version: "3"
vars:
CONFIGYML: ../data/butterfly.yml
tasks:
run:
desc: Run the binary
deps: [sqlc, templ, css, fmt, esbuild]
dir: "src"
cmds:
- go run . -config="{{.CONFIGYML}}"
build:
desc: Build a binary targeting the current OS
deps: [fmt, esbuild]
dir: "src"
cmds:
- |-
CGO_ENABLED=0 \
go build \
-trimpath \
-ldflags="-w -s -X 'butterfly.chimbori.dev/conf.BuildTimestamp=$(TZ=\":America/Los_Angeles\" date +\"%Y-%m-%d %H:%M:%S\")'"
test:
desc: Run all tests
dir: "src"
cmds:
- go test -count=1 ./...
testv:
desc: Run all tests, with verbose output
dir: "src"
cmds:
- go test -v -count=1 ./...
fmt:
desc: Reformat all source files, including templates
dir: "src"
cmds:
- go mod tidy
- gofumpt -l -w .
- goimports -l -w .
- golangci-lint fmt
lint:
desc: Lint sources
dir: "src"
cmds:
- golangci-lint run
sqlc:
desc: Regenerate SQLC-generated sources
dir: "src"
env:
CGO_CFLAGS: "-DHAVE_STRCHRNUL -mmacosx-version-min=15.4"
MACOSX_DEPLOYMENT_TARGET: "15.4"
cmds:
- sqlc generate
db:
desc: Runs PostgreSQL
cmds:
- cmd: podman machine start
ignore_error: true
- podman compose up --remove-orphans --build
drop:
desc: Drop all tables from the database to prepare for an import
cmds:
- echo "DROP SCHEMA PUBLIC CASCADE; CREATE SCHEMA PUBLIC;" | psql "postgresql://chimbori:chimbori@localhost:5432/butterfly"
import:
desc: Imports PostgreSQL from a local file
deps: [drop]
cmds:
- bunzip2 butterfly.sql.bz2 --stdout | psql "postgresql://chimbori:chimbori@localhost:5432/butterfly"
psql:
desc: Start pSQL to make raw queries to the database
cmds:
- psql "postgresql://chimbori:chimbori@localhost:5432/butterfly"
templ:
desc: Regenerate Templ templates
dir: "src"
cmds:
- templ generate
- templ fmt .
css:
desc: Regenerate CSS (minified & pretty-printed)
dir: "src"
cmds:
- tailwindcss --content "**/*.templ" --input embedfs/static/src.css --output embedfs/static/gen.css
- tailwindcss --content "**/*.templ" --input embedfs/static/src.css --output embedfs/static/gen.min.css --minify
esbuild:
desc: Bundle and minify JavaScript with esbuild
dir: "src"
cmds:
- esbuild dashboard/dashboard.js --bundle --minify --outfile=embedfs/static/dashboard.min.js --target=es2020
update:
desc: Update all dependencies
dir: "src"
deps: [fmt]
cmds:
- go get -u -t ./...
- go clean -modcache
- go mod tidy
- go fix ./...
install:
desc: Build and install the binary
deps: [fmt]
dir: "src"
cmds:
- go install .
setup:
desc: Setup pre-requisites on a new machine
dir: "src"
env:
CGO_CFLAGS: "-DHAVE_STRCHRNUL -mmacosx-version-min=15.4"
MACOSX_DEPLOYMENT_TARGET: "15.4"
cmds:
- brew install tailwindcss libpq esbuild
- brew link libpq --force
- go install github.com/a-h/templ/cmd/templ@latest
- go install golang.org/x/tools/cmd/goimports@latest
- go install mvdan.cc/gofumpt@latest