-
Notifications
You must be signed in to change notification settings - Fork 6
194 lines (167 loc) · 7.39 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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: CI
on:
schedule:
- cron: '0 17 * * 4'
push:
pull_request:
branches:
- main
- dev
permissions:
contents: read
jobs:
stable-build:
runs-on: ubuntu-latest
name: PHP 8.3 - Doctrine Lexer 3.0
env:
HAS_CC_SECRET: ${{secrets.CC_TEST_REPORTER_ID != '' }}
HAS_CA_SECRET: ${{secrets.COVERALLS_REPO_TOKEN != '' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate composer.json
run: composer validate --strict
- name: Display Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer packages
id: composer-cache-stable
uses: actions/cache@v4
with:
path: vendor
key: ${{ format('{0}_php_lexer_stable_', runner.os, hashFiles('**/composer.lock')) }}
restore-keys: |
${{ format('{0}-php-lexer-stable-', runner.os) }}
- name: Set up PHP 8.3
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: pcov
tools: composer:v2
- name: Install dependencies
run: composer --prefer-source update
- name: Show libraries
run: composer show
- name: Run test with coverage
uses: paambaati/[email protected]
if: env.HAS_CC_SECRET == 'true'
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
coverageCommand: vendor/bin/phpunit --coverage-clover=.phpunit.cache/clover-8.3.xml
coverageLocations: ${{github.workspace}}/.phpunit.cache/clover*.xml:clover
- name: Run tests for forks
if: env.HAS_CC_SECRET != 'true'
run: vendor/bin/phpunit
- name: Coveralls.io steps
if: ${{ env.HAS_CA_SECRET == 'true' }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
file: ${{github.workspace}}/.phpunit.cache/clover-8.3.xml
## Quality checks
## PHP-CS-Fixer
- name: Cache Composer PHP-CS-FIXER packages
id: composer-phpcsfixer-cache
uses: actions/cache@v4
with:
path: quality/php-cs-fixer/vendor/
key: ${{ format('{0}-phpcsfixer-{1}', runner.os, hashFiles('**/composer.lock')) }}
restore-keys: |
${{ format('{0}-phpcsfixer-', runner.os) }}
- name: Install PHP-CS-Fixer
run: composer update --working-dir=quality/php-cs-fixer
- name: Run PHP-CS-Fixer
run: ./quality/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=quality/php-cs-fixer/.php-cs-fixer.php --dry-run --allow-risky=yes
## PHP-MESS-DETECTOR
- name: Cache Composer PHP-MESS-DETECTOR packages
id: composer-phpmd-cache
uses: actions/cache@v4
with:
path: quality/php-cs-fixer/vendor/
key: ${{ format('{0}-phpmd-{1}', runner.os, hashFiles('**/composer.lock')) }}
restore-keys: |
${{ format('{0}-phpmd-', runner.os) }}
- name: Install PHP-MESS-DETECTOR
run: composer update --working-dir=quality/php-mess-detector
- name: Run PHP-MESS-DETECTOR on lib directory
run: ./quality/php-mess-detector/vendor/bin/phpmd lib text quality/php-mess-detector/ruleset.xml
- name: Run PHP-MESS-DETECTOR on tests directory
run: ./quality/php-mess-detector/vendor/bin/phpmd tests text quality/php-mess-detector/test-ruleset.xml
## PHP-STAN
- name: Cache Composer PHP-STAN packages
id: composer-php-stan-cache
uses: actions/cache@v4
with:
path: quality/php-cs-fixer/vendor/
key: ${{ format('{0}-phpstan-{1}', runner.os, hashFiles('**/composer.lock')) }}
restore-keys: |
${{ format('{0}-phpstan-', runner.os) }}
- name: Install PHP-STAN
run: composer update --working-dir=quality/php-stan
- name: Run PHP-STAN
run: ./quality/php-stan/vendor/bin/phpstan analyse --configuration=quality/php-stan/php-stan.neon lib tests --error-format=table --no-progress --no-interaction --no-ansi --level=9 --memory-limit=256M -v
old-version-build:
needs: stable-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.2', '8.3' ]
lexer: [ '2.1', '3.0']
exclude:
# Already tested
- php: '8.3'
lexer: '3.0'
name: PHP ${{ matrix.php }} - Doctrine Lexer ${{ matrix.lexer }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Composer packages
id: composer-cache-old
uses: actions/cache@v4
with:
path: vendor
key: ${{ format('{0}-php-{1}-lexer-{2}-{3}', runner.os, matrix.php, matrix.lexer, hashFiles('**/composer.lock')) }}
restore-keys: ${{ format('{0}-php-{1}-lexer-{2}-', runner.os, matrix.php, matrix.lexer) }}
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
- name: Install dependencies
run: composer --prefer-source require doctrine/lexer:${{ matrix.lexer }}
- name: Show libraries
run: composer show
- name: Run tests for forks or version without code coverage
run: vendor/bin/phpunit
dev-version-build:
needs: stable-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.2', '8.3' ]
name: PHP ${{ matrix.php }} - Doctrine Lexer 3.1.x-dev
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Composer packages
id: composer-cache-x-dev
uses: actions/cache@v4
with:
path: vendor
key: ${{ format('{0}-php-{1}-lexer-x-dev-{2}', runner.os, matrix.php, hashFiles('**/composer.lock')) }}
restore-keys: ${{ format('{0}-php-{1}-lexer-x-dev-', runner.os, matrix.php) }}
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
- name: Install dependencies
run: composer --prefer-source require doctrine/lexer:3.1.x-dev
- name: Show libraries
run: composer show
- name: Run tests for forks or version without code coverage
run: vendor/bin/phpunit