-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (52 loc) · 2.25 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
_:
@echo -e "Check Makefile for all available targets"
fivetran_tag = "1fabb7626b6ec81a4f56d49a16a654210cb1d0be"
fivetran_sdk_url = "https://raw.githubusercontent.com/fivetran/fivetran_sdk/$(fivetran_tag)"
prepare-fivetran-sdk:
mkdir -p proto
curl -o proto/common.proto "$(fivetran_sdk_url)/common.proto"
curl -o proto/destination_sdk.proto "$(fivetran_sdk_url)/destination_sdk.proto"
install-protoc-gen-go:
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
generate-proto:
rm -f proto/*.go
protoc \
--proto_path=proto \
--go_out=proto \
--go_opt=paths=source_relative \
--go-grpc_out=proto \
--go-grpc_opt=paths=source_relative \
common.proto \
destination_sdk.proto
sdk-test:
docker run --mount type=bind,source=$$PWD/sdk_tests,target=/data \
-a STDIN -a STDOUT -a STDERR \
-e WORKING_DIR=$$PWD/sdk_tests \
-e GRPC_HOSTNAME=172.17.0.1 \
--network=host \
fivetrandocker/sdk-destination-tester:024.0314.001 $$TEST_ARGS
recreate-test-db:
curl --data-binary "DROP DATABASE IF EXISTS tester" http://localhost:8123
curl --data-binary "CREATE DATABASE tester" http://localhost:8123
lint:
docker run --rm -v $$PWD:/destination -w /destination golangci/golangci-lint:v1.55.2 golangci-lint run -v
test:
test -f sdk_tests/configuration.json || cp sdk_tests/default_configuration.json sdk_tests/configuration.json
go test fivetran.com/fivetran_sdk/destination/... -count=1 -v -race $$TEST_ARGS
test-with-coverage:
TEST_ARGS="-coverpkg=fivetran.com/fivetran_sdk/destination/... -coverprofile cover.out" make test
go tool cover -func=cover.out
build:
rm -rf ./out
go build -o ./out/clickhouse_destination ./destination
chmod a+x ./out/clickhouse_destination
build-docker-ci:
docker compose -f docker-compose.ci.yml build destination --no-cache
dependency-graph:
godepgraph -p github.com,google,golang -s fivetran.com/fivetran_sdk/destination | dot -Tpng -o godepgraph.png
xdg-open godepgraph.png || open godepgraph.png
run:
make build
./out/clickhouse_destination
.PHONY: _ prepare-fivetran-sdk generate-proto start-docker run lint test go-test go-test-with-coverage build clickhouse-query-for-tests build-docker-ci