-
-
Notifications
You must be signed in to change notification settings - Fork 156
145 lines (124 loc) · 5.83 KB
/
e2e-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# 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