@@ -70,11 +70,19 @@ jobs:
70
70
task : ' ci-compile'
71
71
python-version-short : ' 3.8'
72
72
python-version : ' 3.8.10'
73
+ - name : ' Lint Checks (black, flake8, etc.)'
74
+ task : ' ci-checks'
75
+ python-version-short : ' 3.9'
76
+ python-version : ' 3.9.14'
77
+ - name : ' Compile (pip deps, pylint, etc.)'
78
+ task : ' ci-compile'
79
+ python-version-short : ' 3.9'
80
+ python-version : ' 3.9.14'
73
81
74
82
env :
75
83
TASK : ' ${{ matrix.task }}'
76
84
COLUMNS : ' 120'
77
- PYLINT_CONCURRENCY : ' 4 '
85
+ PYLINT_CONCURRENCY : ' 6 '
78
86
steps :
79
87
- name : Checkout repository
80
88
uses : actions/checkout@v2
@@ -136,6 +144,160 @@ jobs:
136
144
run : |
137
145
./scripts/ci/run-nightly-make-task-if-exists.sh "${TASK}"
138
146
147
+ self-check :
148
+ needs : pre_job
149
+ name : ' ${{ matrix.name }} - Python ${{ matrix.python-version-short }}'
150
+ runs-on : ubuntu-20.04
151
+ strategy :
152
+ fail-fast : false
153
+ matrix :
154
+ include :
155
+ # TODO: Check if we want to fix the errors on Py 3.6 to have it tested as well
156
+ # - name: 'Self-check on Python 3.6'
157
+ # python-version-short: '3.6'
158
+ # python-version: '3.6.13'
159
+ - name : ' Self-check on Python 3.8'
160
+ python-version-short : ' 3.8'
161
+ python-version : ' 3.8.14'
162
+ services :
163
+ mongo :
164
+ image : mongo:4.4
165
+ ports :
166
+ - 27017:27017
167
+
168
+ rabbitmq :
169
+ image : rabbitmq:3.8-management
170
+ options : >-
171
+ --name rabbitmq
172
+ ports :
173
+ - 5671:5671/tcp # AMQP SSL port
174
+ - 5672:5672/tcp # AMQP standard port
175
+ - 15672:15672/tcp # Management: HTTP, CLI
176
+
177
+ env :
178
+ # CI st2.conf (with ST2_CI_USER user instead of stanley)
179
+ ST2_CONF : ' conf/st2.ci.conf'
180
+
181
+ # Name of the user who is running the CI (on GitHub Actions this is 'runner')
182
+ ST2_CI_USER : ' runner'
183
+
184
+ # GitHub is juggling how to set vars for multiple shells. Protect our PATH assumptions.
185
+ PATH : /home/runner/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
186
+
187
+ # Space separated list of tests to be skipped if the self-check is running in GitHub Actions
188
+ TESTS_TO_SKIP : " tests.test_quickstart_rules tests.test_run_pack_tests_tool"
189
+ steps :
190
+ - name : Checkout repository
191
+ uses : actions/checkout@v2
192
+ - name : Custom Environment Setup
193
+ run : |
194
+ ./scripts/github/setup-environment.sh
195
+ - name : ' Set up Python (${{ matrix.python-version }})'
196
+ uses : actions/setup-python@v2
197
+ with :
198
+ python-version : ' ${{ matrix.python-version }}'
199
+ - name : Cache Python Dependencies
200
+ uses : actions/cache@v2
201
+ with :
202
+ path : |
203
+ ~/.cache/pip
204
+ virtualenv
205
+ ~/virtualenv
206
+ # TODO: maybe make the virtualenv a partial cache to exclude st2*?
207
+ # !virtualenv/lib/python*/site-packages/st2*
208
+ # !virtualenv/bin/st2*
209
+ key : ${{ runner.os }}-v3-python-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'test-requirements.txt') }}
210
+ restore-keys : |
211
+ ${{ runner.os }}-python-${{ matrix.python }}-
212
+ - name : Cache APT Dependencies
213
+ id : cache-apt-deps
214
+ uses : actions/cache@v2
215
+ with :
216
+ path : |
217
+ ~/apt_cache
218
+ key : ${{ runner.os }}-apt-v5-${{ hashFiles('scripts/github/apt-packages.txt') }}
219
+ restore-keys : |
220
+ ${{ runner.os }}-apt-v5-
221
+ - name : Install APT Depedencies
222
+ env :
223
+ CACHE_HIT : ${{steps.cache-apt-deps.outputs.cache-hit}}
224
+ run : |
225
+ cat /etc/environment
226
+ # install dev dependencies for Python YAML and LDAP packages
227
+ # https://github.com/StackStorm/st2-auth-ldap
228
+ ./scripts/github/install-apt-packages-use-cache.sh
229
+ - name : Install virtualenv
230
+ run : |
231
+ ./scripts/github/install-virtualenv.sh
232
+ - name : Install requirements
233
+ run : |
234
+ ./scripts/ci/install-requirements.sh
235
+ - name : Run Redis Service Container
236
+ timeout-minutes : 2
237
+ run : |
238
+ docker run --rm --detach -p 127.0.0.1:6379:6379/tcp --name redis redis:latest
239
+ until [ "$(docker inspect -f {{.State.Running}} redis)" == "true" ]; do sleep 0.1; done
240
+ - name : Setup Tests
241
+ run : |
242
+ # prep a ci-specific dev conf file that uses runner instead of stanley
243
+ # this user is the username of the user in GitHub actions, used for SSH, etc during
244
+ # integration tests (important)
245
+ cp conf/st2.dev.conf "${ST2_CONF}"
246
+ sed -i -e "s,/home/vagrant/.ssh/stanley_rsa,/home/stanley/.ssh/stanley_rsa," "${ST2_CONF}"
247
+
248
+ sudo -E ./scripts/ci/add-itest-user-key.sh
249
+ - name : Permissions Workaround
250
+ run : |
251
+ sudo ST2_CI_REPO_PATH="${ST2_CI_REPO_PATH}" scripts/ci/permissions-workaround.sh
252
+ - name : Reconfigure RabbitMQ
253
+ # bitnami image allows (see bitnami/rabbitmq readme):
254
+ # Here we're copying a rabbitmq.config file which won't do anything.
255
+ # We need to switch to custom.conf or advanced.config.
256
+ timeout-minutes : 2 # may die if rabbitmq fails to start
257
+ run : |
258
+ ./scripts/github/configure-rabbitmq.sh
259
+ - name : Print versions
260
+ run : |
261
+ ./scripts/ci/print-versions.sh
262
+ - name : make
263
+ timeout-minutes : 14 # may die if rabbitmq fails to start
264
+ # use: script -e -c to print colors
265
+ run : |
266
+ script -e -c "make .ci-prepare-integration" && exit 0
267
+ - name : Extend the path for upcoming tasks
268
+ run : |
269
+ echo ${HOME}/work/st2/st2/virtualenv/bin
270
+ echo ${HOME}/work/st2/st2/virtualenv/bin >> $GITHUB_PATH
271
+ - name : Create symlinks to find the binaries when running st2 actions
272
+ run : |
273
+ ln -s ${HOME}/work/st2/st2/virtualenv/bin/st2 /usr/local/bin/st2
274
+ ln -s ${HOME}/work/st2/st2/virtualenv/bin/st2-run-pack-tests /usr/local/bin/st2-run-pack-tests
275
+ - name : Install st2client
276
+ timeout-minutes : 5
277
+ run : |
278
+ cd ./st2client
279
+ pip3 install --upgrade pip
280
+ python3 setup.py develop
281
+ - name : Run self-verification script
282
+ env :
283
+ ST2_CONF : /home/runner/work/st2/st2/conf/st2.ci.conf
284
+ run : |
285
+ sudo -E ST2_AUTH_TOKEN=$(st2 auth testu -p 'testp' -t) PATH=${PATH} virtualenv/bin/st2-self-check
286
+ - name : Compress Service Logs Before upload
287
+ if : ${{ failure() }}
288
+ run : |
289
+ tar cvzpf logs.tar.gz logs/*
290
+ - name : Upload StackStorm services Logs
291
+ if : ${{ failure() }}
292
+ uses : actions/upload-artifact@v2
293
+ with :
294
+ name : logs
295
+ path : logs.tar.gz
296
+ retention-days : 7
297
+ - name : Stop Redis Service Container
298
+ if : " ${{ always() }}"
299
+ run : docker rm --force redis || true
300
+
139
301
unit-tests :
140
302
needs : pre_job
141
303
# NOTE: We always want to run job on master since we run some additional checks there (code
@@ -174,6 +336,18 @@ jobs:
174
336
nosetests_node_index : 1
175
337
python-version-short : ' 3.8'
176
338
python-version : ' 3.8.10'
339
+ - name : ' Unit Tests (chunk 1)'
340
+ task : ' ci-unit'
341
+ nosetests_node_total : 2
342
+ nosetests_node_index : 0
343
+ python-version-short : ' 3.9'
344
+ python-version : ' 3.9.14'
345
+ - name : ' Unit Tests (chunk 2)'
346
+ task : ' ci-unit'
347
+ nosetests_node_total : 2
348
+ nosetests_node_index : 1
349
+ python-version-short : ' 3.9'
350
+ python-version : ' 3.9.14'
177
351
# This job is slow so we only run in on a daily basis
178
352
# - name: 'Micro Benchmarks'
179
353
# task: 'micro-benchmarks'
@@ -197,7 +371,7 @@ jobs:
197
371
198
372
env :
199
373
TASK : ' ${{ matrix.task }}'
200
-
374
+ PYTHON_VERSION_SHORT : ' ${{ matrix.python-version-short }} '
201
375
NODE_TOTAL : ' ${{ matrix.nosetests_node_total }}'
202
376
NODE_INDEX : ' ${{ matrix.nosetests_node_index }}'
203
377
@@ -304,9 +478,11 @@ jobs:
304
478
./scripts/ci/run-nightly-make-task-if-exists.sh "${TASK}"
305
479
- name : Codecov
306
480
# NOTE: We only generate and submit coverage report for master and version branches and only when the build succeeds (default on GitHub Actions, this was not the case on Travis so we had to explicitly check success)
307
- if : " ${{ success() && (env.ENABLE_COVERAGE == 'yes') }}"
481
+ if : " ${{ success() && (env.ENABLE_COVERAGE == 'yes') && (env.PYTHON_VERSION_SHORT == '3.8') }}"
308
482
run : |
309
483
./scripts/ci/submit-codecov-coverage.sh
484
+ env :
485
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
310
486
311
487
integration-tests :
312
488
needs : pre_job
@@ -359,6 +535,24 @@ jobs:
359
535
nosetests_node_index : 1
360
536
python-version-short : ' 3.8'
361
537
python-version : ' 3.8.10'
538
+ - name : ' Pack Tests'
539
+ task : ' ci-packs-tests'
540
+ nosetests_node_total : 1
541
+ nosetests_node_index : 0
542
+ python-version-short : ' 3.9'
543
+ python-version : ' 3.9.14'
544
+ - name : ' Integration Tests (chunk 1)'
545
+ task : ' ci-integration'
546
+ nosetests_node_total : 2
547
+ nosetests_node_index : 0
548
+ python-version-short : ' 3.9'
549
+ python-version : ' 3.9.14'
550
+ - name : ' Integration Tests (chunk 2)'
551
+ task : ' ci-integration'
552
+ nosetests_node_total : 2
553
+ nosetests_node_index : 1
554
+ python-version-short : ' 3.9'
555
+ python-version : ' 3.9.14'
362
556
services :
363
557
mongo :
364
558
image : mongo:4.4
@@ -414,7 +608,7 @@ jobs:
414
608
415
609
env :
416
610
TASK : ' ${{ matrix.task }}'
417
-
611
+ PYTHON_VERSION_SHORT : ' ${{ matrix.python-version-short }} '
418
612
NODE_TOTAL : ' ${{ matrix.nosetests_node_total }}'
419
613
NODE_INDEX : ' ${{ matrix.nosetests_node_index }}'
420
614
@@ -523,9 +717,11 @@ jobs:
523
717
script -e -c "make ${TASK}" && exit 0
524
718
- name : Codecov
525
719
# NOTE: We only generate and submit coverage report for master and version branches and only when the build succeeds (default on GitHub Actions, this was not the case on Travis so we had to explicitly check success)
526
- if : " ${{ success() && env.ENABLE_COVERAGE == 'yes' && env.TASK == 'ci-integration' }}"
720
+ if : " ${{ success() && ( env.ENABLE_COVERAGE == 'yes') && ( env.TASK == 'ci-integration') && (env.PYTHON_VERSION_SHORT == '3.8') }}"
527
721
run : |
528
722
./scripts/ci/submit-codecov-coverage.sh
723
+ env :
724
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
529
725
- name : Compress Service Logs Before upload
530
726
if : ${{ failure() && env.TASK == 'ci-integration' }}
531
727
run : |
0 commit comments