-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
96 lines (79 loc) · 2.76 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
.PHONY: build proto testdata wasm test testpretty
# Supply PACKAGES arg to only run tests for one page e.g. PACKAGES=./traing
PACKAGES?=./...
# Supply RUN to only run some tests e.g. `RUN=TestMyFunction make test`
RUNARG=
ifdef RUN
# If running only some tests add -v for more verbose output
RUNARG=-run $(RUN) -v
endif
build:
export CGO_ENABLED=0 && go build -o ./bin/keel cmd/keel/main.go
proto:
nix-shell --command "protoc -I . \
--go_out=. \
--go_opt=paths=source_relative \
proto/schema.proto"
proto-tools:
PROTO_SRC_PATH=./ \
IMPORT_MAPPING="rpcutil/empty.proto=github.com/example/rpcutil" \
protoc \
--proto_path=tools/proto/ \
--proto_path=proto/ \
--go_opt=Mschema.proto=github.com/teamkeel/keel/proto \
--go_opt=Mtools.proto=tools/proto \
--twirp_out=Mtools.proto=tools/proto:tools/proto \
--go_out=./ \
tools.proto
test:
TZ=UTC go test $(PACKAGES) -count=1 $(RUNARG)
test-js:
cd ./packages/functions-runtime && pnpm run test
cd ./packages/testing-runtime && pnpm run test
cd ./packages/wasm && pnpm run test
lint:
export CGO_ENABLED=0 && golangci-lint run -c .golangci.yml
wasm:
mkdir -p ./packages/wasm/dist
GOOS=js GOARCH=wasm go build -o ./packages/wasm/dist/keel.wasm ./packages/wasm/lib/main.go
node ./packages/wasm/encodeWasm.js
prettier:
npx prettier --write './integration/**/*.{ts,json,yaml}'
npx prettier --write './packages/**/*.{ts,js,mjs}'
npx prettier --write './node/templates/**/*.{ts,js,mjs}'
npx prettier --write './packages/**/package.json'
npx prettier --write './schema/testdata/proto/**/*.json'
npx prettier --write './runtime/jsonschema/testdata/**/*.json'
npx prettier --write './runtime/openapi/testdata/**/*.json'
npx prettier --write './tools/testdata/**/*.json'
install:
go mod download
cd ./packages/functions-runtime && pnpm install
cd ./packages/testing-runtime && pnpm install
cd ./packages/wasm && pnpm install
cd ./packages/client-react && pnpm install
cd ./packages/client-react-query && pnpm install
setup-conventional-commits:
brew install pre-commit -q
pre-commit install --hook-type commit-msg
goreleaser:
rm -rf dist
goreleaser release --snapshot
# Generate the defualt private key used by the run and test commands
gen-pk:
go run ./util/privatekey/pkgen.go ./testing/testing/default.pem
rpc-api:
PROTO_SRC_PATH=./ \
IMPORT_MAPPING="rpcutil/empty.proto=github.com/example/rpcutil" \
protoc \
--proto_path=rpc/ \
--proto_path=proto/ \
--proto_path=tools/proto/ \
--go_opt=Mschema.proto=github.com/teamkeel/keel/proto \
--go_opt=Mrpc.proto=rpc/rpc \
--go_opt=Mtools.proto=github.com/teamkeel/keel/tools/proto \
--twirp_out=Mrpc.proto=rpc/rpc:rpc/rpc \
--go_out=./ \
rpc.proto
proto-tests:
nix-shell --command "cd ./schema && go run ./testdata/generate_testdata.go ./testdata/proto"