8
8
types : [opened, labeled]
9
9
10
10
jobs :
11
- pyTest :
11
+ codeValidation :
12
12
if : |
13
13
github.event_name == 'push' ||
14
14
(
15
15
github.event_name == 'pull_request' &&
16
16
(
17
- contains(github.event.pull_request.title, '[run ci]') ||
18
- contains(github.event.pull_request.body, '[run ci]') ||
19
17
contains(join(github.event.pull_request.labels.*.name), 'run-ci')
20
18
)
21
19
)
@@ -36,79 +34,12 @@ jobs:
36
34
- name : Install from pipfile
37
35
run : |
38
36
pipenv install --system
39
- - name : Running pytest
40
- run : |
41
- cd techsupport_bot
42
- python3.11 -m pytest tests/ -p no:warnings
43
-
44
- black :
45
- if : |
46
- github.event_name == 'push' ||
47
- (
48
- github.event_name == 'pull_request' &&
49
- (
50
- contains(github.event.pull_request.title, '[run ci]') ||
51
- contains(github.event.pull_request.body, '[run ci]') ||
52
- contains(join(github.event.pull_request.labels.*.name), 'run-ci')
53
- )
54
- )
55
- runs-on : ubuntu-latest
56
- steps :
57
- - uses : actions/checkout@v3
58
- - name : Set up Python 3.11
59
- uses : actions/setup-python@v3
60
- with :
61
- python-version : 3.11
62
- - name : Install dependencies
63
- run : |
64
- python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile)
65
- BLACK_VERSION=$(sed -nE 's/black = "==(.*)"/\1/p' Pipfile)
66
- pip install black==$BLACK_VERSION
67
37
- name : Analysing the code with black
68
38
run : |
69
39
black $(git rev-parse --show-toplevel) --check
70
-
71
- pyLint :
72
- if : |
73
- github.event_name == 'push' ||
74
- (
75
- github.event_name == 'pull_request' &&
76
- (
77
- contains(github.event.pull_request.title, '[run ci]') ||
78
- contains(github.event.pull_request.body, '[run ci]') ||
79
- contains(join(github.event.pull_request.labels.*.name), 'run-ci')
80
- )
81
- )
82
- runs-on : ubuntu-latest
83
- steps :
84
- - uses : actions/checkout@v3
85
- - name : Set up Python 3.11
86
- uses : actions/setup-python@v3
87
- with :
88
- python-version : 3.11
89
- - name : Install dependencies
90
- run : |
91
- python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile)
92
- PYLINT_VERSION=$(sed -nE 's/pylint = "==(.*)"/\1/p' Pipfile)
93
- pip install pylint==$PYLINT_VERSION
94
40
- name : Analysing the code with pylint
95
41
run : |
96
42
pylint $(git ls-files '*.py')
97
-
98
- lineEndingCheck :
99
- if : |
100
- github.event_name == 'push' ||
101
- (
102
- github.event_name == 'pull_request' &&
103
- (
104
- contains(github.event.pull_request.title, '[run ci]') ||
105
- contains(github.event.pull_request.body, '[run ci]') ||
106
- contains(join(github.event.pull_request.labels.*.name), 'run-ci')
107
- )
108
- )
109
- runs-on : ubuntu-latest
110
- steps :
111
- - uses : actions/checkout@v3
112
43
- name : Check for CRLF line endings
113
44
run : |
114
45
for file in $(git ls-files); do
@@ -120,78 +51,26 @@ jobs:
120
51
echo "CRLF line endings detected"
121
52
exit 1
122
53
fi
123
-
124
- flake8 :
125
- if : |
126
- github.event_name == 'push' ||
127
- (
128
- github.event_name == 'pull_request' &&
129
- (
130
- contains(github.event.pull_request.title, '[run ci]') ||
131
- contains(github.event.pull_request.body, '[run ci]') ||
132
- contains(join(github.event.pull_request.labels.*.name), 'run-ci')
133
- )
134
- )
135
- runs-on : ubuntu-latest
136
- steps :
137
- - uses : actions/checkout@v3
138
- - name : Set up Python 3.11
139
- uses : actions/setup-python@v3
140
- with :
141
- python-version : 3.11
142
- - name : Install dependencies
143
- run : |
144
- python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile)
145
- pip install pipenv==$(sed -nE 's/pipenv = "==(.*)"/\1/p' Pipfile)
146
- pipenv install --system
147
54
- name : Analysing the code with flake8
148
55
run : |
149
56
flake8 $(git rev-parse --show-toplevel)
150
-
151
- isort :
152
- if : |
153
- github.event_name == 'push' ||
154
- (
155
- github.event_name == 'pull_request' &&
156
- (
157
- contains(github.event.pull_request.title, '[run ci]') ||
158
- contains(github.event.pull_request.body, '[run ci]') ||
159
- contains(join(github.event.pull_request.labels.*.name), 'run-ci')
160
- )
161
- )
162
- runs-on : ubuntu-latest
163
- steps :
164
- - uses : actions/checkout@v3
165
- - name : Set up Python 3.11
166
- uses : actions/setup-python@v3
167
- with :
168
- python-version : 3.11
169
- - name : Install dependencies
170
- run : |
171
- python -m pip install pip==$(sed -nE 's/pip = "==(.*)"/\1/p' Pipfile)
172
- ISORT_VERSION=$(sed -nE 's/isort = "==(.*)"/\1/p' Pipfile)
173
- pip install isort==$ISORT_VERSION
174
57
- name : Analysing the code with isort
175
58
run : |
176
59
isort --check-only $(git rev-parse --show-toplevel)/ --profile black
60
+ - name : Running pytest
61
+ run : |
62
+ cd techsupport_bot
63
+ python3.11 -m pytest tests/ -p no:warnings
177
64
178
65
containerBuild :
179
66
if : |
180
- github.event_name == 'push' ||
67
+ github.event_name == 'pull_request' &&
181
68
(
182
- github.event_name == 'pull_request' &&
183
- (
184
- contains(github.event.pull_request.title, '[run ci]') ||
185
- contains(github.event.pull_request.body, '[run ci]') ||
186
- contains(join(github.event.pull_request.labels.*.name), 'run-ci')
187
- )
69
+ contains(join(github.event.pull_request.labels.*.name), 'run-ci')
188
70
)
189
71
runs-on : ubuntu-latest
190
72
needs :
191
- - pyTest
192
- - pyLint
193
- - flake8
194
- - isort
73
+ - codeValidation
195
74
steps :
196
75
- uses : actions/checkout@v3
197
76
- name : Build the Docker image
201
80
if : github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
202
81
runs-on : ubuntu-latest
203
82
needs :
204
- - pyTest
83
+ - codeValidation
205
84
permissions :
206
85
contents : write
207
86
pull-requests : write
@@ -222,7 +101,7 @@ jobs:
222
101
if : github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
223
102
runs-on : ubuntu-latest
224
103
needs :
225
- - pyLint
104
+ - codeValidation
226
105
permissions :
227
106
contents : write
228
107
pull-requests : write
@@ -243,7 +122,7 @@ jobs:
243
122
if : github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
244
123
runs-on : ubuntu-latest
245
124
needs :
246
- - flake8
125
+ - codeValidation
247
126
permissions :
248
127
contents : write
249
128
pull-requests : write
@@ -264,7 +143,7 @@ jobs:
264
143
if : github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
265
144
runs-on : ubuntu-latest
266
145
needs :
267
- - isort
146
+ - codeValidation
268
147
permissions :
269
148
contents : write
270
149
pull-requests : write
0 commit comments