-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (124 loc) · 5.88 KB
/
Copy pathMakefile
File metadata and controls
150 lines (124 loc) · 5.88 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
.PHONY: build build-packages sync api-snapshot ct cti cwt cwti dist lint format test-typescript-versions test-e2e
build:
./gradlew clean build publishToMavenLocal
dist:
node scripts/compilation/build-es-cjs-batch.js --all
# @smithy/undici-http-handler depends on undici@7, which requires Node.js >= 20.
# Skip building it on older Node versions so the rest of the workspace still builds.
build-packages:
@NODE_MAJOR=$$(node -p "parseInt(process.versions.node.split('.')[0], 10)"); \
if [ "$$NODE_MAJOR" -lt 20 ]; then \
yarn turbo run build --filter='!@smithy/undici-http-handler'; \
else \
yarn turbo run build; \
fi
sync:
gh repo sync $$GITHUB_USERNAME/smithy-typescript -b main
git fetch --all
generate-protocol-tests:
rm -rf ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen
./gradlew :smithy-typescript-protocol-test-codegen:build
rm -rf ./private/smithy-rpcv2-cbor
rm -rf ./private/smithy-rpcv2-cbor-schema
rm -rf ./private/my-local-model
rm -rf ./private/my-local-model-schema
rm -rf ./private/my-local-model-schema-server
rm -rf ./private/types-only
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/smithy-rpcv2-cbor/typescript-codegen ./private/smithy-rpcv2-cbor
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/smithy-rpcv2-cbor-schema/typescript-codegen ./private/smithy-rpcv2-cbor-schema
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/my-local-model/typescript-client-codegen/ ./private/my-local-model
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/my-local-model-schema/typescript-client-codegen/ ./private/my-local-model-schema
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/my-local-model-schema-server/typescript-server-codegen/ ./private/my-local-model-schema-server
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/types-only/typescript-codegen/ ./private/types-only
node ./scripts/post-protocol-test-codegen
yarn
yarn turbo run build -F="./private/*" --only
make generate-server-tests
make test-protocols;
generate-server-tests:
rm -rf ./smithy-typescript-codegen-test/build/smithyprojections/smithy-typescript-codegen-test
./gradlew :smithy-typescript-codegen-test:build
rm -rf ./private/interceptor-example-ssdk
cp -r ./smithy-typescript-codegen-test/build/smithyprojections/smithy-typescript-codegen-test/interceptor-example/typescript-server-codegen/ ./private/interceptor-example-ssdk
node ./scripts/post-protocol-test-codegen
yarn
yarn turbo run build -F="./private/interceptor-example-ssdk"
test-protocols:
(cd ./private/smithy-rpcv2-cbor && npx vitest run --globals && yarn test:index)
(cd ./private/smithy-rpcv2-cbor-schema && npx vitest run --globals && yarn test:index)
(cd ./private/my-local-model-schema && npx vitest run --globals && yarn test:index)
(cd ./private/smithy-rpcv2-cbor-schema && yarn test:integration)
(cd ./private/my-local-model-schema && yarn test:integration)
benchmark:
(cd ./private/my-local-model-schema && npx vitest run --globals)
# "build generate test"
bgt:
make build generate-protocol-tests
gt:
make generate-protocol-tests
# @smithy/undici-http-handler depends on undici@7, which requires Node.js >= 20.
# Skip its tests on older Node versions so the rest of the unit tests still run.
test-unit:
@NODE_MAJOR=$$(node -p "parseInt(process.versions.node.split('.')[0], 10)"); \
if [ "$$NODE_MAJOR" -lt 20 ]; then \
yarn g:vitest run -c vitest.config.mts --exclude '**/packages/undici-http-handler/**'; \
else \
yarn g:vitest run -c vitest.config.mts; \
fi
test-browser:
yarn g:vitest run -c vitest.config.browser.mts
test-bundlers:
(cd ./testbed/bundlers && make run)
(cd ./testbed/bundler-compat && make run)
# typecheck for test code.
test-types:
npx tsc -p tsconfig.test.json
# verify generated clients compile across supported TypeScript versions (see testbed/ts-compat/README.md).
test-typescript-versions:
(cd ./testbed/ts-compat && make run)
test-integration:
make static-analysis;
make api-snapshot;
make test-browser;
node ./packages/node-http-handler/test/node-http-handler.interception.mjs
@NODE_MAJOR=$$(node -p "parseInt(process.versions.node.split('.')[0], 10)"); \
if [ "$$NODE_MAJOR" -lt 20 ]; then \
yarn g:vitest run -c vitest.config.integ.mts --exclude '**/packages/undici-http-handler/**'; \
else \
yarn g:vitest run -c vitest.config.integ.mts; \
fi
make test-types;
make test-typescript-versions;
make test-bundlers;
static-analysis:
node ./scripts/validation/generic-byte-array.js;
node ./scripts/check-dependencies.js;
node ./scripts/runtime-dep-version-check.js;
node ./scripts/validation/validate-all.js;
turbo-clean:
@read -p "Are you sure you want to delete your local cache? [y/N]: " ans && [ $${ans:-N} = y ]
@echo "\nDeleted cache folders: \n--------"
@find . -name '.turbo' -type d -prune -print -exec rm -rf '{}' + && echo '\n'
api-snapshot:
node scripts/validation/api-snapshot.js --write
git diff --exit-code api-snapshot/
S ?= $(word 2,$(MAKECMDGOALS))
# make ct retry, for example, to run a subset of core unit tests.
ct:
cd packages/core && yarn g:vitest run src/submodules/$(S)
cwt:
cd packages/core && yarn g:vitest watch src/submodules/$(S)
# same as ct, but for integration tests.
cti:
cd packages/core && yarn g:vitest run -c vitest.config.integ.mts src/submodules/$(S)
cwti:
cd packages/core && yarn g:vitest watch -c vitest.config.integ.mts src/submodules/$(S)
# swallow extra positional args (e.g. make ct endpoints)
%:
@:
lint:
npx oxlint -c .oxlintrc.json --fix packages
format:
npx oxfmt packages scripts testbed
test-e2e:
(cd ./testbed/aws/s3 && make run)