forked from aws-samples/serverless-rust-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (29 loc) · 1.04 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
STACK_NAME ?= rust-products
FUNCTIONS := get-products get-product put-product delete-product dynamodb-streams
ARCH := aarch64-unknown-linux-gnu
.PHONY: build deploy tests
all: build tests-unit deploy tests-integ
ci: build tests-unit
build:
cross build --release --target $(ARCH)
rm -rf ./build
mkdir -p ./build
${MAKE} ${MAKEOPTS} $(foreach function,${FUNCTIONS}, build-${function})
build-%:
mkdir -p ./build/$*
cp -v ./target/$(ARCH)/release/$* ./build/$*/bootstrap
deploy:
if [ -f samconfig.toml ]; \
then sam deploy --stack-name $(STACK_NAME); \
else sam deploy -g --stack-name $(STACK_NAME); \
fi
tests-unit:
cargo test --lib --bins
tests-integ:
RUST_BACKTRACE=1 API_URL=$$(aws cloudformation describe-stacks --stack-name $(STACK_NAME) \
--query 'Stacks[0].Outputs[?OutputKey==`ApiUrl`].OutputValue' \
--output text) cargo test
tests-load:
API_URL=$$(aws cloudformation describe-stacks --stack-name $(STACK_NAME) \
--query 'Stacks[0].Outputs[?OutputKey==`ApiUrl`].OutputValue' \
--output text) artillery run tests/load-test.yml