Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
109 lines (87 loc) · 3.84 KB
/
Copy pathJustfile
File metadata and controls
109 lines (87 loc) · 3.84 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
set shell := ["bash", "-euo", "pipefail", "-c"]
binary := "cuttle"
# Never in CI: a gate that repairs its own input can only ever pass.
fix := if env('CI', '') == '' { '--fix' } else { '' }
[private]
default:
@just --list --unsorted
# ── Code Quality ──────────────────────────────────────────
# Lint and format both: gofumpt and goimports are golangci-lint `formatters` here.
[group('quality')]
[working-directory('packages/cuttle')]
lint:
golangci-lint run {{ fix }} ./...
# Run vulnerability check
[group('quality')]
[working-directory('packages/cuttle')]
vuln:
govulncheck ./...
# ── Testing ───────────────────────────────────────────────
# Run all tests with race detection
[group('test')]
[working-directory('packages/cuttle')]
test *args="./...":
gotestsum --format testname -- -race {{ args }}
# Run tests with coverage
[group('test')]
[working-directory('packages/cuttle')]
test-cov:
gotestsum --format testname -- -race -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out
# ── Build ─────────────────────────────────────────────────
# Build the binary
[group('build')]
[working-directory('packages/cuttle')]
build:
go build -o {{ binary }} ./cmd/{{ binary }}
# Build optimized release binary
[group('build')]
[working-directory('packages/cuttle')]
build-release:
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o {{ binary }} ./cmd/{{ binary }}
# Build the container image for the host arch (amd64 -> Windows persona; on an
# Apple Silicon Mac -> arm64/macOS persona, native). CI builds+pushes both arches
# as one multi-arch manifest. BuildKit is required so the per-Dockerfile
# ops/docker/Dockerfile.dockerignore is honored (there is no root .dockerignore);
# classic builder would send the whole repo.
[group('build')]
build-image tag="cuttle:local":
DOCKER_BUILDKIT=1 docker build -f ops/docker/Dockerfile -t {{ tag }} .
# ── Dependencies ──────────────────────────────────────────
# Tidy and verify modules
[group('deps')]
[working-directory('packages/cuttle')]
tidy:
go mod tidy
go mod verify
# ── CI ────────────────────────────────────────────────────
# The gate, and the only one: the pre-commit hook and CI both run exactly this.
[group('ci')]
check: lint version-files patch-lint test
@echo "All checks passed"
# Both halves of a version-bearing file - annotation AND extra-files entry
[group('ci')]
version-files:
./ops/scripts/check-version-files.sh
# No zero-context insertion in the stealth series: git apply lands one at the end
# of the file and reports success (build-linux.sh stage 4 and CI run the same grep).
# Only grep's 1 (no match) passes: `! grep` would also pass its 2 (error).
[group('ci')]
patch-lint:
@rc=0; grep -nE '^@@ -[1-9][0-9]*,0 ' packages/browser/patches/0*.patch || rc=$?; test $rc -eq 1
# Regenerate the fingerprint parity golden snapshot from the Go primitives
[group('ci')]
[working-directory('packages/cuttle')]
parity-golden:
GOTOOLCHAIN=auto go test ./internal/fingerprint -run TestGolden -update
GOTOOLCHAIN=auto go test ./internal/serve -run TestFreshProfilePrefsSnapshot -update
# Validate the GoReleaser config (lives under ops/config, not repo root)
[group('ci')]
release-check:
goreleaser check --config ops/config/goreleaser.yaml
# Clean build artifacts
[group('ci')]
[working-directory('packages/cuttle')]
clean:
go clean
rm -f {{ binary }} coverage.out