Skip to content

symlinks

symlinks #128

Workflow file for this run

name: Code Coverage
# Runs PHPUnit with code coverage enabled, commits the html report to
# GitHub Pages, generates a README badge with the coverage percentage.
#
# Requires a gh-pages branch already created.
#
# git checkout --orphan gh-pages
# touch index.html
# git add index.html
# git commit -m 'Set up gh-pages branch' index.html
# git push origin gh-pages
#
# @author BrianHenryIE
on:
push:
branches:
- master
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: xdebug
- name: Checkout GitHub Pages branch for code coverage report
uses: actions/checkout@v4
with:
ref: gh-pages
path: tests/reports/html
- name: Install dependencies
run: composer update --prefer-dist --no-progress
- name: Clear previous code coverage
working-directory: tests/reports/html
run: |
rm -rf *
- name: Generate code coverage
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --coverage-clover tests/reports/clover.xml --coverage-html tests/reports/html
- name: Add code coverage output to gh-pages
working-directory: tests/reports/html
run: |
touch .nojekyll
git add -- .nojekyll *
- name: Commit code coverage to gh-pages
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: tests/reports/html
branch: gh-pages
commit_message: "🤖 Update code coverage to gh-pages"
commit_options: ""
env:
GITHUB_TOKEN: "${{ github.token }}"
- name: Update README badge
run: vendor/bin/php-coverage-badger tests/reports/clover.xml .github/coverage.svg
- name: Commit code coverage badge
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "🤖 Update code coverage badge"