6060 extensions : mbstring, pdo_mysql, zip, exif, intl, gd, bcmath, curl, dom, xdebug
6161 coverage : xdebug
6262
63+ - name : Debug info
64+ run : |
65+ php -v
66+ composer --version
67+ mysql --version || true
68+
6369 - name : Wait for MySQL
6470 run : |
6571 for i in {30..0}; do
7076 echo "Waiting for MySQL ($i)..."
7177 sleep 1
7278 done
73-
7479 - name : Cache Composer dependencies
7580 uses : actions/cache@v3
7681 with :
@@ -85,14 +90,16 @@ jobs:
8590 composer require laravel/framework:^${{ matrix.laravel }} --no-update
8691 composer update --no-interaction --prefer-dist --no-progress
8792
93+ - name : Ensure coverage directory exists
94+ run : mkdir -p coverage
95+
8896 - name : Run Tests
8997 run : vendor/bin/phpunit --coverage-clover=coverage/clover.xml --path-coverage
9098
91- - name : Upload coverage artifact
92- uses : actions/upload-artifact@v4
99+ - uses : qltysh/qlty-action/coverage@v1
93100 with :
94- name : coverage-mysql- ${{ matrix.laravel }}-${{ matrix.php }}-${{ matrix.mysql }}
95- path : coverage/clover.xml
101+ token : ${{ secrets.QLTY_COVERAGE_TOKEN }}
102+ files : coverage/clover.xml
96103
97104
98105 test-pgsql :
@@ -103,6 +110,7 @@ jobs:
103110 matrix :
104111 laravel : [ 10, 11, 12 ]
105112 php : [ 8.2, 8.3, 8.4 ]
113+
106114 exclude :
107115 - laravel : 10
108116 php : 8.4
@@ -130,6 +138,7 @@ jobs:
130138 DB_DATABASE : testing
131139 DB_CONNECTION : ' pgsql'
132140
141+
133142 steps :
134143 - uses : actions/checkout@v4
135144
@@ -140,6 +149,12 @@ jobs:
140149 extensions : mbstring, pdo_pgsql, zip, exif, intl, gd, bcmath, curl, dom, xdebug
141150 coverage : xdebug
142151
152+ - name : Debug info
153+ run : |
154+ php -v
155+ composer --version
156+ psql --version || true
157+
143158 - name : Wait for Postgres
144159 run : |
145160 for i in {30..0}; do
@@ -150,39 +165,40 @@ jobs:
150165 echo "Waiting for Postgres ($i)..."
151166 sleep 1
152167 done
153-
154168 - name : Cache Composer dependencies
155169 uses : actions/cache@v3
156170 with :
157171 path : vendor
158172 key : ${{ runner.os }}-php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-${{ hashFiles('**/composer.lock') }}
159173 restore-keys : |
160174 ${{ runner.os }}-php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-
161-
162175 - name : Adjust Laravel/Testbench version per matrix
163176 run : |
164177 composer remove laravel/framework orchestra/testbench --no-update || true
165178 composer require laravel/framework:^${{ matrix.laravel }} --no-update
166179 composer update --no-interaction --prefer-dist --no-progress
167180
181+ - name : Ensure coverage directory exists
182+ run : mkdir -p coverage
183+
168184 - name : Run Tests
169185 run : vendor/bin/phpunit --coverage-clover=coverage/clover.xml --path-coverage
170186
171- - name : Upload coverage artifact
172- uses : actions/upload-artifact@v4
187+ - uses : qltysh/qlty-action/coverage@v1
173188 with :
174- name : coverage-pgsql- ${{ matrix.laravel }}-${{ matrix.php }}
175- path : coverage/clover.xml
189+ token : ${{ secrets.QLTY_COVERAGE_TOKEN }}
190+ files : coverage/clover.xml
176191
177192
178193 test-sqlsrv :
179- name : Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php }} / MSSQL
194+ name : Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php }} / MSSQL 2022-latest
180195 runs-on : ubuntu-latest
181196 timeout-minutes : 60
182197 strategy :
183198 matrix :
184199 laravel : [ 10, 11, 12 ]
185200 php : [ 8.2, 8.3, 8.4 ]
201+
186202 exclude :
187203 - laravel : 10
188204 - laravel : 11
@@ -213,12 +229,15 @@ jobs:
213229 steps :
214230 - uses : actions/checkout@v4
215231
216- - name : Install Microsoft ODBC Driver
232+ - name : Install Microsoft ODBC Driver for SQL Server (Linux)
217233 run : |
218234 curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
219235 curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
220236 sudo apt-get update
221- sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools unixodbc-dev
237+ sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools
238+ sudo apt-get install -y unixodbc-dev
239+ echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
240+ source ~/.bashrc
222241
223242 - name : Set up PHP with SQLSRV
224243 uses : shivammathur/setup-php@v2
@@ -227,8 +246,16 @@ jobs:
227246 extensions : mbstring, pdo_sqlsrv, sqlsrv, zip, exif, intl, gd, bcmath, curl, dom, xdebug
228247 coverage : xdebug
229248
249+ - name : Debug info
250+ run : |
251+ php -v
252+ composer --version
253+ /opt/mssql-tools/bin/sqlcmd -? || true
254+
230255 - name : Wait for MSSQL
231- run : sleep 30
256+ run : |
257+ echo "Waiting 30 seconds for MSSQL to start..."
258+ sleep 30
232259
233260 - name : Initialize Database
234261 run : |
@@ -252,56 +279,13 @@ jobs:
252279 composer require laravel/framework:^${{ matrix.laravel }} --no-update
253280 composer update --no-interaction --prefer-dist --no-progress
254281
282+ - name : Ensure coverage directory exists
283+ run : mkdir -p coverage
284+
255285 - name : Run Tests
256286 run : vendor/bin/phpunit --coverage-clover=coverage/clover.xml --path-coverage
257287
258- - name : Upload coverage artifact
259- uses : actions/upload-artifact@v4
260- with :
261- name : coverage-sqlsrv-${{ matrix.laravel }}-${{ matrix.php }}
262- path : coverage/clover.xml
263-
264- merge-coverage :
265- name : Merge Coverage
266- runs-on : ubuntu-latest
267- needs : [ test-mysql, test-pgsql, test-sqlsrv ]
268-
269- steps :
270- - uses : actions/checkout@v4
271-
272- - name : Download all coverage artifacts
273- uses : actions/download-artifact@v4
274- with :
275- path : all-coverage
276-
277- - name : Merge coverage reports using Python
278- run : |
279- mkdir -p coverage
280- echo '
281- import os
282- import xml.etree.ElementTree as ET
283-
284- merged = None
285-
286- for root, dirs, files in os.walk("all-coverage"):
287- for file in files:
288- if not file.endswith(".xml"):
289- continue
290- path = os.path.join(root, file)
291- tree = ET.parse(path)
292- root_elem = tree.getroot()
293- if merged is None:
294- merged = root_elem
295- else:
296- for pkg in root_elem.findall("packages/package"):
297- merged.find("packages").append(pkg)
298-
299- ET.ElementTree(merged).write("coverage/clover.xml", encoding="utf-8", xml_declaration=True)
300- ' > merge.py
301- python3 merge.py
302-
303- - name : Upload merged coverage to Qlty
304- uses : qltysh/qlty-action/coverage@v1
288+ - uses : qltysh/qlty-action/coverage@v1
305289 with :
306290 token : ${{ secrets.QLTY_COVERAGE_TOKEN }}
307291 files : coverage/clover.xml
0 commit comments