-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (162 loc) · 4.4 KB
/
ci.yml
File metadata and controls
174 lines (162 loc) · 4.4 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: CI
on: [push]
jobs:
editorconfig-checker:
name: editorconfig-checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker
flake8:
name: flake8
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.10.13
architecture: x64
- name: Install flake8
run: pip install flake8
- name: Run flake8
uses: suo/flake8-github-action@releases/v1
with:
checkName: 'flake8'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
markdown-lint:
name: markdown-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npx markdown-cli *.md
unittest:
name: unittest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.10.13
architecture: x64
- name: Execute Unit Tests
run: python3 -m unittest src/test_task_manager.py
sonar-cloud:
needs: [editorconfig-checker, markdown-lint, flake8, unittest]
name: sonar-cloud
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install tox and any other packages
run: pip install tox
- name: Run tox
run: tox -e py
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
organization: anailieva
project: anailieva_task-manager
snyk:
needs: [editorconfig-checker, markdown-lint, flake8, unittest]
name: snyk
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Snyk test
working-directory: ./src/
run: |
npm install -g snyk
pip install -r requirements.txt
snyk test
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
gitleaks:
needs: [editorconfig-checker, markdown-lint, flake8, unittest]
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
sql:
needs: [sonar-cloud, snyk, gitleaks]
name: sql
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_DB: db
POSTGRES_USER: user
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- uses: joshuaavalon/flyway-action@v3.0.0
with:
url: jdbc:postgresql://postgres:5432/db
user: user
password: password
docker-build:
needs: [sql]
name: docker-build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build docker image
uses: docker/build-push-action@v3
with:
push: false
tags: anailieva/python:latest
trivy:
needs: [sql]
name: trivy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'anailieva/python:latest'
format: 'table'
exit-code: '1'
severity: 'CRITICAL'
docker-push:
needs: [trivy, docker-build]
name: docker-push
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push docker image
uses: docker/build-push-action@v3
with:
push: true
tags: anailieva/python:latest