-
-
Notifications
You must be signed in to change notification settings - Fork 7
90 lines (71 loc) · 2.33 KB
/
ci.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
name: CI
on:
pull_request:
push:
jobs:
test:
name: "PHPUnit PHP ${{ matrix.php }}"
strategy:
matrix:
php: [ 7.4, 8.0, 8.1, 8.2, 8.3 ]
include:
- php: '7.4'
coverage: true
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring
tools: composer, cs2pr
coverage: pcov
- uses: actions/checkout@v2
- name: Cache Composer cache
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: composer-cache-php${{ matrix.php }}
- name: Composer install
run: composer install --no-progress --no-suggest --no-interaction --prefer-dist --optimize-autoloader
- name: Enable code coverage
if: matrix.coverage
run: echo "COVERAGE=1" >> $GITHUB_ENV
- name: PHPUnit
run: |
mkdir -p build/logs/phpunit
if [ "$COVERAGE" = '1' ]; then
vendor/bin/phpunit --coverage-clover build/logs/phpunit/clover.xml --log-junit build/logs/phpunit/junit.xml --colors=always
else
vendor/bin/phpunit --log-junit build/logs/phpunit/junit.xml --colors=always
fi
- name: Upload coverage results to Codecov
if: matrix.coverage
uses: codecov/codecov-action@v1
with:
name: phpunit-php${{ matrix.php }}
flags: phpunit
fail_ci_if_error: true
continue-on-error: true
static-analysis:
name: "Static Analysis"
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: mbstring
tools: composer, cs2pr
- uses: actions/checkout@v2
- name: Cache Composer cache
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: composer-cache-php7.4
- name: Composer install
run: composer install --no-progress --no-suggest --no-interaction --prefer-dist --optimize-autoloader
- name: Psalm
run: php vendor/bin/psalm --threads=2 --output-format=github --shepherd --stats
- name: PHPStan
run: php vendor/bin/phpstan analyse --error-format=checkstyle --no-progress src/ tests/ | cs2pr