generated from dfds/aws-modules-template
-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (89 loc) · 2.79 KB
/
qa.yml
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
98
99
100
101
102
103
104
105
106
name: QA pipeline
on:
pull_request:
types: [opened, edited, synchronize]
branches: [main]
paths-ignore:
- .github/**
- .gitignore
- .pre-commit-config.yaml
- .tflint.hcl
- LICENSE
- README.md
- renovate.json
- scripts/**
- tests/**
workflow_dispatch:
concurrency: terraform_qa
defaults:
run:
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_BLUEPRINTS_QA_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_BLUEPRINTS_QA_DEPLOY_AWS_SECRET_ACCESS_KEY }}
jobs:
qa-env:
runs-on: ubuntu-latest
container:
image: dfdsdk/python-pipeline:0.0.4
steps:
- name: Check environment variables
run: bash -c '[[ -z $AWS_ACCESS_KEY_ID || -z $AWS_SECRET_ACCESS_KEY ]] && exit 1 || true'
- name: Send alert if job fails
if: failure()
uses: dfds/shared-workflows/.github/actions/automation-slack-notifier@master
with:
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
slack_message: Test environment variables failed.
qa-up:
runs-on: ubuntu-latest
needs: qa-env
container:
image: dfdsdk/python-pipeline:0.0.4
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Terraform Init
id: init
run: terraform init
working-directory: tests/qa
- name: Terraform Validate
id: validate
run: terraform validate -no-color
working-directory: tests/qa
- name: Terraform Plan
id: plan
run: terraform plan -no-color -out qa.plan
working-directory: tests/qa
- name: Terraform Apply
id: apply
run: terraform apply -input=false -auto-approve qa.plan
working-directory: tests/qa
- name: Send alert if job fails
if: failure()
uses: dfds/shared-workflows/.github/actions/automation-slack-notifier@master
with:
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
slack_message: Spin up QA environment failed.
qa-test:
runs-on: ubuntu-latest
needs: qa-up
container:
image: dfdsdk/python-pipeline:0.0.4
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Poetry install Python packages
id: poetry-install-packages
run: /etc/poetry/bin/poetry install
working-directory: scripts/qa
- name: Poetry run test case
id: poetry-run-test-case
run: /etc/poetry/bin/poetry run python3 test_rds.py
working-directory: scripts/qa
- name: Send alert if job fails
if: failure()
uses: dfds/shared-workflows/.github/actions/automation-slack-notifier@master
with:
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
slack_message: Test QA environment failed.