-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (92 loc) · 2.92 KB
/
python.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
107
108
name: Deploy Docker Image
on:
push:
branches: [master]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel pylint
- name: Install
run: |
python -m pip install .
- name: Lint
run: |
pylint sump
- name: Test
run: |
python setup.py test
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Check Sonar Status
uses: sonarcloud-actions/sonarcloud-check-status-action@v1
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/python@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --file=sump_level_sensor.egg-info/requires.txt --package-manager=pip
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: python
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Package
run: |
python setup.py bdist_wheel
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
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: Deploy to AWS CloudFormation
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: sump-level-sensor
template: aws/cloudformation.yml
parameter-overrides: "EmailParameter=${{ secrets.EMAIL }},SMSParameter=${{ secrets.SMS }}"
no-fail-on-empty-changeset: "1"
- name: Build and export to Docker
uses: docker/build-push-action@v4
with:
context: .
load: true
tags: matthewjsporter/sump-level-sensor:latest
- name: Run Snyk to check Docker image for vulnerabilities
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: matthewjsporter/sump-level-sensor:latest
args: --exclude-base-image-vulns --file=Dockerfile --policy-path=.snyk
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/arm64
push: true
tags: matthewjsporter/sump-level-sensor:latest