-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (84 loc) · 2.36 KB
/
cicd.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
name: CICD
on:
push:
branches:
- 'main'
- 'dev'
- 'production'
pull_request:
types: [ opened, reopened, edited, synchronize ]
jobs:
test:
runs-on: ubuntu-latest
env:
AWS_DEFAULT_REGION: us-west-2
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: "pip"
cache-dependency-path: |
requirements.txt
api/requirements.txt
- name: Install Dependencies
run: |
pip install \
--upgrade \
--upgrade-strategy eager \
-r requirements.txt \
-r api/requirements.txt
- name: Run Tests
run: |
pytest
- name: Run Linters
uses: wearerequired/lint-action@v2
with:
black: true
black_args: api cdk
flake8: true
flake8_args: api cdk --max-line-length=131
isort: true
isort_args: api cdk
gitflow-enforcer:
runs-on: ubuntu-latest
steps:
- name: Check branch
if: github.base_ref == 'main' && github.head_ref != 'dev' || github.base_ref == 'production' && github.head_ref != 'main'
run: |
echo "ERROR: You can only merge to main from dev and to production from main"
exit 1
deploy-to-dev:
needs: gitflow-enforcer
if: github.ref_name == 'dev'
concurrency: development
uses: "./.github/workflows/deploy.yml"
with:
environment: development
stage: "dev"
role-session-name: "veda-stac-ingestor-github-development-deployment"
aws-region: "us-west-2"
secrets: inherit
deploy-to-staging:
needs: gitflow-enforcer
if: github.ref_name == 'main'
concurrency: staging
uses: "./.github/workflows/deploy.yml"
with:
environment: staging
stage: "staging"
role-session-name: "veda-stac-ingestor-github-staging-deployment"
aws-region: "us-west-2"
secrets: inherit
deploy-to-production:
needs: gitflow-enforcer
if: github.ref_name == 'production'
concurrency: production
uses: "./.github/workflows/deploy.yml"
with:
environment: production
stage: "production"
role-session-name: "veda-stac-ingestor-github-production-deployment"
aws-region: "us-west-2"
secrets: inherit