ci: base (#2)

* ci: base

* ci: missing bit

* ci: pyenv via action

* ci: typos

* ci: deps

* ci: typo

* ci: temp rm black

* ci: py ver

* ci: use builtin py

* ci: typo

* ci: setuptools

* ci: without subshell

* chore: normalize titles

* chore: lint

* ci: validate and lint flows

* ci: job name

* ci: pipx as module

* ci: missing dep

* ci: missing dep

* ci: pipx module

* docs: add badge
This commit is contained in:
Marc Cataford 2020-09-26 11:40:18 -04:00 committed by GitHub
parent d2a6cfe378
commit f27200b29c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 6 deletions

22
.github/workflows/base.yml vendored Normal file
View file

@ -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

View file

@ -1,6 +1,8 @@
# lambda-boilerplate # lambda-boilerplate
🛠 Skip the boilerplate and start building fun λ things 🛠 🛠 Skip the boilerplate and start building fun λ things 🛠
![Lambda Boilerplate](https://github.com/mcataford/lambda-boilerplate/workflows/Lambda%20Boilerplate/badge.svg)
## Overview ## 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. 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.

View file

@ -1,7 +1,5 @@
appdirs==1.4.4 appdirs==1.4.4
attrs==20.1.0 attrs==20.1.0
awscli==1.18.124
black==19.10b0
boto3==1.14.55 boto3==1.14.55
botocore==1.17.55 botocore==1.17.55
click==7.1.2 click==7.1.2
@ -22,7 +20,6 @@ PyYAML==5.3.1
regex==2020.7.14 regex==2020.7.14
rsa==4.5 rsa==4.5
s3transfer==0.3.3 s3transfer==0.3.3
sceptre==2.3.0
six==1.15.0 six==1.15.0
toml==0.10.1 toml==0.10.1
typed-ast==1.4.1 typed-ast==1.4.1

View file

@ -10,6 +10,6 @@ VENV=lambda-boilerplate.venv
pyenv virtualenv $VENV && pyenv virtualenv $VENV &&
pyenv activate $VENV && pyenv activate $VENV &&
python -m pip install -U pip && python -m pip install -U pip &&
pip install -r dev_requirements.txt && pip install -r requirements_dev.txt &&
echo "✨ Good to go! ✨" echo "✨ Good to go! ✨"
} }

View file

@ -14,13 +14,13 @@ def teardown_app(ctx):
with ctx.cd("infrastructure"): with ctx.cd("infrastructure"):
ctx.run("sceptre delete app/app.yaml -y") ctx.run("sceptre delete app/app.yaml -y")
@task(name="teardown-bootstrap") @task(name="teardown-bootstrap")
def teardown_bootstrap(ctx): def teardown_bootstrap(ctx):
with ctx.cd("infrastructure"): with ctx.cd("infrastructure"):
ctx.run("sceptre delete bootstrap/bootstrap.yaml -y") ctx.run("sceptre delete bootstrap/bootstrap.yaml -y")
@task(name="deploy") @task(name="deploy")
def stack_deploy(ctx): def stack_deploy(ctx):
path = Path(__file__).parent path = Path(__file__).parent
@ -33,7 +33,9 @@ def stack_deploy(ctx):
new_archive_name = f"lambda_function_{srchash}.zip" new_archive_name = f"lambda_function_{srchash}.zip"
ctx.run(f"mv lambda_function.zip {new_archive_name}") 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"): with ctx.cd("infrastructure"):
ctx.run(f"sceptre --var source_key={new_archive_name} launch app/app.yaml -y") ctx.run(f"sceptre --var source_key={new_archive_name} launch app/app.yaml -y")