networkrailbusinesssystems / badges
在您的预推送过程中生成readme徽章
1.1.0
2024-04-15 14:24 UTC
README
将徽章作为预推送钩子的一部分生成!
安装
- 将
networkrailbusinesssystems/badges
添加到您的Composer开发依赖中
composer require --dev networkrailbusinesssystems/badges
- 确保PHPUnit以以下设置输出日志和覆盖率
<coverage> <report> <html outputDirectory=".phpunit.cache/html" /> <text outputFile=".phpunit.cache/coverage.txt" showUncoveredFiles="false" showOnlySummary="true" /> </report> </coverage> <logging> <junit outputFile=".phpunit.cache/tests.xml" /> </logging>
- 将以下命令添加到预推送钩子中
php vendor/networkrailbusinesssystems/badges/badges.php git add .github/*.svg git diff-index --quiet --cached HEAD || git commit -m "Updated badges" --no-verify
- 将以下行添加到
readme.md
,根据需要排除徽章
      
调试驱动器
您必须安装 xdebug 或 PCOV 以运行覆盖率检查,并启用覆盖率模式。
PCOV 通常比 XDebug 新且快,但可能不够准确。
XDebug
sudo apt install php-xdebug
- 将以下内容添加到您的
php.ini
文件末尾
[xdebug] xdebug.mode=coverage
PCOV
sudo apt install php8.2-dev
sudo apt install php-pear
sudo pecl install pcov
- 将以下内容添加到您的
php.ini
文件末尾
[pcov] extension=pcov.so
用法
- 正常运行
git push
- 预推送钩子将触发,运行您的测试和覆盖率
- 徽章将自动生成、更新并添加到提交中