-
Notifications
You must be signed in to change notification settings - Fork 1
/
.justfile
56 lines (41 loc) · 1.72 KB
/
.justfile
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
alias tc := test-coverage
ext := if os_family() == "windows" { ".exe" } else { "" }
outPath := "./bin/go-semver-release"
# Default values overridden in CI
appVersion := "v0.0.0+local"
buildNumber := "local"
commitHash := "local"
importPath := "github.com/s0ders/go-semver-release/v6/"
ldFlags := "-X " + importPath + "cmd.cmdVersion=" + appVersion + " -X " + importPath + "cmd.buildNumber=" + buildNumber + " -X " + importPath + "cmd.buildCommitHash=" + commitHash + " -w -s"
tests:
go test -shuffle=on -tags testing -failfast -race -v -covermode=atomic ./...
test-coverage: clean-coverage
go test -coverprofile cover.out ./...
go tool cover -html cover.out -o cover.html
clean-coverage:
rm -f cover.out cover.html
test name:
go test -tags testing '-run=^{{name}}$' -race ./...
build: clean
go build -ldflags="{{ldFlags}}" -o {{outPath}}{{ext}} .
cross-platform-build: clean
GOARCH=amd64 GOOS=darwin go build -ldflags="{{ldFlags}}" -o {{outPath}}-amd64-darwin
GOARCH=arm64 GOOS=darwin go build -ldflags="{{ldFlags}}" -o {{outPath}}-arm64-darwin
GOARCH=amd64 GOOS=linux go build -ldflags="{{ldFlags}}" -o {{outPath}}-amd64-linux
GOARCH=arm64 GOOS=linux go build -ldflags="{{ldFlags}}" -o {{outPath}}-arm64-linux
GOARCH=amd64 GOOS=windows go build -ldflags="{{ldFlags}}" -o {{outPath}}-amd64-win.exe
clean:
rm -rf ./bin/*
lint:
golangci-lint run ./...
gocyclo -over 15 .
vuln:
@govulncheck ./...
docker-build:
docker build -f ./build/Dockerfile -t soders/go-semver-release:local .
action-lint:
@actionlint
install-tooling:
go install github.com/rhysd/actionlint/cmd/actionlint@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest