File tree 4 files changed +85
-1
lines changed
4 files changed +85
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy on LocalStack
2
+
3
+ on :
4
+ push :
5
+ paths-ignore :
6
+ - ' README.md'
7
+ branches :
8
+ - main
9
+ pull_request :
10
+ branches :
11
+ - main
12
+ schedule :
13
+ # “At 00:00 on Sunday.”
14
+ - cron : " 0 0 * * 0"
15
+ workflow_dispatch :
16
+
17
+ permissions :
18
+ contents : write
19
+
20
+ jobs :
21
+ sam :
22
+ name : Setup infrastructure using SAM
23
+ runs-on : ubuntu-latest
24
+ steps :
25
+ - name : Checkout
26
+ uses : actions/checkout@v3
27
+
28
+ - uses : gautamkrishnar/keepalive-workflow@v1
29
+
30
+ - name : Setup Python
31
+ uses : actions/setup-python@v4
32
+ with :
33
+ python-version : ' 3.10'
34
+
35
+ - name : Setup Node.js
36
+ uses : actions/setup-node@v3
37
+ with :
38
+ node-version : ' 18'
39
+
40
+ - name : Setup SAM
41
+ uses : aws-actions/setup-sam@v2
42
+ with :
43
+ use-installer : true
44
+
45
+ - name : Setup SAM-Local
46
+ run : |
47
+ pip install aws-sam-cli-local
48
+ samlocal --help
49
+
50
+ - name : Start LocalStack
51
+ run : |
52
+ pip install localstack
53
+ docker pull localstack/localstack-pro:latest
54
+ # Start LocalStack in the background
55
+ DEBUG=1 localstack start -d
56
+ # Wait 30 seconds for the LocalStack container to become ready before timing out
57
+ echo "Waiting for LocalStack startup..."
58
+ localstack wait -t 15
59
+ echo "Startup complete"
60
+ env :
61
+ LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
62
+
63
+ - name : Build the Lambda Layer
64
+ run : |
65
+ cd function
66
+ pip install --target ../package/python -r requirements.txt
67
+
68
+ - name : Build the SAM app
69
+ run : |
70
+ samlocal build
71
+
72
+ - name : Deploy the SAM app
73
+ run : |
74
+ curl http://localhost:4566/_localstack/info
75
+ samlocal deploy --no-confirm-changeset
76
+
Original file line number Diff line number Diff line change 6
6
7
7
# AWS SAM
8
8
.aws-sam
9
- samconfig.toml
10
9
out.json
11
10
12
11
# LocalStack
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ services:
10
10
- " 127.0.0.1:443:443" # LocalStack HTTPS Gateway (Pro)
11
11
environment :
12
12
- LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN}
13
+ - LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY}
13
14
- DEBUG=1
14
15
- LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT=600
15
16
volumes :
Original file line number Diff line number Diff line change
1
+ version = 0.1
2
+ [default .deploy .parameters ]
3
+ stack_name = " sam-app"
4
+ resolve_s3 = true
5
+ s3_prefix = " sam-app"
6
+ region = " us-east-1"
7
+ capabilities = " CAPABILITY_IAM"
8
+ image_repositories = []
You can’t perform that action at this time.
0 commit comments