diff --git a/serverless/Makefile b/serverless/Makefile index 9ed8d9b..849bc20 100644 --- a/serverless/Makefile +++ b/serverless/Makefile @@ -1,23 +1,25 @@ -.PHONY: test +.PHONY: iter publish setup clean test lint bucket = panther-public-sam-artifacts +finddir = find . -maxdepth 1 -mindepth 1 -type d +xargs = xargs -I % iter: - find . -depth 1 -type d | xargs -I % make -C % --makefile=../Makefile $(action) samdir=% + $(finddir) | $(xargs) make -C % --makefile=../Makefile $(action) samdir=% publish: sam build --use-container --build-image public.ecr.aws/sam/build-python3.11; sam package --s3-bucket $(bucket)-$(region) --output-template-file ../../cloudformation/$(samdir)-$(region).yml setup: - find . -depth 1 -type d | xargs -I % python3 -m venv %/venv - find . -depth 1 -type d | xargs -I % bash -c "%/venv/bin/pip install -r %/src/requirements.txt" - find . -depth 1 -type d | xargs -I % bash -c "%/venv/bin/pip install pytest pylint" + $(finddir) | $(xargs) python3 -m venv %/venv + $(finddir) | $(xargs) bash -c "%/venv/bin/pip install -r %/src/requirements.txt" + $(finddir) | $(xargs) bash -c "%/venv/bin/pip install pytest pylint" clean: rm -rf */venv test: - find . -depth 1 -type d | xargs -I % bash -c "pushd %; AWS_DEFAULT_REGION=us-west-2 venv/bin/pytest test/; popd" + $(finddir) | $(xargs) bash -c "pushd %; AWS_DEFAULT_REGION=us-west-2 venv/bin/pytest test/; popd" lint: - find . -depth 1 -type d | xargs -I % bash -c "pushd %; venv/bin/pylint -j 0 --max-line-length 140 --score no src/; popd" + $(finddir) | $(xargs) bash -c "pushd %; venv/bin/pylint -j 0 --max-line-length 140 --score no src/; popd"