-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (60 loc) · 1.92 KB
/
build.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
name: Build and Deploy
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r requirements-dev.txt
- name: Lint
run: |
PYTHONPATH=trash pylint trash/
- name: Test
run: |
PYTHONPATH=trash pytest --cov-config=.coveragerc --cov=. tests/ --cov-report=xml --cov-fail-under=80
- name: Sam Build
run: sam build --debug
- name: Run local Cucumber Tests
run: |
sam local start-lambda &
sleep 5
sam_pid=$!
behave -D local
kill $sam_pid
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Check Sonar Status
run: |
status=$(curl https://sonarcloud.io/api/qualitygates/project_status?projectKey=grouch-trash-service_grouch-trash-function)
echo $status | jq '.'
status=$(echo $status | jq '.projectStatus.status')
test '"OK"' = $status
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/python@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --file=trash/requirements.txt -- --allow-missing
- name: Deploy Sam templates
run: sam deploy --no-fail-on-empty-changeset
- name: validate using Cucumber tests
run: behave