From c4874f3cb38d67d64f90cc2d444941c55d8064b9 Mon Sep 17 00:00:00 2001 From: Waldemar Hummer Date: 2020年4月26日 16:03:43 +0200 Subject: [PATCH] add setup for LocalStack tests --- .travis.yml | 24 +++++++++++++++---- Makefile | 19 +++++++++++++++ aws-ffmpeg-layer/serverless.yml | 3 +++ .../Makefile | 2 +- .../serverless.yml | 6 ++++- 5 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/.travis.yml b/.travis.yml index acb2e1f48..32960d029 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,26 @@ language: node_js -sudo: false +sudo: true node_js: - 6 install: - - npm install + - export DEBIAN_FRONTEND=noninteractive + - echo /home/travis/.nvm/versions/node/v6*/lib/node_modules + - sudo add-apt-repository -y ppa:longsleep/golang-backports; sudo apt update -q + - sudo apt install -y -qq golang-go + - go version + - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + - export PATH=$PATH:$GOPATH/bin + - mkdir -p $GOPATH/src/github.com/serverless + - ln -s `pwd` $GOPATH/src/github.com/serverless/examples script: - - npm run docs - - npm run validate - - ./check-if-readme-is-up-to-date.sh + - cd $GOPATH/src/github.com/serverless/examples + - make install + - export NODE_PATH=$NODE_PATH:`echo /home/travis/.nvm/versions/node/v6*/lib/node_modules` + - ls -la /home/travis/.nvm/versions/node/v6*/lib/node_modules + - make start + - make test-all + +notifications: + email: false diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..5e27aa669 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +VENV_DIR ?= .venv +VENV_ACT = . $(VENV_DIR)/bin/activate + +usage: ## Show this help + @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' + +start: ## Start LocalStack infrastructure + @$(VENV_ACT); nohup localstack start & + +install: ## Install global dependencies + which localstack || (virtualenv $(VENV_DIR); $(VENV_ACT); pip install -q localstack) + docker pull localstack/localstack & + npm install -q -s -g serverless serverless-localstack 2>&1> /dev/null + +test-all: ## Run all tests + (cd aws-golang-dynamo-stream-to-elasticsearch && make build && npm install serverless-localstack && make deploy) + (cd aws-ffmpeg-layer && ./build.sh && npm install serverless-localstack && sls deploy) + +.PHONY: usage install test-all diff --git a/aws-ffmpeg-layer/serverless.yml b/aws-ffmpeg-layer/serverless.yml index 4f7541787..6626c5cf1 100644 --- a/aws-ffmpeg-layer/serverless.yml +++ b/aws-ffmpeg-layer/serverless.yml @@ -25,3 +25,6 @@ layers: custom: bucket: ${env:BUCKET, 'ffmpeg-layer-gif-maker'} + +plugins: + - serverless-localstack diff --git a/aws-golang-dynamo-stream-to-elasticsearch/Makefile b/aws-golang-dynamo-stream-to-elasticsearch/Makefile index 6e963045c..8e3c96661 100644 --- a/aws-golang-dynamo-stream-to-elasticsearch/Makefile +++ b/aws-golang-dynamo-stream-to-elasticsearch/Makefile @@ -1,5 +1,5 @@ build: - dep ensure -v + dep ensure env GOOS=linux go build -ldflags="-s -w" -o bin/aws-golang-dynamo-stream-to-elasticsearch cmd/aws-golang-dynamo-stream-to-elasticsearch/main.go .PHONY: clean diff --git a/aws-golang-dynamo-stream-to-elasticsearch/serverless.yml b/aws-golang-dynamo-stream-to-elasticsearch/serverless.yml index 90b1130d3..7ea468ebd 100644 --- a/aws-golang-dynamo-stream-to-elasticsearch/serverless.yml +++ b/aws-golang-dynamo-stream-to-elasticsearch/serverless.yml @@ -34,6 +34,11 @@ provider: - { "Fn::GetAtt": ["PuppySearch", "DomainArn"] } - { "Fn::Join": ["", ["Fn::GetAtt": ["PuppySearch", "DomainArn"], "/*"]] } +plugins: + - serverless-localstack + +custom: {} + package: exclude: - ./** @@ -103,4 +108,3 @@ resources: # Resource: "*" AdvancedOptions: rest.action.multi.allow_explicit_index: "true" -

AltStyle によって変換されたページ (->オリジナル) /