-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
165 lines (136 loc) · 4.91 KB
/
justfile
File metadata and controls
165 lines (136 loc) · 4.91 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
# Docker image repository (override with DOCKER_REPO env var or `just --set DOCKER_REPO ...`)
DOCKER_REPO := env("DOCKER_REPO", "taskflow")
# Default: list available recipes
default:
@just --list
# Run all tests (unit + integration + QA smoke)
test *args:
go test -count=1 -race ./... {{args}}
./scripts/qa-test.sh
# Run unit and integration tests only (no QA smoke)
test-unit *args:
go test -count=1 -race ./... {{args}}
# Run tests with verbose output
test-v *args:
go test -v -count=1 -race ./... {{args}}
# Version from git (tag or short sha)
VERSION := `git describe --tags --always --dirty 2>/dev/null || echo dev`
LDFLAGS := "-X github.com/bricef/taskflow/internal/version.Version=" + VERSION
# Build all binaries
build:
go build -ldflags '{{LDFLAGS}}' -o taskflow-server ./cmd/taskflow-server
go build -ldflags '{{LDFLAGS}}' -o taskflow ./cmd/taskflow
go build -ldflags '{{LDFLAGS}}' -o taskflow-tui ./cmd/taskflow-tui
go build -ldflags '{{LDFLAGS}}' -o taskflow-mcp ./cmd/taskflow-mcp
# Format all Go files
fmt:
gofmt -w .
# Check formatting (fails if files need formatting)
fmt-check:
@test -z "$(gofmt -l .)" || (echo "Files need formatting:" && gofmt -l . && exit 1)
# Run go vet
vet:
go vet ./...
# Tidy module dependencies
tidy:
go mod tidy
# Run all checks (fmt, vet, test)
check: fmt-check vet test
# Run all checks with verbose test output
check-v: fmt-check vet test-v
# Run the server locally
run:
TASKFLOW_SEED_ADMIN_NAME=admin go run ./cmd/taskflow-server
# Build Docker image
docker-build:
docker build --build-arg VERSION={{VERSION}} -t taskflow .
# Build Docker image with BuildKit cache (used in CI)
docker-build-cached:
docker buildx build --load \
--build-arg VERSION={{VERSION}} \
--cache-from type=gha --cache-to type=gha,mode=max \
-t taskflow .
# Push Docker image to registry
docker-push tag="latest":
docker tag taskflow {{DOCKER_REPO}}:{{tag}}
docker push {{DOCKER_REPO}}:{{tag}}
# Run with Docker Compose
docker-up:
docker compose up -d
# Stop Docker Compose
docker-down:
docker compose down
# View Docker Compose logs
docker-logs:
docker compose logs -f
# Generate a test database with realistic content
seed:
go run ./cmd/taskflow-seed
# Run the server with the test database
run-test: seed
TASKFLOW_DB_PATH=./taskflow-test.db TASKFLOW_LISTEN_ADDR=:8374 go run ./cmd/taskflow-server
# Run the TUI against the test database
tui-test:
TASKFLOW_API_KEY=seed-admin-key-for-testing go run ./cmd/taskflow-tui
# Cross-compile release binaries for all platforms
dist:
#!/usr/bin/env bash
set -euo pipefail
rm -rf dist && mkdir -p dist/staging
platforms=(
"linux/amd64"
"linux/arm64"
"darwin/amd64"
"darwin/arm64"
)
for platform in "${platforms[@]}"; do
os="${platform%/*}"
arch="${platform#*/}"
dir="dist/staging/taskflow-${os}-${arch}"
mkdir -p "$dir"
echo "Building ${os}/${arch}..."
for bin in taskflow-server taskflow taskflow-tui taskflow-mcp; do
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" \
go build -ldflags '{{LDFLAGS}}' -o "${dir}/${bin}" "./cmd/${bin}"
done
tar -czf "dist/taskflow-${os}-${arch}.tar.gz" -C dist/staging "taskflow-${os}-${arch}"
done
rm -rf dist/staging
echo "Built $(ls dist/*.tar.gz | wc -l) archives in dist/"
# Tag and push a release (e.g. just release v0.1.2)
release tag:
#!/usr/bin/env bash
set -euo pipefail
if [[ ! "{{tag}}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: tag must be semver (e.g. v0.1.2)" >&2
exit 1
fi
if [ -n "$(git status --porcelain)" ]; then
echo "Error: working tree is dirty — commit or stash first" >&2
exit 1
fi
# Generate changelog entry from commits since the last tag,
# excluding previous changelog commits.
PREV=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
DATE=$(date +%Y-%m-%d)
ENTRY="## {{tag}} — ${DATE}"$'\n\n'
if [ -n "$PREV" ]; then
ENTRY+=$(git log --pretty=format:"- %s" "${PREV}..HEAD" --no-merges --grep="^Update CHANGELOG" --invert-grep)
else
ENTRY+=$(git log --pretty=format:"- %s" --no-merges --grep="^Update CHANGELOG" --invert-grep)
fi
ENTRY+=$'\n'
# Prepend to CHANGELOG.md (after the header).
HEADER=$(head -3 CHANGELOG.md)
BODY=$(tail -n +4 CHANGELOG.md)
printf '%s\n\n%s\n%s' "$HEADER" "$ENTRY" "$BODY" > CHANGELOG.md
git add CHANGELOG.md
git commit -m "Update CHANGELOG for {{tag}}"
echo "Tagging {{tag}}..."
git tag -a "{{tag}}" -m "Release {{tag}}"
echo "Pushing commits and tag to origin..."
git push origin main "{{tag}}"
echo "Done. CI will build and push docker.io/fractallambda/taskflow:{{tag}}"
# Clean build artifacts
clean:
rm -f taskflow taskflow-server taskflow-tui taskflow-mcp *.db *.db-wal *.db-shm seed-admin-key.txt