Skip to content

Commit 13d59a2

Browse files
authored
feature: add deploy to AWS (#289)
1 parent 6d79d9d commit 13d59a2

File tree

7 files changed

+60
-12
lines changed

7 files changed

+60
-12
lines changed

.github/workflows/aws-deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Serverless Service E2E tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
jobs:
9+
aws_cdk:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repo
13+
uses: actions/checkout@v3
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: "16"
17+
- name: Set up Python 3.9
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.9"
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install pipenv
25+
pip install -r dev_requirements.txt
26+
pip install -r lambda_requirements.txt
27+
npm install -g aws-cdk
28+
- name: Configure aws credentials
29+
uses: aws-actions/configure-aws-credentials@master
30+
with:
31+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
32+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
33+
aws-region: "us-east-1"
34+
- name: Deploy stack
35+
run: make deploy
36+
- name: Run E2E tests
37+
run: make e2e
38+
- name: Destroy stack
39+
run: make destroy

.github/workflows/python-app.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a single version of Python
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Python application
4+
name: Serverless Service Build
55

66
on:
77
push:
@@ -47,7 +47,7 @@ jobs:
4747
run: |
4848
make pipeline-tests
4949
- name: Codecov
50-
uses: codecov/codecov-action@v3.1.0
50+
uses: codecov/codecov-action@v3.1.1
5151
with:
5252
files: ./coverage.xml
5353
name: aws-lambda-handler-cookbook-codecov

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ deploy:
4747
make deps
4848
mkdir -p .build/lambdas ; cp -r service .build/lambdas
4949
mkdir -p .build/common_layer ; pipenv requirements > .build/common_layer/requirements.txt
50-
cdk deploy --app="python3 ${PWD}/cdk/my_service/app.py" -require-approval=True
50+
cdk deploy --app="python3 ${PWD}/cdk/my_service/app.py" --require-approval=never
5151

5252
destroy:
53-
cdk destroy --app="python3 ${PWD}/cdk/my_service/app.py" -require-approval=True
53+
cdk destroy --app="python3 ${PWD}/cdk/my_service/app.py" --force
5454

5555
docs:
5656
mkdocs serve

Pipfile.lock

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cdk/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
install_requires=[
2626
'aws-cdk-lib>=2.0.0',
2727
'constructs>=10.0.0',
28-
'cdk-nag>2.0.0'
28+
'cdk-nag>2.0.0',
2929
'aws-cdk.aws-lambda-python-alpha==2.39.1-alpha.0',
3030
],
3131
)

dev_requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-i https://pypi.org/simple
22
attrs==22.1.0; python_version >= '3.5'
33
aws-cdk-lib==2.43.1; python_version ~= '3.7'
4+
aws-cdk.aws-lambda-python-alpha==2.39.1a0; python_version ~= '3.7'
45
-e ./cdk
56
boto3==1.24.81; python_version >= '3.7'
67
botocore==1.27.81; python_version >= '3.7'
@@ -70,15 +71,15 @@ toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2,
7071
tomli==2.0.1; python_version >= '3.7'
7172
typeguard==2.13.3; python_full_version >= '3.5.3'
7273
typing-extensions==4.3.0; python_version >= '3.7'
73-
urllib3==1.26.12; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_full_version < '4.0.0'
74+
urllib3==1.26.12; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'
7475
virtualenv==20.16.5; python_version >= '3.6'
7576
watchdog==2.1.9; python_version >= '3.6'
7677
xenon==0.9.0
7778
yapf==0.32.0
7879
zipp==3.8.1; python_version >= '3.7'
7980
aws-lambda-powertools==1.29.2
8081
aws-xray-sdk==2.10.0
81-
dnspython==2.2.1; python_version >= '3.6' and python_full_version < '4.0.0'
82+
dnspython==2.2.1; python_version >= '3.6' and python_version < '4'
8283
email-validator==1.3.0
8384
fastjsonschema==2.16.2
8485
pydantic[email]==1.10.2

lambda_requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ aws-lambda-powertools==1.29.2
33
aws-xray-sdk==2.10.0
44
boto3==1.24.81; python_version >= '3.7'
55
botocore==1.27.81; python_version >= '3.7'
6-
dnspython==2.2.1; python_version >= '3.6' and python_full_version < '4.0.0'
6+
dnspython==2.2.1; python_version >= '3.6' and python_version < '4'
77
email-validator==1.3.0
88
fastjsonschema==2.16.2
99
idna==3.4; python_version >= '3.5'
@@ -13,5 +13,5 @@ python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0,
1313
s3transfer==0.6.0; python_version >= '3.7'
1414
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
1515
typing-extensions==4.3.0; python_version >= '3.7'
16-
urllib3==1.26.12; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_full_version < '4.0.0'
16+
urllib3==1.26.12; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'
1717
wrapt==1.14.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'

0 commit comments

Comments
 (0)