forked from http-wasm/http-wasm-host-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
55 lines (44 loc) · 1.37 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
51
52
53
54
55
gofumpt := mvdan.cc/[email protected]
gosimports := github.com/rinchsan/gosimports/cmd/[email protected]
golangci_lint := github.com/golangci/golangci-lint/cmd/[email protected]
.PHONY: testdata
testdata:
@$(MAKE) build.wat
wat_sources := $(wildcard examples/*.wat) $(wildcard internal/test/testdata/*/*.wat)
build.wat: $(wat_sources)
@for f in $^; do \
wasm=$$(echo $$f | sed -e 's/\.wat/\.wasm/'); \
wat2wasm -o $$wasm --debug-names $$f; \
done
.PHONY: test
test:
@go test -v ./...
.PHONY: bench
bench:
@(cd handler/nethttp; go test -run=NONE -bench=. .)
golangci_lint_path := $(shell go env GOPATH)/bin/golangci-lint
$(golangci_lint_path):
@go install $(golangci_lint)
.PHONY: lint
lint: $(golangci_lint_path)
@CGO_ENABLED=0 $(golangci_lint_path) run --timeout 5m
.PHONY: format
format:
@go run $(gofumpt) -l -w .
@go run $(gosimports) -local github.com/http-wasm/ -w $(shell find . -name '*.go' -type f)
.PHONY: check
check:
@$(MAKE) lint
@$(MAKE) format
@go mod tidy
@if [ ! -z "`git status -s`" ]; then \
echo "The following differences will fail CI until committed:"; \
git diff --exit-code; \
fi
.PHONY: clean
clean: ## Ensure a clean build
@go clean -testcache
# note: the guest wasm is stored in tck/, not tck/guest, so that go:embed can read it.
.PHONY: tck
tck:
@cd tck/guest && tinygo build -o ../tck.wasm -scheduler=none --no-debug -target=wasi .