Skip to content

test: Force mutators to include remedies (#1954) #382

test: Force mutators to include remedies (#1954)

test: Force mutators to include remedies (#1954) #382

Workflow file for this run

# yamllint disable rule:line-length
# yamllint disable rule:braces
name: E2E Tests
on:
pull_request:
push:
branches:
- main
- master
jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-version: [ '8.1' ]
dependencies: [ locked ]
composer: [ 'composer' ]
coverage-driver: [ pcov, xdebug ]
e2e-runner: [ 'bin/infection' ]
include:
- { operating-system: 'windows-latest', php-version: '8.1', composer: 'composer', coverage-driver: 'xdebug', e2e-runner: 'bin/infection' }
- { operating-system: 'ubuntu-latest', php-version: '8.1', composer: 'composer', coverage-driver: 'pcov', e2e-runner: 'build/infection.phar' }
- { operating-system: 'ubuntu-latest', php-version: '8.1', composer: 'composer', coverage-driver: 'xdebug', e2e-runner: 'build/infection.phar' }
- { operating-system: 'ubuntu-latest', php-version: '8.2', composer: 'composer', coverage-driver: 'xdebug', e2e-runner: 'bin/infection' }
- { operating-system: 'ubuntu-latest', php-version: '8.3', composer: 'composer', coverage-driver: 'pcov', e2e-runner: 'bin/infection' }
name: E2E tests on ${{ matrix.operating-system }} with PHP ${{ matrix.php-version }} (${{ matrix.composer }}; ${{ matrix.dependencies }}), using ${{ matrix.coverage-driver }} with ${{ matrix.e2e-runner }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: ${{ matrix.coverage-driver }}
ini-values: memory_limit=512M, xdebug.mode=off
tools: ${{ matrix.composer }}
env:
# This is necessary when installing a tool with a specific version
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Remove the configured PHP platform
if: matrix.dependencies != 'locked'
run: composer config --unset platform.php
- name: Get composer cache directory
id: composer-cache
shell: bash
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.dependencies }} }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.dependencies }} }}-
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
- name: Install dependencies
if: ${{ matrix.dependencies == 'locked' }}
run: composer install --no-interaction --prefer-dist --no-progress
- name: Install highest dependencies
if: ${{ matrix.dependencies == 'highest' }}
run: composer update --no-interaction --prefer-dist --no-progress
- name: Install lowest dependencies
if: ${{ matrix.dependencies == 'lowest' }}
run: composer update --no-interaction --prefer-dist --no-progress --prefer-lowest
- name: Cache E2E tests dependencies
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: tests/e2e/*/vendor
key: e2e-vendor-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('tests/e2e/*/composer.json') }}
restore-keys: |
e2e-vendor-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('tests/e2e/*/composer.json') }}-
e2e-vendor-${{ runner.os }}-${{ matrix.php-version }}-
e2e-vendor-${{ runner.os }}-
composer-
- name: Install Composer dependencies for E2E tests
shell: bash
run: |
if [[ "${{ matrix.php-version }}" == '8.3' ]]; then
ls tests/e2e/*/composer.json | xargs dirname | xargs -I{} composer --working-dir={} config platform.php 8.2.99
ls tests/e2e/*/composer.json | xargs dirname | xargs -I{} composer --working-dir={} install --no-interaction --prefer-dist --no-progress
else
ls tests/e2e/*/composer.json | xargs dirname |
xargs -I{} composer --working-dir={} install --no-interaction --prefer-dist --no-progress
fi
- name: Run a subset of E2E tests
if: runner.os == 'Windows'
shell: bash
run: |
make test-e2e-phpunit PHP='phpdbg -qrr' E2E_PHPUNIT_GROUP=e2e BENCHMARK_SOURCES=
- name: Install Linux dependencies for E2E tests
if: runner.os != 'Windows'
run: |
sudo apt-get install -y --no-install-recommends expect
- name: Run the whole set of E2E tests
if: runner.os != 'Windows' && matrix.e2e-runner == 'bin/infection'
env:
TERM: xterm-256color
run: make test-e2e E2E_PHPUNIT_GROUP=e2e INFECTION=bin/infection
- name: Run the whole set of E2E tests with prefixed PHAR
if: runner.os != 'Windows' && matrix.e2e-runner == 'build/infection.phar' && (matrix.php-version == '8.0' || matrix.php-version == '8.1')
env:
TERM: xterm-256color
run: |
make compile
# test PHAR works from subfolder
cd build && ./infection.phar -V && cd ..
make test-e2e E2E_PHPUNIT_GROUP=e2e INFECTION=build/infection.phar BENCHMARK_SOURCES=
# This is a meta job to avoid to have to constantly change the protection rules
# whenever we touch the matrix.
tests-status:
name: E2E Tests Status
runs-on: ubuntu-latest
needs: tests
if: always()
steps:
- name: Successful run
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failing run
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1