Skip to content

Commit 4846dc1

Browse files
committed
chore: migrate from Makefile to Taskfile
Replace Makefile with Taskfile.yml and update all references in CLAUDE.md, TEST.md, and readme.md to use task commands.
1 parent e526bbd commit 4846dc1

5 files changed

Lines changed: 137 additions & 113 deletions

File tree

CLAUDE.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
1414

1515
```bash
1616
# Testing (recommended workflow)
17-
make test-with-redis # Start Redis, run tests, cleanup automatically
18-
make redis # Start Redis via docker-compose
19-
make test # Run tests (requires Redis running)
20-
make redis-stop # Stop Redis service
17+
task test-with-redis # Start Redis, run tests, cleanup automatically
18+
task redis # Start Redis via docker-compose
19+
task test # Run tests (requires Redis running)
20+
task redis-stop # Stop Redis service
2121

2222
# Code quality
23-
make lint # Run golangci-lint + go mod tidy verification
24-
make all # Run lint + test-with-redis
23+
task lint # Run golangci-lint + go mod tidy verification
24+
task default # Run lint + test-with-redis
2525

2626
# Development
27-
make clean # Remove bin/ artifacts
27+
task clean # Remove bin/ artifacts
2828
go get -u all && go mod tidy # Update dependencies
2929
```
3030

@@ -227,8 +227,8 @@ Tests require Redis and live in `tests/` directory:
227227
Run tests:
228228

229229
```bash
230-
make test-with-redis # Recommended: automatic Redis setup/cleanup
231-
make redis && make test && make redis-stop # Manual Redis management
230+
task test-with-redis # Recommended: automatic Redis setup/cleanup
231+
task redis && task test && task redis-stop # Manual Redis management
232232
```
233233

234234
## Code Organization

Makefile

Lines changed: 0 additions & 94 deletions
This file was deleted.

TEST.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Use the automated test target that handles Redis setup and cleanup:
1717

1818
```bash
1919
# Start Redis, run tests, then cleanup automatically
20-
make test-with-redis
20+
task test-with-redis
2121
```
2222

2323
### Manual Method
@@ -26,13 +26,13 @@ For more control over the testing process:
2626

2727
```bash
2828
# Start Redis service
29-
make redis
29+
task redis
3030

3131
# Run all tests (requires Redis to be running)
32-
make test
32+
task test
3333

3434
# Stop Redis service when done
35-
make redis-stop
35+
task redis-stop
3636
```
3737

3838
### Direct Go Test Command
@@ -49,14 +49,14 @@ cd tests && go test -v
4949

5050
```bash
5151
# Start Redis service and wait for it to be ready
52-
make redis
52+
task redis
5353
```
5454

5555
### Stopping Redis
5656

5757
```bash
5858
# Stop and remove Redis containers
59-
make redis-stop
59+
task redis-stop
6060

6161
# Or use docker-compose directly for advanced options
6262
docker-compose down -v # Also removes data volumes

Taskfile.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
version: '3'
2+
3+
vars:
4+
PROJECT_ROOT:
5+
sh: pwd
6+
GOBIN: '{{.PROJECT_ROOT}}/bin'
7+
GOLANGCI_LINT_BINARY: '{{.GOBIN}}/golangci-lint'
8+
REQUIRED_GOLANGCI_LINT_VERSION:
9+
sh: cat .golangci.version 2>/dev/null || echo "2.9.0"
10+
GOLANGCI_LINT_VERSION:
11+
sh: '{{.GOLANGCI_LINT_BINARY}} version --format short 2>/dev/null || {{.GOLANGCI_LINT_BINARY}} version --short 2>/dev/null || echo "not-installed"'
12+
13+
env:
14+
GOBIN: '{{.GOBIN}}'
15+
16+
tasks:
17+
default:
18+
desc: Run lint and test with Redis
19+
cmds:
20+
- task: lint
21+
- task: test-with-redis
22+
23+
help:
24+
desc: Show this help message
25+
cmds:
26+
- echo "Available commands:"
27+
- echo " all - Run linting and tests with Redis"
28+
- echo " test - Run tests (requires Redis to be running)"
29+
- echo " test-with-redis - Start Redis, run tests, then cleanup"
30+
- echo " redis - Start Redis service"
31+
- echo " redis-stop - Stop Redis service"
32+
- echo " lint - Run linter"
33+
- echo " clean - Remove binary files"
34+
silent: true
35+
36+
clean:
37+
desc: Remove binary files
38+
cmds:
39+
- rm -rf {{.GOBIN}}
40+
41+
test:
42+
desc: Run tests (requires Redis to be running)
43+
cmds:
44+
- cd tests && go test -v -race
45+
46+
redis:
47+
desc: Start Redis service
48+
cmds:
49+
- |
50+
if redis-cli ping 2>/dev/null | grep -q PONG; then
51+
echo "✅ Redis is already running"
52+
else
53+
echo "🚀 Starting Redis service via Docker..."
54+
docker-compose up -d
55+
echo "⏳ Waiting for Redis service to be ready..."
56+
timeout=30
57+
counter=0
58+
until docker-compose exec redis redis-cli ping 2>/dev/null | grep -q PONG; do
59+
sleep 1
60+
counter=$((counter + 1))
61+
if [ $counter -gt $timeout ]; then
62+
echo "❌ Timeout waiting for Redis service"
63+
docker-compose down
64+
exit 1
65+
fi
66+
done
67+
echo "✅ Redis service is ready"
68+
fi
69+
70+
redis-stop:
71+
desc: Stop Redis service
72+
cmds:
73+
- echo "🧹 Stopping Redis service..."
74+
- docker-compose down
75+
76+
test-with-redis:
77+
desc: Start Redis, run tests, then cleanup
78+
deps:
79+
- redis
80+
cmds:
81+
- echo "🧪 Running tests..."
82+
- task: test
83+
- echo "✅ Tests completed!"
84+
85+
lint:
86+
desc: Run all linters
87+
deps:
88+
- golangci-lint
89+
- tidy-lint
90+
91+
install-golangci-lint:
92+
desc: Install golangci-lint with the required version
93+
cmds:
94+
- mkdir -p {{.GOBIN}}
95+
- |
96+
if [ "{{.GOLANGCI_LINT_VERSION}}" != "{{.REQUIRED_GOLANGCI_LINT_VERSION}}" ]; then
97+
echo "Installing golangci-lint v{{.REQUIRED_GOLANGCI_LINT_VERSION}} (current: {{.GOLANGCI_LINT_VERSION}})..."
98+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b {{.GOBIN}} v{{.REQUIRED_GOLANGCI_LINT_VERSION}}
99+
echo "golangci-lint v{{.REQUIRED_GOLANGCI_LINT_VERSION}} installed successfully"
100+
fi
101+
status:
102+
- test "{{.GOLANGCI_LINT_VERSION}}" = "{{.REQUIRED_GOLANGCI_LINT_VERSION}}"
103+
104+
golangci-lint:
105+
desc: Run golangci-lint
106+
deps:
107+
- install-golangci-lint
108+
cmds:
109+
- '{{.GOLANGCI_LINT_BINARY}} version'
110+
- echo "Running golangci-lint..."
111+
- '{{.GOLANGCI_LINT_BINARY}} run --timeout=10m --path-prefix .'
112+
113+
tidy-lint:
114+
desc: Check if go.mod and go.sum are tidy
115+
cmds:
116+
- echo "Checking go.mod and go.sum are tidy..."
117+
- go mod tidy
118+
- git diff --exit-code -- go.mod go.sum

readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ We provide convenient Make targets for testing with Redis:
165165

166166
```bash
167167
# Recommended: Run tests with automatic Redis setup and cleanup
168-
make test-with-redis
168+
task test-with-redis
169169

170170
# Or manually manage Redis and run tests
171-
make redis # Start Redis service
172-
make test # Run tests
173-
make redis-stop # Stop Redis service
171+
task redis # Start Redis service
172+
task test # Run tests
173+
task redis-stop # Stop Redis service
174174
```
175175

176176
For more detailed testing instructions, see [TEST.md](./TEST.md).

0 commit comments

Comments
 (0)