Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
61 lines (49 loc) · 1.81 KB
/
Copy pathjustfile
File metadata and controls
61 lines (49 loc) · 1.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
# Build the project
build:
go build -o ../dist/easypost-go
# Clean the project
clean:
rm -rf dist
rm -f $(go env GOPATH)/bin/easypost-go
# Get test coverage and open it in a browser
coverage:
go clean -testcache
go test -coverprofile=cover.out ./...
bash -c 'statement_cov=$(go tool cover -func=cover.out | grep total: | awk "{print substr(\$NF, 1, length(\$NF)-1)}"); if [ $(echo "$statement_cov < 78.0" | bc) -eq 1 ]; then echo "Tests passed but statement coverage failed with coverage: $statement_cov"; exit 1; fi'
go tool cover -html=cover.out
# Initialize the examples submodule
init-examples-submodule:
git submodule init
git submodule update
# Install and vendor dependencies
install: init-examples-submodule
curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.15.0
curl -sSfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.30.0
go mod vendor
# Lint the project
golangci:
$(go env GOPATH)/bin/golangci-lint run --config examples/style_guides/golang/.golangci.yml
# Lint the project
lint: golangci scan
# Runs formatting tools against the project
lint-fix:
$(go env GOPATH)/bin/golangci-lint run --config examples/style_guides/golang/.golangci.yml --fix
# Cuts a release for the project on GitHub (requires GitHub CLI)
# tag = The associated tag title of the release
# target = Target branch or full commit SHA
release tag target:
gh release create {{tag}} --target {{target}}
# Run gosec to scan for security issues
scan:
$(go env GOPATH)/bin/gosec -tests --exclude-dir=examples ./...
# Test the project
test:
go clean -testcache
go test ./... -v
# Tidies up the vendor directory
tidy:
go mod tidy
# Update the examples submodule
update-examples-submodule:
git submodule init
git submodule update --remote