-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (80 loc) · 3.79 KB
/
Makefile
File metadata and controls
105 lines (80 loc) · 3.79 KB
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
97
98
99
100
101
102
103
104
105
VERSION := $(if ${PULUMI_VERSION},${PULUMI_VERSION},$(shell ./scripts/pulumi-version.sh))
PYTHON_SDK_VERSION := $(shell echo "$(VERSION)" | sed 's/-/./g')
CONCURRENCY := 10
SHELL := sh
GO := go
.phony: .EXPORT_ALL_VARIABLES
.EXPORT_ALL_VARIABLES:
default: ensure_go build_go
install::
${GO} install ./cmd/...
clean::
rm -f ./bin/*
ensure_go::
cd sdk && ${GO} mod download
.phony: lint
lint:: lint-copyright lint-golang lint-python
lint-golang:
cd sdk && golangci-lint run
lint-python:
flake8 ./sdk/python/pulumi_esc_sdk/esc_client.py --count --max-complexity=10 --max-line-length=127 --statistics
flake8 ./sdk/python/test/ --count --max-complexity=10 --max-line-length=127 --statistics
lint-copyright:
pulumictl copyright
.phony: format
format:
find . -iname "*.go" -print0 | xargs -r0 gofmt -s -w
build_go:: ensure_go
cd sdk && ${GO} build -ldflags "-X github.com/pulumi/esc/cmd/internal/version.Version=${VERSION}" ./...
build_debug:: ensure_go
cd sdk && ${GO} build -gcflags="all=-N -l" -ldflags "-X github.com/pulumi/esc/cmd/internal/version.Version=${VERSION}" ./...
build_python::
PYPI_VERSION=$(PYTHON_SDK_VERSION) ./scripts/build_python_sdk.sh
build_typescript::
cd sdk/typescript && \
npm i && npm run build && \
cp ../../README.md ../../LICENSE package.json package-lock.json ./bin/ && \
sed -i.bak -e "s/\$${VERSION}/$(VERSION)/g" ./bin/package.json && \
rm -rf ./bin/tests/*
test_go:: build_go
cd sdk && ${GO} test --timeout 30m -short -count 1 -parallel ${CONCURRENCY} ./...
test_go_cover:: build_go
cd sdk && ${GO} test --timeout 30m -count 1 -coverpkg=github.com/pulumi/esc-sdk/... -race -coverprofile=coverage.out -parallel ${CONCURRENCY} ./...
test_typescript::
cd sdk/typescript && npm i && npm run test
test_python::
cd sdk/python && rm -rf ./bin/ && pytest
.PHONY: generate_go_client_sdk
generate_go_client_sdk:
GO_POST_PROCESS_FILE="/usr/local/bin/gofmt -w" openapi-generator-cli generate -i ./sdk/swagger.yaml -p packageName=esc_sdk,withGoMod=false,isGoSubmodule=true,userAgent=esc-sdk/go/${VERSION} -t ./sdk/templates/go -g go -o ./sdk/go --git-repo-id esc --git-user-id pulumi
.PHONY: generate_ts_client_sdk
generate_ts_client_sdk:
TS_POST_PROCESS_FILE="/usr/local/bin/prettier --write" openapi-generator-cli generate -i ./sdk/swagger.yaml -p npmName=@pulumi/esc-sdk,userAgent=esc-sdk/ts/${VERSION} -t ./sdk/templates/typescript --enable-post-process-file -g typescript-axios -o ./sdk/typescript/esc/raw --git-repo-id esc --git-user-id pulumi
.PHONY: generate_python_client_sdk
generate_python_client_sdk:
PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i" openapi-generator-cli generate -i ./sdk/swagger.yaml -p packageName=pulumi_esc_sdk,httpUserAgent=esc-sdk/python/${VERSION},packageVersion=${PYTHON_SDK_VERSION} -t ./sdk/templates/python -g python -o ./sdk/python --git-repo-id esc --git-user-id pulumi
.PHONY: generate_csharp_client_sdk
generate_csharp_client_sdk:
openapi-generator-cli generate \
-i ./sdk/swagger.yaml \
-g csharp \
--library generichost \
--additional-properties packageName=Pulumi.Esc.Sdk \
--additional-properties targetFramework=net6.0 \
--additional-properties nullableReferenceTypes=true \
--additional-properties validatable=true \
--additional-properties hideGenerationTimestamp=false \
--additional-properties sourceFolder=. \
--additional-properties httpUserAgent=esc-sdk/csharp/${VERSION} \
-t ./sdk/templates/csharp \
-o ./sdk/csharp \
--git-repo-id esc \
--git-user-id pulumi
build_csharp::
cd sdk/csharp/Pulumi.Esc.Sdk && dotnet build
test_csharp::
cd sdk/csharp && dotnet test --filter "Category!=Integration"
test_csharp_integration::
cd sdk/csharp && dotnet test --filter "Category=Integration"
.phony: generate_sdks
generate_sdks:: generate_go_client_sdk generate_ts_client_sdk generate_python_client_sdk generate_csharp_client_sdk