@@ -215,10 +215,10 @@ jobs:
215
215
if : ${{ contains(matrix.tox-env, 'gmpyp') }}
216
216
run : pip install gmpy
217
217
- name : Install gmpy2 dependencies
218
- if : ${{ contains(matrix.tox-env, 'gmpy2') || contains(matrix.tox-env, 'instrumental') }}
218
+ if : ${{ contains(matrix.tox-env, 'gmpy2') || contains(matrix.tox-env, 'instrumental') || matrix.mutation == 'true' }}
219
219
run : sudo apt-get install -y libmpfr-dev libmpc-dev
220
220
- name : Install gmpy2
221
- if : ${{ contains(matrix.tox-env, 'gmpy2') || contains(matrix.tox-env, 'instrumental') }}
221
+ if : ${{ contains(matrix.tox-env, 'gmpy2') || contains(matrix.tox-env, 'instrumental') || matrix.mutation == 'true' }}
222
222
run : pip install gmpy2
223
223
- name : Install build dependencies (2.6)
224
224
if : ${{ matrix.python-version == '2.6' }}
@@ -268,7 +268,8 @@ jobs:
268
268
- name : Install mutation testing dependencies
269
269
if : ${{ matrix.mutation == 'true' }}
270
270
run : |
271
- pip install cosmic-ray
271
+ pip install https://github.com/sixty-north/cosmic-ray/archive/master.zip
272
+ pip install pytest-timeout
272
273
- name : Display installed python package versions
273
274
run : pip list
274
275
- name : Test native speed
@@ -296,19 +297,40 @@ jobs:
296
297
cosmic-ray init cosmic-ray.toml session-vs-master.sqlite
297
298
git branch master origin/master
298
299
cr-filter-git --config cosmic-ray.toml session-vs-master.sqlite
299
- cr-report session-vs-master.sqlite | tail -n 5
300
+ cr-report session-vs-master.sqlite | tail -n 3
300
301
- name : Exec mutation testing for PR
301
302
if : ${{ matrix.mutation == 'true' && github.event.pull_request }}
302
303
run : |
303
- cosmic-ray exec cosmic-ray.toml session-vs-master.sqlite
304
+ systemd-run --user --scope -p MemoryMax=2G -p MemoryHigh=2G cosmic-ray --verbosity INFO exec cosmic-ray.toml session-vs-master.sqlite &
305
+ cosmic_pid=$!
306
+ for i in $(seq 1 600); do
307
+ # wait for test execution at most 10 minutes
308
+ kill -s 0 $cosmic_pid || break
309
+ sleep 1
310
+ done
311
+ kill $cosmic_pid || true
312
+ wait $cosmic_pid || true
304
313
- name : Check test coverage for PR
305
314
if : ${{ matrix.mutation == 'true' && github.event.pull_request }}
306
315
run : |
307
316
# remove not-executed results
308
317
sqlite3 session-vs-master.sqlite "DELETE from work_results WHERE work_results.worker_outcome = 'SKIPPED'"
309
- cr-report session-vs-master.sqlite | tail -n 5
310
- # check if executed have at most 5% survival rate
311
- cr-rate --fail-over 5 session-vs-master.sqlite
318
+ cr-report session-vs-master.sqlite | tail -n 3
319
+ - name : Generate html report
320
+ if : ${{ matrix.mutation == 'true' && github.event.pull_request }}
321
+ run : |
322
+ cr-html session-vs-master.sqlite > cosmic-ray.html
323
+ - name : Archive mutation testing results
324
+ if : ${{ matrix.mutation == 'true' && github.event.pull_request }}
325
+ uses : actions/upload-artifact@v3
326
+ with :
327
+ name : mutation-PR-coverage-report
328
+ path : cosmic-ray.html
329
+ - name : Check test coverage for PR
330
+ if : ${{ matrix.mutation == 'true' && github.event.pull_request }}
331
+ run : |
332
+ # check if executed have at most 50% survival rate
333
+ cr-rate --estimate --confidence 99.9 --fail-over 50 session-vs-master.sqlite
312
334
- name : instrumental test coverage on PR
313
335
if : ${{ contains(matrix.opt-deps, 'instrumental') && github.event.pull_request }}
314
336
env :
@@ -372,6 +394,9 @@ jobs:
372
394
373
395
mutation-prepare :
374
396
name : Prepare job files for the mutation runners
397
+ # use runner minutes on mutation testing only after the PR passed basic
398
+ # testing
399
+ needs : coveralls
375
400
runs-on : ubuntu-latest
376
401
steps :
377
402
- uses : actions/checkout@v2
@@ -386,7 +411,8 @@ jobs:
386
411
key : sessions-${{ github.sha }}
387
412
- name : Install cosmic-ray
388
413
run : |
389
- pip3 install cosmic-ray
414
+ pip3 install https://github.com/sixty-north/cosmic-ray/archive/master.zip
415
+ pip install pytest-timeout
390
416
- name : Install dependencies
391
417
run : |
392
418
sudo apt-get install -y sqlite3
@@ -461,7 +487,8 @@ jobs:
461
487
- name : Install build dependencies
462
488
run : |
463
489
pip install -r build-requirements.txt
464
- pip install cosmic-ray
490
+ pip install https://github.com/sixty-north/cosmic-ray/archive/master.zip
491
+ pip install pytest-timeout
465
492
- name : Run mutation testing
466
493
run : |
467
494
cp sessions/session-${{ matrix.name }}.sqlite session.sqlite
@@ -608,7 +635,8 @@ jobs:
608
635
key : sessions-${{ github.sha }}-19-done
609
636
- name : Install cosmic-ray
610
637
run : |
611
- pip3 install cosmic-ray
638
+ pip3 install https://github.com/sixty-north/cosmic-ray/archive/master.zip
639
+ pip install pytest-timeout
612
640
- name : Install dependencies
613
641
run : |
614
642
sudo apt-get install -y sqlite3
@@ -621,13 +649,20 @@ jobs:
621
649
- name : Report executed
622
650
run : |
623
651
cr-report session.sqlite | tail -n 3
624
- - name : Log survival estimate
625
- run : cr-rate --estimate --fail-over 32 --confidence 99.9 session.sqlite || true
652
+ - name : Generate html report
653
+ run : |
654
+ cr-html session.sqlite > cosmic-ray.html
655
+ - name : Archive mutation testing results
656
+ uses : actions/upload-artifact@v3
657
+ with :
658
+ name : mutation-coverage-report
659
+ path : cosmic-ray.html
626
660
- name : Get mutation score
627
661
run : |
628
- echo "print(100-$(cr-rate session.sqlite))" > print-score.py
662
+ echo "print('{0:.2f}'.format( 100-$(cr-rate session.sqlite) ))" > print-score.py
629
663
echo "MUT_SCORE=$(python print-score.py)" >> $GITHUB_ENV
630
664
- name : Create mutation score badge
665
+ if : ${{ !github.event.pull_request }}
631
666
uses :
schneegans/[email protected]
632
667
with :
633
668
auth : ${{ secrets.GIST_SECRET }}
@@ -638,3 +673,5 @@ jobs:
638
673
valColorRange : ${{ env.MUT_SCORE }}
639
674
maxColorRange : 100
640
675
minColorRange : 0
676
+ - name : Check survival estimate
677
+ run : cr-rate --estimate --fail-over 32 --confidence 99.9 session.sqlite
0 commit comments