Skip to content

GitHub action to generate GitHub Pages for PHPUnit coverage

License

Notifications You must be signed in to change notification settings

TonyBogdanov/coverage

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Setup

Run your PHPUnit tests with:

--coverage-html=./path/to/coverage \
--coverage-clover ./path/to/coverage/coverage.xml

You can customize ./path/to/coverage, but make sure clover is generated in coverage.xml inside the folder.

Usage

Add the following step to your jobs:

- name: Coverage
  uses: TonyBogdanov/coverage@master
  with:
      path: ./path/to/coverage
      password: <optional password>

The password is optional, but if specified, all HTML files in the coverage will be cryptographically encoded with the specified password.

Example job

coverage:
    name: coverage

    needs: [ test ]
    runs-on: ubuntu-latest

    steps:
        - name: Checkout
          uses: actions/checkout@v1

        - name: Download artifacts
          uses: actions/download-artifact@v2
          with:
              name: coverage

        - name: Coverage
          uses: TonyBogdanov/coverage@master
          with:
              path: coverage
              password: coverage

        - name: Publish
          uses: JamesIves/github-pages-deploy-action@releases/v3
          with:
              ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
              BRANCH: gh-pages
              FOLDER: coverage