diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml new file mode 100644 index 0000000..ae6a751 --- /dev/null +++ b/.github/workflows/base.yml @@ -0,0 +1,22 @@ +name: Lambda Boilerplate + +on: [push] +jobs: + lint-and-validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt install python3-venv + python3 -m pip install --upgrade pip setuptools wheel pipx + - name: Validate templates + run: | + cd infrastructure + python3 -m pipx run sceptre validate app/app.yaml + python3 -m pipx run sceptre validate bootstrap/bootstrap.yaml + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }} + - name: Lint + run: python3 -m pipx run black . --check diff --git a/README.md b/README.md index ddda1e5..8793a80 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # lambda-boilerplate 🛠 Skip the boilerplate and start building fun λ things 🛠 +![Lambda Boilerplate](https://github.com/mcataford/lambda-boilerplate/workflows/Lambda%20Boilerplate/badge.svg) + ## Overview AWS Lambdas are fun, but often the amount of boilerplate involved in getting a project off the ground hinders the fun. From setting up a local environment to writing out a Cloudformation template, the overhead of Lambda-based greenfield projects can be daunting. No more. Just use this repository as a template or clone it and jump straight into the action! This repository offers a quick template your can use, full with a Docker setup for local development and invocation commands that you can use to package and deploy small Lambdas. diff --git a/dev_requirements.txt b/requirements_dev.txt similarity index 89% rename from dev_requirements.txt rename to requirements_dev.txt index ee86a1a..8cb537a 100644 --- a/dev_requirements.txt +++ b/requirements_dev.txt @@ -1,7 +1,5 @@ appdirs==1.4.4 attrs==20.1.0 -awscli==1.18.124 -black==19.10b0 boto3==1.14.55 botocore==1.17.55 click==7.1.2 @@ -22,7 +20,6 @@ PyYAML==5.3.1 regex==2020.7.14 rsa==4.5 s3transfer==0.3.3 -sceptre==2.3.0 six==1.15.0 toml==0.10.1 typed-ast==1.4.1 diff --git a/script/bootstrap b/script/bootstrap index 01db817..b7dc74f 100644 --- a/script/bootstrap +++ b/script/bootstrap @@ -10,6 +10,6 @@ VENV=lambda-boilerplate.venv pyenv virtualenv $VENV && pyenv activate $VENV && python -m pip install -U pip && - pip install -r dev_requirements.txt && + pip install -r requirements_dev.txt && echo "✨ Good to go! ✨" } diff --git a/tasks.py b/tasks.py index 8941ef3..dfb6ab8 100644 --- a/tasks.py +++ b/tasks.py @@ -14,13 +14,13 @@ def teardown_app(ctx): with ctx.cd("infrastructure"): ctx.run("sceptre delete app/app.yaml -y") + @task(name="teardown-bootstrap") def teardown_bootstrap(ctx): with ctx.cd("infrastructure"): ctx.run("sceptre delete bootstrap/bootstrap.yaml -y") - @task(name="deploy") def stack_deploy(ctx): path = Path(__file__).parent @@ -33,7 +33,9 @@ def stack_deploy(ctx): new_archive_name = f"lambda_function_{srchash}.zip" ctx.run(f"mv lambda_function.zip {new_archive_name}") - ctx.run(f"aws s3 cp {new_archive_name} s3://mcat-dev-test-bucket-artifacts-2 && rm {new_archive_name}") + ctx.run( + f"aws s3 cp {new_archive_name} s3://mcat-dev-test-bucket-artifacts-2 && rm {new_archive_name}" + ) with ctx.cd("infrastructure"): ctx.run(f"sceptre --var source_key={new_archive_name} launch app/app.yaml -y")