-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathJustfile
More file actions
73 lines (60 loc) · 1.64 KB
/
Justfile
File metadata and controls
73 lines (60 loc) · 1.64 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
# -*- Justfile -*-
coverage_file := "coverage.out"
# List the available justfile recipes.
[group('general')]
@default:
just --list --unsorted
# List the lines of code in the project.
[group('general')]
loc:
scc --remap-unknown "-*- Justfile -*-":"justfile"
# Format and vet Go code. Runs before tests.
[group('test')]
check:
go fmt ./...
go vet ./...
# Lint using golangci-lint
[group('test')]
lint:
golangci-lint run --config .golangci.yaml
# Run the unit tests.
[group('test')]
unit *FLAGS: check
go test ./... -cover -vet=off -race {{FLAGS}} -short
# Run the integration tests.
[group('test')]
int *FLAGS: check
go test ./... -cover -vet=off -race {{FLAGS}} -run Integration
# Run the end-to-end tests.
[group('test')]
e2e *FLAGS: check
go test ./... -cover -vet=off -race {{FLAGS}} -run E2E
# HTML report for unit (default), int, e2e, or all tests.
[group('test')]
cover test='unit': check
go test ./... -vet=off -coverprofile={{coverage_file}} \
{{ if test == 'all' { '' } \
else if test == 'int' { '-run Integration' } \
else if test == 'e2e' { '-run E2E' } \
else { '-short' } }}
go tool cover -html={{coverage_file}}
# List the outdated direct dependencies (slow to run).
[group('dependencies')]
outdated:
# (requires https://github.com/psampaz/go-mod-outdated).
go list -u -m -json all | go-mod-outdated -update -direct
# Update the given module to the latest version.
[group('dependencies')]
update mod:
go get -u {{mod}}
go mod tidy
# Update all modules.
[group('dependencies')]
updateall:
go get -u ./...
go mod tidy
# Run go mod tidy and verify.
[group('dependencies')]
tidy:
go mod tidy
go mod verify