-
Notifications
You must be signed in to change notification settings - Fork 25
153 lines (131 loc) · 5.24 KB
/
test.yml
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
146
147
148
149
150
151
152
153
name: Run tests
on: [push, pull_request]
jobs:
unit-test:
name: Unit test${{ matrix.coverage && ' (with coverage)' || '' }}${{ matrix.random && ' (in random order)' || '' }} / PHP ${{ matrix.php }}
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. This avoids running the workflows twice in such a case.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
php: ['8.1','8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6']
coverage: [false]
random: [false]
include:
- php: '8.0'
coverage: true
- php: '8.0'
random: true
- php: '8.2'
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, iconv, json, libxml, zip
coverage: ${{ matrix.coverage && 'pcov' || 'none' }}
ini-values: pcov.directory=., error_reporting=E_ALL
tools: composer
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Configure Composer cache
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install
- name: Run tests
if: ${{ matrix.random == false && matrix.coverage == false }}
run: composer unit
- name: Run tests with coverage
if: ${{ matrix.random == false && matrix.coverage == true }}
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- name: Run tests in random order
if: ${{ matrix.random == true }}
run: vendor/bin/phpunit --order-by random
- name: Upload code coverage report
if: ${{ matrix.coverage == true }}
uses: codecov/[email protected]
with:
file: build/logs/clover.xml
flags: php
fail_ci_if_error: true
code-style:
name: Code style / PHP ${{ matrix.php }}
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. This avoids running the workflows twice in such a case.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
php: ['7.4']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, iconv, json, libxml, zip
tools: composer, cs2pr
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Configure Composer cache
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install
- name: Detect coding standard violations (PHPCS)
run: vendor/bin/phpcs -q --report=checkstyle --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 | cs2pr --graceful-warnings
static-analysis:
name: Static analysis / PHP ${{ matrix.php }}
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. This avoids running the workflows twice in such a case.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
php: ['8.0']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, iconv, json, libxml, zip
tools: composer, cs2pr, phpstan
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Configure Composer cache
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install
- name: Static Analysis (PHPStan)
if: ${{ matrix.php != '5.6' && matrix.php != '7.0' }}
run: |
phpstan --version
phpstan analyse --error-format=checkstyle | cs2pr