-
Notifications
You must be signed in to change notification settings - Fork 4
76 lines (70 loc) · 2.57 KB
/
terraform_build.yaml
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
name: Run tests and apply terraform changes for current branch
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: '3.10'
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build container and lambda layers
run: |
./scripts/cibuild
- name: Test with pytest
env:
ENV: test
AWS_ACCESS_KEY_ID: ${{ secrets.aws_key_dev }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_dev }}
AWS_REGION: ${{ secrets.aws_region_dev }}
AWS_XRAY_SDK_ENABLED: false
AWS_REQUEST_PAYER: requester
run: |
./scripts/test -b ${{github.ref}} -k ${{ secrets.aws_key_dev }} -s ${{ secrets.aws_secret_dev }}
- name: Run CodeCOV action
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tests/cobertura.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
verbose: false
- name: Deploy production
if: success() && contains(github.ref, 'master')
env:
ENV: production
AWS_ACCESS_KEY_ID: ${{ secrets.aws_key_production }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_production }}
AWS_REGION: ${{ secrets.aws_region_production }}
run: |
./scripts/infra plan -w ${{ github.ref }}
./scripts/infra apply
- name: Deploy staging
if: success() && contains(github.ref, 'develop')
env:
ENV: staging
AWS_ACCESS_KEY_ID: ${{ secrets.aws_key_staging }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_staging }}
AWS_REGION: ${{ secrets.aws_region_staging }}
run: |
./scripts/infra plan -w ${{ github.ref }}
./scripts/infra apply
- name: Deploy dev
if: success() && (! contains(github.ref, 'develop')) && (! contains(github.ref, 'master'))
env:
ENV: dev
AWS_ACCESS_KEY_ID: ${{ secrets.aws_key_dev }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_dev }}
AWS_REGION: ${{ secrets.aws_region_dev }}
run: |
./scripts/infra plan -w ${{ github.ref }}
./scripts/infra apply