forked from infection/infection
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (106 loc) · 4.58 KB
/
ci.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
# yamllint disable rule:line-length
# yamllint disable rule:braces
name: Tests
on:
pull_request:
push:
branches:
- main
- master
jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['7.4']
coverage-driver: [pcov, xdebug]
e2e-runner: ['bin/infection']
include:
- { operating-system: 'windows-latest', php-version: '7.4', coverage-driver: 'xdebug' }
- { operating-system: 'ubuntu-latest', php-version: '7.4', coverage-driver: 'pcov' }
- { operating-system: 'ubuntu-latest', php-version: '8.0', coverage-driver: 'pcov', e2e-runner: 'build/infection.phar' }
- { operating-system: 'ubuntu-latest', php-version: '8.1', coverage-driver: 'pcov' }
name: CI on ${{ matrix.operating-system }} with PHP ${{ matrix.php-version }}, using ${{ matrix.coverage-driver }} with ${{ matrix.e2e-runner }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- 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: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}-
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist --no-progress
- name: Run tests
shell: bash
run: |
# Required as long as "PHPUnit\Runner\DefaultTestResultCache implements the Serializable interface, which is deprecated.
# Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)" is not fixed
if [[ "${{ matrix.php-version }}" == '8.1' ]]; then
export SYMFONY_DEPRECATIONS_HELPER=max[direct]=1
fi
make test-unit
- name: Cache E2E tests dependencies
if: runner.os == 'Windows'
uses: actions/cache@v2
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: |
ls tests/e2e/*/composer.json | xargs dirname |
xargs -I{} composer --working-dir={} install --no-interaction --prefer-dist --no-progress
- 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 != 'bin/infection' && matrix.php-version == '8.0'
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=
- name: Run integration tests
shell: bash
run: |
if [[ "${{ matrix.php-version }}" == '8.1' ]]; then
export SYMFONY_DEPRECATIONS_HELPER=max[direct]=1
fi
make test-unit PHPUNIT_GROUP=integration