-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
90 lines (81 loc) · 2.69 KB
/
Taskfile.yml
File metadata and controls
90 lines (81 loc) · 2.69 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
version: '3'
includes:
platform:
taskfile: taskfile.{{OS}}.yml
optional: true
flatten: true
vars:
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo "dev"
LDFLAGS: >-
-s -w
-X main.version={{.VERSION}}
tasks:
build:
desc: Cross-compile for multiple platforms
cmds:
- mkdir -p dist
- for:
- { GOOS: darwin, GOARCH: amd64, SUFFIX: darwin-amd64 }
- { GOOS: darwin, GOARCH: arm64, SUFFIX: darwin-arm64 }
- { GOOS: linux, GOARCH: amd64, SUFFIX: linux-amd64 }
- { GOOS: linux, GOARCH: arm64, SUFFIX: linux-arm64 }
- { GOOS: windows, GOARCH: amd64, SUFFIX: windows-amd64.exe }
cmd: >-
docker run --rm
-v "$PWD":/app -w /app
-e CGO_ENABLED=0 -e GOOS={{.ITEM.GOOS}} -e GOARCH={{.ITEM.GOARCH}}
golang:1.26-alpine
go build -ldflags="{{.LDFLAGS}}"
-o dist/hourgit-{{.ITEM.SUFFIX}}
./cmd/hourgit
test:
desc: Run all tests
cmd: docker run --rm -v "$PWD":/app -w /app golang:1.26-alpine go test -v -count=1 ./...
lint:
desc: Run golangci-lint (format + static analysis)
cmd: docker run --rm -v "$PWD":/app -w /app golangci/golangci-lint:v2.10.1-alpine golangci-lint run ./...
docs:
desc: Generate static documentation from markdown
cmd: >-
docker run --rm
-v "$PWD":/app -w /app/tools/docgen
golang:1.26-alpine
go run . -docs /app/web/docs
sources:
- web/docs/**/*.md
- web/docs/_template.html
- web/docs/_docs.css
- tools/docgen/**/*.go
generates:
- web/docs/**/*.html
sitemap:
desc: Generate sitemap.xml from sidebar navigation
cmd: >-
docker run --rm
-v "$PWD":/app -w /app/tools/sitemap
golang:1.26-alpine
go run . -docs /app/web/docs -out /app/web/sitemap.xml
sources:
- web/docs/_sidebar.md
- tools/sitemap/**/*.go
generates:
- web/sitemap.xml
web:
desc: Build website (docs + sitemap)
deps: [docs, sitemap]
web:dev:
desc: Serve website locally with Apache (port 8080)
deps: [docs, sitemap]
vars:
WEB_VERSION:
sh: git describe --tags --abbrev=0 2>/dev/null || echo "dev"
cmds:
- find ./web -name '*.html' -exec sed -i '' 's/__VERSION__/{{.WEB_VERSION}}/g' {} +
- defer: find ./web -name '*.html' -exec sed -i '' 's/{{.WEB_VERSION}}/__VERSION__/g' {} +
- >-
docker run --rm -p 8080:80
-v "$PWD/web":/usr/local/apache2/htdocs/
-v "$PWD/web/httpd-dev.conf":/usr/local/apache2/conf/extra/dev.conf
httpd:alpine
sh -c "echo 'Include conf/extra/dev.conf' >> /usr/local/apache2/conf/httpd.conf && httpd-foreground"