-
-
Notifications
You must be signed in to change notification settings - Fork 41
130 lines (109 loc) · 3.71 KB
/
build-and-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
name: Build and test
on: [push, pull_request]
jobs:
build:
name: Build (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Get composer cache directory
id: composer-cache
run: |
dir="$(composer config cache-files-dir)"
echo "dir=$dir" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
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 --no-progress --prefer-dist --optimize-autoloader
test:
name: Tests (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
php-versions: ['8.1', '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP with PCOV
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: php-cs-fixer, phpunit-bridge
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
coverage: pcov
#ini-values: post_max_size=256M, max_execution_time=180
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run unit tests with coverage
run: ./vendor/bin/phpunit
- name: Determine coverage badge
uses: timkrase/phpunit-coverage-badge@main
with:
push_badge: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
qa-phpstan:
name: QA - Run phpstan (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run phpstan
run: ./vendor/bin/phpstan analyse -c ./phpstan.neon --level 6 src
qa-psalm:
name: QA - Run psalm (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run psalm
run: ./vendor/bin/psalm
qa-phpcpd:
name: QA - Run phpcpd (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run phpcpd
run: ./vendor/bin/phpcpd ./src/
qa-cs-fixer:
name: QA - Run php-cs-fixer (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run php-cs-fixer
run: ./vendor/bin/php-cs-fixer fix --verbose --allow-risky=yes --dry-run --config ".php-cs-fixer.dist"