1+ name : Setup LocalStack
2+ on :
3+ workflow_call :
4+ inputs :
5+ store-cloudpod :
6+ required : true
7+ type : string
8+ database-type :
9+ required : true
10+ type : string
11+ localstack-version :
12+ required : true
13+ type : string
14+
15+ jobs :
16+ setup-localstack :
17+ name : Setup infrastructure
18+ runs-on : ubuntu-latest
19+ steps :
20+ - name : Checkout
21+ uses : actions/checkout@v3
22+
23+ - name : Setup Python
24+ uses : actions/setup-python@v4
25+ with :
26+ python-version : ' 3.9'
27+
28+ - name : Setup Nodejs
29+ uses : actions/setup-node@v3
30+ with :
31+ node-version : 16
32+
33+ - name : Install dependencies
34+ run : |
35+ make install
36+
37+ - name : Start LocalStack
38+ env :
39+ LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
40+ LOCALSTACK_VOLUME_DIR : ${{ github.workspace }}/ls_test
41+ MYSQL_FEATURE_FLAG : ${{ inputs.database-type }}
42+ run : |
43+ mkdir ls_test
44+ ls -la ls_test
45+ docker pull localstack/localstack-pro:${{ inputs.localstack-version }}
46+ # Start LocalStack in the background
47+ if [ "mysql" == ${MYSQL_FEATURE_FLAG} ]; then
48+ LS_LOG=trace RDS_MYSQL_DOCKER=1 localstack start -d
49+ else
50+ LS_LOG=trace localstack start -d
51+ fi
52+ # Wait 30 seconds for the LocalStack container to become ready before timing out
53+ echo "Waiting for LocalStack startup..."
54+ localstack wait -t 15
55+ echo "Startup complete"
56+
57+ - name : Deploy the application
58+ env :
59+ AWS_ACCESS_KEY_ID : test
60+ AWS_SECRET_ACCESS_KEY : test
61+ AWS_DEFAULT_REGION : us-east-1
62+ run : |
63+ make build
64+ make bootstrap
65+ make deploy
66+
67+ - name : Store Pod
68+ if : ${{ inputs.store-cloudpod == 'true' }}
69+ run : |
70+ localstack pod save file://pod.zip
71+ - name : Upload Pod as Artifact
72+ if : ${{ inputs.store-cloudpod == 'true' }}
73+ uses : actions/upload-artifact@v3
74+ with :
75+ name : cloudpod
76+ path : release-pod.zip
77+ retention-days : 1
78+
79+
0 commit comments