-
Notifications
You must be signed in to change notification settings - Fork 6
106 lines (84 loc) · 2.56 KB
/
main.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: rAPId Deployment
on:
push:
branches: [main]
workflow_dispatch:
jobs:
setup:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Log commit SHA
run: echo $GITHUB_SHA
security-check:
needs:
- setup
runs-on: self-hosted
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- run: pip install -r requirements.txt
- name: Run security checks
run: make security-check
api-deployment:
needs:
- setup
- security-check
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Populate .env with additional vars
run: |
cp ./.github/.github.env .env
echo AWS_ACCOUNT=${{ secrets.AWS_ACCOUNT }} >> .env
echo AWS_REGION=${{ secrets.AWS_REGION }} >> .env
echo AWS_DEFAULT_REGION=${{ secrets.AWS_REGION }} >> .env
- name: Build API Image
run: make api-create-image
- name: API Static Analysis
run: make api-lint
- name: API Tests
run: make api-test
- name: API Tag and Upload
run: make api-tag-and-upload
- name: API Check Image Scan for Vulnerabilities
run: make api-scan-for-vulns-and-tag
- name: API Tag PROD Candidate
run: make api-tag-prod-candidate
- name: API Deploy Image to Prod
run: make api-app-live-in-prod
- name: API Allow for Application to Start
run: sleep 120
- name: API Wait for Running Application
id: await-running-app
run: make api-check-app-is-running
- name: API E2E Tests
id: e2e-tests
env:
E2E_DOMAIN_NAME: ${{ secrets.E2E_DOMAIN_NAME }}
E2E_DATA_BUCKET: ${{ secrets.E2E_DATA_BUCKET }}
E2E_RESOURCE_PREFIX: ${{ secrets.E2E_RESOURCE_PREFIX }}
run: |
# Export AWS credentials to env for e2e tests
eval "$(aws configure export-credentials --format env)"
make api-test-e2e
- name: API Tag Image as Failure
if: always() && steps.await-running-app.conclusion == 'failure' || steps.e2e-tests.conclusion == 'failure'
run: make api-tag-prod-failure
cleanup:
needs:
- setup
- security-check
- api-deployment
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clean Docker Context
if: always()
run: make clean-pipeline-docker-context