2023-07-10 17:03:55 +08:00
|
|
|
IMG_TOOL?=podman
|
2023-08-22 08:58:42 +08:00
|
|
|
BINARY?=atest
|
2023-09-26 07:29:10 +08:00
|
|
|
TOOLEXEC?=-toolexec="skywalking-go-agent"
|
2023-10-09 11:40:54 +08:00
|
|
|
GOPROXY?=https://goproxy.cn,direct
|
2023-10-19 17:36:44 +08:00
|
|
|
HELM_VERSION?=v0.0.2
|
2023-10-13 17:41:48 +08:00
|
|
|
APP_VERSION?=v0.0.13
|
2023-10-25 15:15:19 +08:00
|
|
|
HELM_REPORT?=docker.io/linuxsuren
|
2023-07-10 17:03:55 +08:00
|
|
|
|
2022-06-08 19:04:47 +08:00
|
|
|
build:
|
|
|
|
mkdir -p bin
|
2023-03-08 17:32:53 +08:00
|
|
|
rm -rf bin/atest
|
2023-09-26 07:29:10 +08:00
|
|
|
go build ${TOOLEXEC} -a -o bin/atest main.go
|
2023-09-11 09:11:44 +08:00
|
|
|
build-ext-git:
|
|
|
|
CGO_ENABLED=0 go build -ldflags "-w -s" -o bin/atest-store-git extensions/store-git/main.go
|
2023-10-23 15:59:22 +08:00
|
|
|
build-ext-orm:
|
|
|
|
CGO_ENABLED=0 go build -ldflags "-w -s" -o bin/atest-store-orm extensions/store-orm/main.go
|
2023-08-22 09:46:42 +08:00
|
|
|
embed-ui:
|
2023-07-07 08:21:53 +08:00
|
|
|
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
|
2023-08-22 09:46:42 +08:00
|
|
|
clean-embed-ui:
|
2023-08-26 13:35:31 +08:00
|
|
|
git checkout cmd/data/index.html
|
|
|
|
git checkout cmd/data/index.js
|
|
|
|
git checkout cmd/data/index.css
|
2023-08-22 09:46:42 +08:00
|
|
|
build-embed-ui: embed-ui
|
2023-09-26 07:29:10 +08:00
|
|
|
GOOS=${OS} go build ${TOOLEXEC} -a -ldflags "-w -s -X github.com/linuxsuren/api-testing/pkg/version.version=$(shell git rev-parse --short HEAD)" -o bin/${BINARY} main.go
|
2023-08-22 09:46:42 +08:00
|
|
|
make clean-embed-ui
|
2023-08-22 08:58:42 +08:00
|
|
|
build-win-embed-ui:
|
|
|
|
BINARY=atest.exe OS=windows make build-embed-ui
|
2023-04-04 13:18:51 +08:00
|
|
|
goreleaser:
|
|
|
|
goreleaser build --rm-dist --snapshot
|
2023-08-22 09:46:42 +08:00
|
|
|
make clean-embed-ui
|
2023-04-04 13:18:51 +08:00
|
|
|
build-image:
|
2023-07-21 18:47:11 +08:00
|
|
|
${IMG_TOOL} build -t ghcr.io/linuxsuren/api-testing:master . \
|
2023-10-09 11:40:54 +08:00
|
|
|
--build-arg GOPROXY=${GOPROXY} \
|
2023-07-21 18:47:11 +08:00
|
|
|
--build-arg VERSION=$(shell git describe --abbrev=0 --tags)-$(shell git rev-parse --short HEAD)
|
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
|
2023-07-16 21:10:03 +08:00
|
|
|
run-console:
|
|
|
|
cd console/atest-ui && npm run dev
|
|
|
|
copy:
|
2023-03-12 15:08:28 +08:00
|
|
|
sudo cp bin/atest /usr/local/bin/
|
2023-07-16 21:10:03 +08:00
|
|
|
copy-restart: build-embed-ui
|
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-10-13 17:41:48 +08:00
|
|
|
# helm
|
|
|
|
helm-package:
|
2023-10-13 21:24:47 +08:00
|
|
|
helm package helm/api-testing --version ${HELM_VERSION}-helm --app-version ${APP_VERSION} -d bin
|
2023-10-13 17:41:48 +08:00
|
|
|
helm-push:
|
2023-10-25 15:15:19 +08:00
|
|
|
helm push bin/api-testing-${HELM_VERSION}-helm.tgz oci://${HELM_REPO}
|
2023-10-13 17:41:48 +08:00
|
|
|
helm-lint:
|
|
|
|
helm lint helm/api-testing
|
|
|
|
|
2023-08-31 09:53:19 +08:00
|
|
|
# plugins
|
|
|
|
plugin-git:
|
|
|
|
GOOS=${OS} go build -ldflags "-w -s" -o bin/atest-store-git extensions/store-git/main.go
|
|
|
|
|
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-09-05 09:53:06 +08:00
|
|
|
testlong:
|
|
|
|
go test pkg/limit/limiter_long_test.go -v
|
2023-07-18 17:35:39 +08:00
|
|
|
test-ui:
|
|
|
|
cd console/atest-ui && npm run test:unit
|
|
|
|
test-e2e:
|
|
|
|
cd console/atest-ui && npm run test:e2e
|
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
|
2023-08-01 07:28:53 +08:00
|
|
|
test-store-s3:
|
|
|
|
go test github.com/linuxsuren/api-testing/extensions/store-s3/./... -cover -v -coverprofile=store-s3-coverage.out
|
|
|
|
go tool cover -func=store-s3-coverage.out
|
2023-08-15 10:18:08 +08:00
|
|
|
test-store-git:
|
|
|
|
go test github.com/linuxsuren/api-testing/extensions/store-git/./... -cover -v -coverprofile=store-git-coverage.out
|
|
|
|
go tool cover -func=store-git-coverage.out
|
2023-08-10 08:15:53 +08:00
|
|
|
test-operator:
|
|
|
|
cd operator && make test # converage file path: operator/cover.out
|
2023-08-15 10:18:08 +08:00
|
|
|
test-all-backend: test test-collector test-store-orm test-store-s3 test-store-git #test-operator
|
2023-07-18 17:35:39 +08:00
|
|
|
test-all: test-all-backend test-ui
|
2023-07-10 17:03:55 +08:00
|
|
|
|
2023-07-16 21:10:03 +08:00
|
|
|
install-precheck:
|
|
|
|
cp .github/pre-commit .git/hooks/pre-commit
|
|
|
|
|
2023-04-04 13:18:51 +08:00
|
|
|
grpc:
|
2023-07-29 22:14:58 +08:00
|
|
|
protoc --proto_path=. \
|
|
|
|
--go_out=. --go_opt=paths=source_relative \
|
2023-04-04 13:18:51 +08:00
|
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
2023-07-29 22:14:58 +08:00
|
|
|
pkg/server/server.proto \
|
|
|
|
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-08-12 08:02:59 +08:00
|
|
|
grpc-java:
|
|
|
|
protoc --plugin=protoc-gen-grpc-java \
|
|
|
|
--grpc-java_out=bin --proto_path=. \
|
|
|
|
pkg/server/server.proto \
|
|
|
|
pkg/testing/remote/loader.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-09-26 09:44:35 +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
|
|
|
|
grpc-decs:
|
|
|
|
protoc --proto_path=. \
|
|
|
|
--descriptor_set_out=.github/testing/server.pb \
|
|
|
|
pkg/server/server.proto
|
|
|
|
|
|
|
|
grpc-testproto:
|
|
|
|
protoc -I . \
|
|
|
|
--descriptor_set_out=pkg/runner/grpc_test/test.pb \
|
|
|
|
pkg/runner/grpc_test/test.proto
|
|
|
|
|
|
|
|
protoc -I . \
|
|
|
|
--go_out=. --go_opt=paths=source_relative \
|
|
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
|
|
|
pkg/runner/grpc_test/test.proto
|
|
|
|
|
2023-04-04 13:18:51 +08:00
|
|
|
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
|