-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (81 loc) · 2.66 KB
/
infrastructure-check.yml
File metadata and controls
97 lines (81 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Environment Setup
on:
push:
branches:
- main
jobs:
setup-and-check-infrastructure:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install awslocal
run: |
pip install awscli-local
- name: Set up Maven
run: sudo apt-get install -y maven
- name: Build Lambdas
run: |
cd stack-bytes-lambda
mvn clean package shade:shade
- name: Set up Docker
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Build and start infrastructure
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
run: |
docker-compose up -d
sleep 30
- name: Check for Bucket
run: |
output=$(awslocal s3api list-buckets --query "Buckets[?contains(Name, 'quotes')].Name" --output text)
if [ -z "$output" ]; then
echo "Created bucket not found."
exit 1
else echo "Bucket with <quotes> name was found: $output"
fi
- name: Check for GET Lambda
run: |
getlambda_output=$(awslocal lambda get-function --function-name 'get-quote')
if [ -z "getlambda_output" ]; then
echo "Lambda function not found."
exit 1
else echo "Lambda function was created: getlambda_output"
fi
- name: Check for POST Lambda
run: |
postlambda_output=$(awslocal lambda get-function --function-name 'create-quote')
if [ -z "postlambda_output" ]; then
echo "Lambda function not found."
exit 1
else echo "Lambda function was created: postlambda_output"
fi
- name: Check API Gateway
run: |
apigw_output=$(awslocal apigateway get-rest-apis --query "items[?name=='quote-api-gateway']")
if [ -z "apigw_output" ]; then
echo "API Gateway function not found."
exit 1
else echo "API Gateway was created: apigw_output"
fi
- name: Generate a Diagnostic Report
if: failure()
run: |
curl -s localhost:4566/_localstack/diagnose > diagnose.json
- name: Upload the Diagnostic Report
if: failure()
uses: actions/upload-artifact@v3
with:
name: diagnose.json
path: ./diagnose.json