-
Notifications
You must be signed in to change notification settings - Fork 4
98 lines (83 loc) · 3.82 KB
/
Copy pathphp-qa.yml
File metadata and controls
98 lines (83 loc) · 3.82 KB
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
name: PHP Quality Assurance
on:
push:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
static-qa:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'skip qa') }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
tools: cs2pr
- name: Install dependencies
uses: ramsey/composer-install@v2
- name: Check code styles
run: |
./vendor/bin/phpcs -q --report-full --report-checkstyle="phpcs-report.xml" --runtime-set testVersion 7.2- --runtime-set ignore_errors_on_exit 1
cs2pr --graceful-warnings phpcs-report.xml
- name: Check Psalm
run: ./vendor/bin/psalm --output-format=github --no-cache
unit-tests:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'skip tests') }}
env:
USE_COVERAGE: 'no'
strategy:
fail-fast: false
matrix:
php-ver: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
dependency-versions: [ 'lowest', 'highest' ]
experimental: [ false ]
include:
- php-ver: '8.2'
dependency-versions: 'highest'
composer-options: '--ignore-platform-reqs'
experimental: true
continue-on-error: ${{ matrix.experimental == true }}
steps:
- name: Update "USE_COVERAGE" env var based on matrix
if: ${{ matrix.php-ver == '7.4' && matrix.dependency-versions == 'highest' }}
run: echo "USE_COVERAGE=yes" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-ver }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: ${{ ((env.USE_COVERAGE == 'yes') && 'xdebug') || 'none' }}
tools: cs2pr
- name: Install parallel-lint
if: ${{ matrix.dependency-versions == 'highest' }}
run: composer require php-parallel-lint/php-parallel-lint:^1.3.1 --dev --no-update
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependency-versions }}
composer-options: ${{ matrix.composer-options }}
- name: Lint PHP sources
if: ${{ matrix.dependency-versions == 'highest' }}
run: ./vendor/bin/parallel-lint ./src/ --checkstyle | cs2pr
- name: Check if PHPUnit 9 is installed
id: phpunit_ver
run: echo ::set-output name=is_phpunit_9::$(./vendor/bin/phpunit --version | grep -c '9\.')
- name: Migrate PHPUnit configuration (PHPUnit 9)
if: ${{ steps.phpunit_ver.outputs.is_phpunit_9 != 0 }}
run: ./vendor/bin/phpunit --migrate-configuration
- name: Run unit tests
run: ./vendor/bin/phpunit --testsuite=unit ${{ ((env.USE_COVERAGE == 'yes') && '--coverage-clover=coverage.xml') || '--no-coverage' }}
- name: Update codecov.io
uses: codecov/codecov-action@v2
if: ${{ env.USE_COVERAGE == 'yes' }}
with:
file: ./coverage.xml