|
| 1 | +name: Mutation tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + pull_request: |
| 7 | + branches: [master] |
| 8 | + |
| 9 | +jobs: |
| 10 | + tests: |
| 11 | + name: Mutation tests with PHP ${{ matrix.php-version }} |
| 12 | + |
| 13 | + runs-on: ${{ matrix.operating-system }} |
| 14 | + |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + php-version: ["8.0"] |
| 18 | + operating-system: [ubuntu-latest] |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v2 |
| 23 | + |
| 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 | +
|
| 29 | + - name: Install PHP ${{ matrix.php-version }} |
| 30 | + uses: shivammathur/setup-php@v2 |
| 31 | + with: |
| 32 | + php-version: ${{ matrix.php-version }} |
| 33 | + coverage: pcov |
| 34 | + ini-values: memory_limit=-1 |
| 35 | + tools: composer:v2, phive |
| 36 | + |
| 37 | + - name: Install Infection |
| 38 | + # The GPG key can be found at https://infection.github.io/guide/installation.html |
| 39 | + run: | |
| 40 | + phive --no-progress install --target ./build/tools --trust-gpg-keys C5095986493B4AA0 infection |
| 41 | +
|
| 42 | + - name: Get Composer cache directory |
| 43 | + id: composer-cache |
| 44 | + run: | |
| 45 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 46 | +
|
| 47 | + - name: Cache dependencies |
| 48 | + uses: actions/cache@v2 |
| 49 | + with: |
| 50 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 51 | + key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }} |
| 52 | + restore-keys: | |
| 53 | + composer-${{ runner.os }}-${{ matrix.php-version }}- |
| 54 | +
|
| 55 | + - name: Install dependencies |
| 56 | + run: | |
| 57 | + composer update --no-interaction --no-progress |
| 58 | +
|
| 59 | + - name: Collect coverage report |
| 60 | + run: | |
| 61 | + ./vendor/bin/phpunit --stop-on-failure |
| 62 | +
|
| 63 | + - name: Infection |
| 64 | + if: ${{ github.base_ref != '' }} |
| 65 | + run: | |
| 66 | + CHANGED_FILES=$(git diff origin/$GITHUB_BASE_REF --diff-filter=AM --name-only | grep src/ | paste -sd "," -); |
| 67 | + ./build/tools/infection -j$(nproc) --skip-initial-tests --no-interaction --no-progress --coverage=build/logs \ |
| 68 | + --ignore-msi-with-no-mutations \ |
| 69 | + --filter=$CHANGED_FILES |
| 70 | + env: |
| 71 | + INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} |
| 72 | + |
| 73 | + - name: Infection |
| 74 | + if: ${{ github.base_ref == '' }} |
| 75 | + run: | |
| 76 | + ./build/tools/infection -j$(nproc) --skip-initial-tests --no-interaction --no-progress --coverage=build/logs |
| 77 | + env: |
| 78 | + INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} |
0 commit comments