Repository navigation
75 lines (62 loc) · 2.03 KB
/
Copy pathmain.yml
File metadata and controls
75 lines (62 loc) · 2.03 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
name: Deploy on LocalStack
on:
push:
paths-ignore:
- '**.md'
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
terraform:
name: Replicate the platform and deploy the application with Terraform
runs-on: ubuntu-latest
timeout-minutes: 40
defaults:
run:
working-directory: terraform
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: false
- name: Install lstk
run: |
npm install -g @localstack/lstk
lstk setup aws --force --non-interactive
- name: Start LocalStack
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
run: lstk start
# A second LocalStack account stands in for the AWS account that owns the platform
- name: Deploy the platform
run: make deploy-platform-local
- name: Deploy the application before replication, which must fail on the missing network
run: |
if make deploy-application > first-deploy.log 2>&1; then
cat first-deploy.log
echo "The deploy succeeded although the platform VPC and subnets are not in the application account yet"
exit 1
fi
vpc_id=$(sed -n 's/^vpc_id *= *"\(.*\)"/\1/p' application/terraform.tfvars)
grep -E "NotFound|not found|does not exist" first-deploy.log | grep -E "$vpc_id|subnet-" \
|| { cat first-deploy.log; echo "The deploy failed for another reason"; exit 1; }
- name: Replicate the VPC and subnets
run: make replicate-local
- name: Deploy the application
run: make deploy-application
- name: Run tests
run: make test
- name: Show LocalStack logs
if: failure()
run: lstk logs | tail -300