2023-07-10 17:03:55 +08:00
|
|
|
IMG_TOOL?=podman
|
|
|
|
|
2022-06-08 19:04:47 +08:00
|
|
|
build:
|
|
|
|
mkdir -p bin
|
2023-03-08 17:32:53 +08:00
|
|
|
rm -rf bin/atest
|
|
|
|
go build -o bin/atest main.go
|
2023-07-07 08:21:53 +08:00
|
|
|
build-embed-ui:
|
|
|
|
cd console/atest-ui && npm i && npm run build-only
|
|
|
|
cp console/atest-ui/dist/index.html cmd/data/index.html
|
|
|
|
cp console/atest-ui/dist/assets/*.js cmd/data/index.js
|
|
|
|
cp console/atest-ui/dist/assets/*.css cmd/data/index.css
|
|
|
|
go build -ldflags "-w -s" -o bin/atest main.go
|
2023-07-11 13:40:01 +08:00
|
|
|
echo -n '' > cmd/data/index.html
|
|
|
|
echo -n '' > cmd/data/index.js
|
|
|
|
echo -n '' > cmd/data/index.css
|
2023-04-04 13:18:51 +08:00
|
|
|
goreleaser:
|
|
|
|
goreleaser build --rm-dist --snapshot
|
|
|
|
build-image:
|
2023-07-10 17:03:55 +08:00
|
|
|
${IMG_TOOL} build -t ghcr.io/linuxsuren/api-testing:master . --build-arg GOPROXY=https://goproxy.cn,direct
|
2023-04-04 14:13:16 +08:00
|
|
|
run-image:
|
2023-07-10 17:03:55 +08:00
|
|
|
docker run -p 7070:7070 -p 8080:8080 ghcr.io/linuxsuren/api-testing:master
|
2023-07-01 17:59:07 +08:00
|
|
|
run-server:
|
2023-07-11 13:40:01 +08:00
|
|
|
go run . server --local-storage 'sample/*.yaml' --console-path console/atest-ui/dist
|
2022-06-08 19:04:47 +08:00
|
|
|
copy: build
|
2023-03-12 15:08:28 +08:00
|
|
|
sudo cp bin/atest /usr/local/bin/
|
2023-05-30 13:48:41 +08:00
|
|
|
copy-restart: build
|
2023-04-15 21:47:50 +08:00
|
|
|
atest service stop
|
|
|
|
make copy
|
|
|
|
atest service restart
|
2023-07-10 17:03:55 +08:00
|
|
|
|
2023-03-05 11:32:27 +08:00
|
|
|
test:
|
2023-04-02 14:51:00 +08:00
|
|
|
go test ./... -cover -v -coverprofile=coverage.out
|
|
|
|
go tool cover -func=coverage.out
|
2023-06-07 22:59:47 +08:00
|
|
|
test-collector:
|
|
|
|
go test github.com/linuxsuren/api-testing/extensions/collector/./... -cover -v -coverprofile=collector-coverage.out
|
|
|
|
go tool cover -func=collector-coverage.out
|
2023-07-10 17:03:55 +08:00
|
|
|
test-store-orm:
|
|
|
|
go test github.com/linuxsuren/api-testing/extensions/store-orm/./... -cover -v -coverprofile=store-orm-coverage.out
|
|
|
|
go tool cover -func=store-orm-coverage.out
|
|
|
|
test-all: test test-collector test-store-orm
|
|
|
|
|
2023-04-04 13:18:51 +08:00
|
|
|
grpc:
|
|
|
|
protoc --go_out=. --go_opt=paths=source_relative \
|
|
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
|
|
|
pkg/server/server.proto
|
2023-07-10 17:03:55 +08:00
|
|
|
|
|
|
|
protoc --go_out=. --go_opt=paths=source_relative \
|
|
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
|
|
|
pkg/testing/remote/loader.proto
|
2023-06-26 08:47:24 +08:00
|
|
|
grpc-gw:
|
|
|
|
protoc -I . --grpc-gateway_out . \
|
|
|
|
--grpc-gateway_opt logtostderr=true \
|
|
|
|
--grpc-gateway_opt paths=source_relative \
|
|
|
|
--grpc-gateway_opt generate_unbound_methods=true \
|
|
|
|
pkg/server/server.proto
|
2023-04-04 13:18:51 +08:00
|
|
|
grpc-js:
|
|
|
|
protoc -I=pkg/server server.proto \
|
|
|
|
--js_out=import_style=commonjs:bin \
|
|
|
|
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:bin
|
2023-06-26 08:47:24 +08:00
|
|
|
# https://github.com/grpc/grpc-web
|
|
|
|
grpc-ts:
|
|
|
|
protoc -I=pkg/server server.proto \
|
|
|
|
--js_out=import_style=commonjs,binary:console/atest-ui/src \
|
|
|
|
--grpc-web_out=import_style=typescript,mode=grpcwebtext:console/atest-ui/src
|
2023-04-04 13:18:51 +08:00
|
|
|
grpc-java:
|
|
|
|
protoc --plugin=protoc-gen-grpc-java=/usr/local/bin/protoc-gen-grpc-java \
|
|
|
|
--grpc-java_out=bin --proto_path=pkg/server server.proto
|
|
|
|
install-tool:
|
|
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1
|
|
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
|
2023-06-26 08:47:24 +08:00
|
|
|
hd i protoc-gen-grpc-web
|
2023-07-01 17:59:07 +08:00
|
|
|
hd i protoc-gen-grpc-gateway
|