From b29498302b29dabc95f7a393d7c5e39be269af47 Mon Sep 17 00:00:00 2001 From: Shing Lyu Date: Wed, 12 Jan 2022 16:05:44 +0000 Subject: [PATCH 1/3] docs: added version requirements for Rust and SAM CLI --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index afd0446..f86248f 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ If you want to learn more about Rust on Lambda and how this project is structure ### Requirements -* [Rust](https://www.rust-lang.org/) +* [Rust](https://www.rust-lang.org/) 1.56.0 or higher * [Cross](https://github.com/rust-embedded/cross) for cross-compilation to Arm64 -* The [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) for deploying to the cloud +* The [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) 1.33.0 or higher for deploying to the cloud * [Artillery](https://artillery.io/) for load-testing the application ### Commands From 26656e741505307abdbd4943eeeda76c8bb81084 Mon Sep 17 00:00:00 2001 From: Shing Lyu Date: Wed, 12 Jan 2022 16:06:57 +0000 Subject: [PATCH 2/3] Added makefile command for installing cross --- Makefile | 5 ++++- README.md | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8fcac37..1cc8d19 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,9 @@ ARCH := aarch64-unknown-linux-gnu all: build tests-unit deploy tests-integ ci: build tests-unit +install-cross: + cargo install cross + build: cross build --release --target $(ARCH) rm -rf ./build @@ -35,4 +38,4 @@ tests-integ: 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 \ No newline at end of file + --output text) artillery run tests/load-test.yml diff --git a/README.md b/README.md index f86248f..bb74124 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,9 @@ If you want to learn more about Rust on Lambda and how this project is structure You can use the following commands at the root of this repository to test, build, and deploy this project: ```bash +# Optional: install Cross +make install-cross + # Run unit tests make tests-unit From e7b4fc9fee19813def8c78548a3f591fc2b394ed Mon Sep 17 00:00:00 2001 From: Shing Lyu Date: Thu, 13 Jan 2022 10:28:35 +0000 Subject: [PATCH 3/3] Added make setup to check for dependency --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1cc8d19..60232c6 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,20 @@ ARCH := aarch64-unknown-linux-gnu all: build tests-unit deploy tests-integ ci: build tests-unit -install-cross: +setup: +ifeq (,$(shell which rustc)) + $(error "Could not found Rust compiler, please install it") +endif +ifeq (,$(shell which cargo)) + $(error "Could not found Cargo, please install it") +endif cargo install cross +ifeq (,$(shell which sam)) + $(error "Could not found SAM CLI, please install it") +endif +ifeq (,$(shell which artillery)) + $(error "Could not found Artillery, it's required for load testing") +endif build: cross build --release --target $(ARCH)