@@ -222,3 +222,61 @@ jobs:
222222
223223 - name : Run end-to-end tests with PHPUnit
224224 run : ./tools/phpunit --testsuite end-to-end
225+
226+ code-coverage :
227+ name : Code Coverage
228+
229+ needs :
230+ - end-to-end-tests
231+
232+ runs-on : ubuntu-latest
233+ timeout-minutes : 5
234+
235+ steps :
236+ - name : Checkout
237+ uses : actions/checkout@v4
238+
239+ - name : Install MySQL
240+ uses : shogo82148/actions-setup-mysql@v1
241+ with :
242+ mysql-version : " 9.0"
243+
244+ - name : Set up test database
245+ run : mysql -u root < ./sql/schema.sql
246+
247+ - name : Install PHP with extensions
248+ uses : shivammathur/setup-php@v2
249+ with :
250+ php-version : 8.4
251+ coverage : xdebug
252+ tools : none
253+
254+ - name : Install dependencies with Composer
255+ run : ./tools/composer update --no-ansi --no-interaction --no-progress
256+
257+ - name : Create directory for projections
258+ run : mkdir projections
259+
260+ - name : Create projection
261+ run : ./bin/project.php projections/market.html
262+
263+ - name : Start PHP built-in server
264+ run : php -S 127.0.0.1:8080 -t public &
265+
266+ - name : Collect code coverage with PHPUnit
267+ run : ./tools/phpunit --log-junit test-results.xml --coverage-clover=code-coverage.xml
268+
269+ - name : Upload test results to Codecov.io
270+ if : ${{ !cancelled() }}
271+ uses : codecov/test-results-action@v1
272+ with :
273+ token : ${{ secrets.CODECOV_TOKEN }}
274+ disable_search : true
275+ files : ./test-results.xml
276+
277+ - name : Upload code coverage data to Codecov.io
278+ uses : codecov/codecov-action@v4
279+ with :
280+ token : ${{ secrets.CODECOV_TOKEN }}
281+ disable_search : true
282+ files : ./code-coverage.xml
0 commit comments