1+ # https://docs.github.com/en/actions
2+
13name : Mutation tests
24
35on :
46 push :
5- branches : [master]
7+ branches :
8+ - master
9+ paths :
10+ - ' */classes/**.php'
611 pull_request :
7- branches : [master]
12+ branches :
13+ - master
14+ paths :
15+ - ' */classes/**.php'
816
917permissions :
1018 contents : read
1119
1220jobs :
13- tests :
14- name : Mutation tests with PHP ${{ matrix.php-version }}
21+ infection :
22+ name : Infection
1523 runs-on : ${{ matrix.operating-system }}
1624 strategy :
1725 matrix :
18- php-version : ["8.0"]
19- operating-system : [ubuntu-latest]
26+ php-version :
27+ - " 8.1"
28+ operating-system :
29+ - ubuntu-latest
2030 steps :
2131 - name : Checkout code
2232 uses : actions/checkout@v3
2333
24- - name : Fetch github.base_ref (for diffing)
25- if : ${{ github.base_ref != '' }}
26- run : |
27- git fetch --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
28-
2934 - name : Install Gettext
30- run : |
31- sudo apt-get install -y gettext
35+ run : sudo apt-get install -y gettext
3236
3337 - name : Generate mo files
3438 run : ./scripts/generate-mo --quiet
@@ -43,31 +47,26 @@ jobs:
4347
4448 - name : Install Infection
4549 # The GPG key can be found at https://infection.github.io/guide/installation.html
46- run : |
47- phive --no-progress install --target ./build/tools --trust-gpg-keys C5095986493B4AA0 infection
50+ run : phive --no-progress install --target ./build/tools --trust-gpg-keys C5095986493B4AA0 infection
4851
4952 - name : Install Composer dependencies
50- uses : ramsey/composer-install@v1
53+ uses : ramsey/composer-install@v2
5154 with :
5255 dependency-versions : highest
5356
5457 - name : Collect coverage report
55- run : |
56- composer run phpunit -- --testsuite unit --stop-on-failure
58+ run : composer run phpunit -- --testsuite unit --stop-on-failure
5759
58- - name : Infection
59- if : ${{ github.base_ref != '' }}
60+ - name : Run Infection for changed files only
61+ if : github.event_name == 'pull_request'
6062 run : |
61- CHANGED_FILES=$(git diff origin/$GITHUB_BASE_REF --diff-filter=AM --name-only | grep libraries/classes/ | paste -sd "," -);
62- ./build/tools/infection -j$(nproc) --skip-initial-tests --no-interaction --no-progress --coverage=build/logs \
63- --ignore-msi-with-no-mutations \
64- --filter=$CHANGED_FILES
65- env :
66- INFECTION_BADGE_API_KEY : ${{ secrets.INFECTION_BADGE_API_KEY }}
63+ git fetch --depth=1 origin $GITHUB_BASE_REF
64+ ./build/tools/infection -j$(nproc) --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF \
65+ --logger-github --ignore-msi-with-no-mutations --only-covered \
66+ --skip-initial-tests --coverage=build/logs --no-interaction --no-progress
6767
68- - name : Infection
69- if : ${{ github.base_ref == '' }}
70- run : |
71- ./build/tools/infection -j$(nproc) --skip-initial-tests --no-interaction --no-progress --coverage=build/logs
68+ - name : Run Infection
69+ if : github.event_name == 'push'
7270 env :
7371 INFECTION_BADGE_API_KEY : ${{ secrets.INFECTION_BADGE_API_KEY }}
72+ run : ./build/tools/infection -j$(nproc) --skip-initial-tests --coverage=build/logs --no-interaction --no-progress
0 commit comments