Merge pull request #662 from equalizedigital/william/658/allow-fronte… #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Coverage Report | |
on: | |
push: | |
branches: [ develop ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: false | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
coverage: xdebug | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Install WP | |
shell: bash | |
run: tests/bin/install-wp-tests.sh wordpress_tests root '' 127.0.0.1:3306 ${{ matrix.wp_version }} | |
- name: Run PHPUnit and generate reports in clover and html format | |
run: ./vendor/bin/phpunit --coverage-clover=./coverage/clover.xml --coverage-html=./coverage/html | |
- name : Attach zipped coverage report as workflow artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-html | |
path: ./coverage/coverage-html.zip | |
- name: Convert coverage clover format to Coveralls format | |
run: | | |
composer global require php-coveralls/php-coveralls | |
~/.composer/vendor/bin/php-coveralls -v -x ./coverage/clover.xml -o ./coverage/coveralls.json | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
GITHUB_EVENT_NAME: ${{ github.event_name }} | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
- name: Upload coverage to Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: ./coverage/coveralls.json | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
GITHUB_EVENT_NAME: ${{ github.event_name }} | |
GITHUB_RUN_ID: ${{ github.run_id }} |