-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (79 loc) · 3.25 KB
/
qa.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
name: Quality Assurance
on:
push:
paths:
- '**workflows/qa.yml'
- '**.php'
- '**phpcs.xml.dist'
- '**phpunit.xml.dist'
- '**psalm.xml'
- '**composer.json'
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: 8.0
coverage: none
tools: cs2pr
- name: Install dependencies
uses: ramsey/composer-install@v2
- name: Check code styles
run: ./vendor/bin/phpcs --report=checkstyle -q | cs2pr
- name: Static analysis via Psalm
run: ./vendor/bin/psalm --output-format=github
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: [ '8.0', '8.1' ]
dependency-versions: [ 'lowest', 'highest' ]
experimental: [ false ]
include:
- php-ver: '8.2'
dependency-versions: 'highest'
experimental: true
continue-on-error: ${{ matrix.experimental == true }}
steps:
- name: Update "USE_COVERAGE" env var based on matrix
if: ${{ matrix.php-ver == '8.0' && 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, parallel-lint
- name: Lint PHP sources
if: ${{ matrix.dependency-versions == 'highest' }}
run: parallel-lint . --checkstyle | cs2pr
- name: Remove unused dev dependencies that conflict with PHP version
run: composer remove vimeo/psalm inpsyde/php-coding-standards --dev --no-update
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependency-versions }}
- name: Run unit tests
run: ./vendor/bin/phpunit ${{ ((env.USE_COVERAGE == 'yes') && '--coverage-clover=coverage.xml') || '--no-coverage' }}
- name: Update codecov.io
uses: codecov/codecov-action@v3
if: ${{ env.USE_COVERAGE == 'yes' }}
with:
file: ./coverage.xml