a geicko-2 based round robin ranking system designed to test c++ battleship submissions
battleship.dunkirk.sh
1.PHONY: build run clean test docker-build docker-run help
2
3# Build the battleship arena server
4build:
5 @echo "Building battleship-arena..."
6 @go build -o bin/battleship-arena ./cmd/battleship-arena
7
8# Run the server
9run: build
10 @echo "Starting battleship-arena..."
11 @./bin/battleship-arena
12
13# Clean build artifacts
14clean:
15 @echo "Cleaning..."
16 @rm -rf bin/
17 @rm -rf submissions/ .ssh/ *.db
18
19# Run tests
20test:
21 @echo "Running tests..."
22 @go test -v ./...
23
24# Generate SSH host key
25gen-key:
26 @echo "Generating SSH host key..."
27 @mkdir -p .ssh
28 @ssh-keygen -t ed25519 -f .ssh/battleship_arena -N ""
29
30# Format code
31fmt:
32 @echo "Formatting code..."
33 @go fmt ./...
34
35# Lint code
36lint:
37 @echo "Linting code..."
38 @golangci-lint run
39
40# Update dependencies
41deps:
42 @echo "Updating dependencies..."
43 @go mod tidy
44 @go mod download
45
46# Build for production (optimized)
47build-prod:
48 @echo "Building for production..."
49 @CGO_ENABLED=1 go build -ldflags="-s -w" -o bin/battleship-arena ./cmd/battleship-arena
50
51# Recalculate all Glicko-2 ratings from scratch
52recalculate-ratings: build
53 @echo "Recalculating all Glicko-2 ratings..."
54 @./bin/battleship-arena recalculate-ratings
55
56# Show help
57help:
58 @echo "Available targets:"
59 @echo " build - Build the server"
60 @echo " run - Build and run the server"
61 @echo " clean - Clean build artifacts"
62 @echo " test - Run tests"
63 @echo " gen-key - Generate SSH host key"
64 @echo " fmt - Format code"
65 @echo " lint - Lint code"
66 @echo " deps - Update dependencies"
67 @echo " build-prod - Build optimized production binary"
68 @echo " recalculate-ratings - Recalculate all Glicko-2 ratings from scratch"
69 @echo " help - Show this help"