Skip to content

Commit e0b6ebe

Browse files
committed
add a CI workflow to test Terraform deployments
1 parent b52da46 commit e0b6ebe

File tree

1 file changed

+80
-1
lines changed

1 file changed

+80
-1
lines changed

.github/workflows/integration-test.yml

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,86 @@ on:
2626

2727

2828
jobs:
29-
run-it-tests-job:
29+
run-terraform-deployment:
30+
name: Run Terraform Deployment
31+
runs-on: ${{ inputs.runner-os || 'ubuntu-latest' }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Python 3.11
37+
id: setup-python
38+
uses: actions/setup-python@v2
39+
with:
40+
python-version: 3.11
41+
42+
- name: Install Terraform
43+
uses: hashicorp/setup-terraform@v2
44+
45+
- name: Install Terraform Local
46+
run: |
47+
pip install --upgrade terraform-local
48+
49+
- name: Set up Project
50+
run: |
51+
pip install -r requirements-dev.txt
52+
53+
- name: Start LocalStack
54+
uses: LocalStack/[email protected]
55+
with:
56+
image-tag: 'latest'
57+
use-pro: 'true'
58+
configuration: LS_LOG=trace
59+
install-awslocal: 'true'
60+
env:
61+
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
62+
63+
- name: Build lambdas
64+
run: |
65+
bin/build_lambdas.sh
66+
67+
- name: Deploy infrastructure
68+
run: |
69+
cd deployment/terraform
70+
tflocal init
71+
tflocal apply --auto-approve
72+
73+
- name: Run tests
74+
run: |
75+
pytest tests
76+
77+
- name: Show localstack logs
78+
if: always()
79+
run: |
80+
localstack logs
81+
82+
- name: Send a Slack notification
83+
if: failure() || github.event_name != 'pull_request'
84+
uses: ravsamhq/notify-slack-action@v2
85+
with:
86+
status: ${{ job.status }}
87+
token: ${{ secrets.GITHUB_TOKEN }}
88+
notification_title: "{workflow} has {status_message}"
89+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
90+
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
91+
notify_when: "failure"
92+
env:
93+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
94+
95+
- name: Generate a Diagnostic Report
96+
if: failure()
97+
run: |
98+
curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz
99+
100+
- name: Upload the Diagnostic Report
101+
if: failure()
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: diagnose.json.gz
105+
path: ./diagnose.json.gz
106+
107+
run-integration-tests-job:
108+
name: Run Integration Tests
30109
runs-on: ${{ inputs.runner-os || 'ubuntu-latest' }}
31110
steps:
32111
- name: Checkout

0 commit comments

Comments
 (0)