-
Notifications
You must be signed in to change notification settings - Fork 460
/
Makefile
50 lines (36 loc) · 1.56 KB
/
Makefile
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
all: test bench vet lint check-api-clients check-gofmt ci-test
bench:
go test -race -bench . -run "Benchmark" ./form
build:
go build ./...
check-api-clients:
go run scripts/check_api_clients/main.go
check-gofmt:
scripts/gofmt.sh check
lint:
staticcheck
test:
go run scripts/test_with_stripe_mock/main.go -race ./...
ci-test: test bench check-api-clients
vet:
go vet ./...
coverage:
go run scripts/test_with_stripe_mock/main.go -covermode=count -coverprofile=combined.coverprofile ./...
coveralls:
go install github.com/mattn/goveralls@latest && $(HOME)/go/bin/goveralls -service=github -coverprofile=combined.coverprofile
clean:
find . -name \*.coverprofile -delete
MAJOR_VERSION := $(shell echo $(VERSION) | sed 's/\..*//')
update-version:
@echo "$(VERSION)" > VERSION
@perl -pi -e 's|const clientversion = "[.\d\-\w]+"|const clientversion = "$(VERSION)"|' stripe.go
@perl -pi -e 's|github.com/stripe/stripe-go/v\d+|github.com/stripe/stripe-go/v$(MAJOR_VERSION)|' README.md
$(MAKE) normalize-imports
codegen-format: normalize-imports
scripts/gofmt.sh
go install golang.org/x/tools/cmd/[email protected] && goimports -w example/generated_examples_test.go
CURRENT_MAJOR_VERSION := $(shell cat VERSION | sed 's/\..*//')
normalize-imports:
@perl -pi -e 's|github.com/stripe/stripe-go/v\d+|github.com/stripe/stripe-go/v$(CURRENT_MAJOR_VERSION)|' go.mod
@find . -name '*.go' -exec perl -pi -e 's|github.com/stripe/stripe-go/(v\d+\|\[MAJOR_VERSION\])|github.com/stripe/stripe-go/v$(CURRENT_MAJOR_VERSION)|' {} +
.PHONY: codegen-format update-version normalize-imports