-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
132 lines (99 loc) · 4.81 KB
/
Copy pathjustfile
File metadata and controls
132 lines (99 loc) · 4.81 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
# wave-core justfile
# https://github.com/casey/just
set dotenv-load := false
set shell := ["bash", "-euxo", "pipefail", "-c"]
# project metadata
mod := "github.com/wave-cli/wave-core"
bin := "wave"
bin-dir := "/home/bouajila/bin"
bin-path := bin-dir + "/" + bin
version := `git describe --tags --always --dirty 2>/dev/null || echo "dev"`
commit := `git rev-parse --short HEAD 2>/dev/null || echo "none"`
date := `date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo "unknown"`
# ─── default ──────────────────────────────────────────────────────────
# list available recipes
default:
@just --list
# ─── build & run ──────────────────────────────────────────────────────
# build the wave binary
build:
go build -ldflags "-X {{mod}}/internal/version.version={{version}} -X {{mod}}/internal/version.commit={{commit}} -X {{mod}}/internal/version.date={{date}}" -o {{bin}} .
# run wave with arguments (e.g. just run version)
run *args:
go run -ldflags "-X {{mod}}/internal/version.version={{version}} -X {{mod}}/internal/version.commit={{commit}} -X {{mod}}/internal/version.date={{date}}" . {{args}}
# build and install to $GOPATH/bin
install:
go install -ldflags "-X {{mod}}/internal/version.version={{version}} -X {{mod}}/internal/version.commit={{commit}} -X {{mod}}/internal/version.date={{date}}" .
# remove build artifacts
clean:
rm -f {{bin}}
rm -f coverage.out coverage.html
rm -f testdata/plugins/echo/echo
# ─── test ─────────────────────────────────────────────────────────────
# run all tests
test:
go test ./...
# run tests with verbose output
test-v:
go test -v ./...
# run tests with coverage report
test-cover:
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
# open coverage report in browser
test-cover-html:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
xdg-open coverage.html 2>/dev/null || open coverage.html 2>/dev/null || echo "Open coverage.html in your browser"
# run only unit tests (skip e2e)
test-unit:
go test $(go list ./... | grep -v /e2e)
# run only e2e tests
test-e2e:
go test -v ./e2e/...
# run tests for a specific package (e.g. just test-pkg config)
test-pkg pkg:
go test -v ./internal/{{pkg}}/...
# ─── lint & format ───────────────────────────────────────────────────
# format all go files
fmt:
go fmt ./...
# vet all packages
vet:
go vet ./...
# run fmt + vet
lint: fmt vet
# ─── docs ─────────────────────────────────────────────────────────────
# open architecture doc
docs:
okular docs/architecture.md 2>/dev/null || xdg-open docs/architecture.md 2>/dev/null || open docs/architecture.md 2>/dev/null || less docs/architecture.md
# open testing guide
docs-testing:
okular docs/testing.md 2>/dev/null || xdg-open docs/testing.md 2>/dev/null || open docs/testing.md 2>/dev/null || less docs/testing.md
# open plugin authoring guide
docs-plugin:
okular docs/plugin-authoring.md 2>/dev/null || xdg-open docs/plugin-authoring.md 2>/dev/null || open docs/plugin-authoring.md 2>/dev/null || less docs/plugin-authoring.md
# open the project plan
docs-plan:
okular plan.md 2>/dev/null || xdg-open plan.md 2>/dev/null || open plan.md 2>/dev/null || less plan.md
# ─── deps ─────────────────────────────────────────────────────────────
# tidy go modules
tidy:
go mod tidy
# download dependencies
deps:
go mod download
# ─── dev helpers ──────────────────────────────────────────────────────
# build the echo test plugin
build-echo:
go build -o testdata/plugins/echo/echo ./testdata/plugins/echo/
# build wave binary (outputs to /home/bouajila/bin/wave)
bin:
#!/usr/bin/env bash
set -euo pipefail
mkdir -p {{bin-dir}}
go build -ldflags "-X {{mod}}/internal/version.version={{version}} -X {{mod}}/internal/version.commit={{commit}} -X {{mod}}/internal/version.date={{date}}" -o {{bin-path}} .
echo "Built {{bin-path}}"
# run the full ci pipeline locally (fmt, vet, test, build)
ci: lint test build
@echo "✓ CI passed"