@@ -215,10 +215,10 @@ jobs:
215215 if : ${{ contains(matrix.tox-env, 'gmpyp') }}
216216 run : pip install gmpy
217217 - 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' }}
219219 run : sudo apt-get install -y libmpfr-dev libmpc-dev
220220 - 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' }}
222222 run : pip install gmpy2
223223 - name : Install build dependencies (2.6)
224224 if : ${{ matrix.python-version == '2.6' }}
@@ -268,7 +268,8 @@ jobs:
268268 - name : Install mutation testing dependencies
269269 if : ${{ matrix.mutation == 'true' }}
270270 run : |
271- pip install cosmic-ray
271+ pip install https://github.com/sixty-north/cosmic-ray/archive/master.zip
272+ pip install pytest-timeout
272273 - name : Display installed python package versions
273274 run : pip list
274275 - name : Test native speed
@@ -296,19 +297,40 @@ jobs:
296297 cosmic-ray init cosmic-ray.toml session-vs-master.sqlite
297298 git branch master origin/master
298299 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
300301 - name : Exec mutation testing for PR
301302 if : ${{ matrix.mutation == 'true' && github.event.pull_request }}
302303 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
304313 - name : Check test coverage for PR
305314 if : ${{ matrix.mutation == 'true' && github.event.pull_request }}
306315 run : |
307316 # remove not-executed results
308317 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
312334 - name : instrumental test coverage on PR
313335 if : ${{ contains(matrix.opt-deps, 'instrumental') && github.event.pull_request }}
314336 env :
@@ -372,6 +394,9 @@ jobs:
372394
373395 mutation-prepare :
374396 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
375400 runs-on : ubuntu-latest
376401 steps :
377402 - uses : actions/checkout@v2
@@ -386,7 +411,8 @@ jobs:
386411 key : sessions-${{ github.sha }}
387412 - name : Install cosmic-ray
388413 run : |
389- pip3 install cosmic-ray
414+ pip3 install https://github.com/sixty-north/cosmic-ray/archive/master.zip
415+ pip install pytest-timeout
390416 - name : Install dependencies
391417 run : |
392418 sudo apt-get install -y sqlite3
@@ -461,7 +487,8 @@ jobs:
461487 - name : Install build dependencies
462488 run : |
463489 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
465492 - name : Run mutation testing
466493 run : |
467494 cp sessions/session-${{ matrix.name }}.sqlite session.sqlite
@@ -608,7 +635,8 @@ jobs:
608635 key : sessions-${{ github.sha }}-19-done
609636 - name : Install cosmic-ray
610637 run : |
611- pip3 install cosmic-ray
638+ pip3 install https://github.com/sixty-north/cosmic-ray/archive/master.zip
639+ pip install pytest-timeout
612640 - name : Install dependencies
613641 run : |
614642 sudo apt-get install -y sqlite3
@@ -621,13 +649,20 @@ jobs:
621649 - name : Report executed
622650 run : |
623651 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
626660 - name : Get mutation score
627661 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
629663 echo "MUT_SCORE=$(python print-score.py)" >> $GITHUB_ENV
630664 - name : Create mutation score badge
665+ if : ${{ !github.event.pull_request }}
631666 uses :
schneegans/[email protected] 632667 with :
633668 auth : ${{ secrets.GIST_SECRET }}
@@ -638,3 +673,5 @@ jobs:
638673 valColorRange : ${{ env.MUT_SCORE }}
639674 maxColorRange : 100
640675 minColorRange : 0
676+ - name : Check survival estimate
677+ run : cr-rate --estimate --fail-over 32 --confidence 99.9 session.sqlite
0 commit comments