summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavey Shafik <davey@php.net>2020-10-27 20:39:08 +0000
committerGitHub <noreply@github.com>2020-10-27 20:39:08 +0000
commitea2f7f4847d6a3deade020dc55a100899184cc99 (patch)
treec2f16b7f3c318a4e3a8ab2ed83a91caa876de02b
parentfb52ae09995a7cc17d9933ea079ec239ee18ea20 (diff)
downloadphp7-mysql-shim-ea2f7f4847d6a3deade020dc55a100899184cc99.zip
php7-mysql-shim-ea2f7f4847d6a3deade020dc55a100899184cc99.tar.gz
php7-mysql-shim-ea2f7f4847d6a3deade020dc55a100899184cc99.tar.bz2
Try to fix scruitinizer coverage+code coverage badge
-rw-r--r--.github/workflows/phpunit.yaml21
-rw-r--r--tests/coverage.php3
2 files changed, 23 insertions, 1 deletions
diff --git a/.github/workflows/phpunit.yaml b/.github/workflows/phpunit.yaml
index 4eadbfb..ba7dac6 100644
--- a/.github/workflows/phpunit.yaml
+++ b/.github/workflows/phpunit.yaml
@@ -40,5 +40,24 @@ jobs:
MYSQL_HOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }}
MYSQL_USERNAME: root
MYSQL_PASSWORD: password
+ - name: Get Code Coverage
+ run: php tests/coverage.php
+ if: matrix.php == '7.4'
- name: Upload Code Coverage
- run: if (( `php -r 'echo substr(PHP_VERSION_ID, 0, -2);'` == 704 )); then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/coverage/coverage.clover; fi;
+ uses: schneegans/dynamic-badges-action@v1.0.0
+ with:
+ auth: ${{ secrets.GIST_TOKEN }}
+ gistID: ee79527e0098afea147bffc33bf710d3
+ filename: coverage.json
+ label: Code Coverage
+ message: ${{ env.COVERAGE }}
+ color: green
+ if: matrix.php == '7.4'
+ continue-on-error: true # if is fork
+ - name: Scrutinizer Code Coverage
+ run: |
+ wget https://scrutinizer-ci.com/ocular.phar
+ php ocular.phar code-coverage:upload --format=php-clover build/coverage/coverage.clover
+ if: matrix.php == '7.4'
+ continue-on-error: true # if is fork
+
diff --git a/tests/coverage.php b/tests/coverage.php
new file mode 100644
index 0000000..8d88eee
--- /dev/null
+++ b/tests/coverage.php
@@ -0,0 +1,3 @@
+<?php
+$xml = simplexml_load_file("build/coverage/xml/mysql.php.xml");
+echo "COVERAGE=" . $xml->file->totals->lines->attributes()->percent; \ No newline at end of file