Skip to content

Commit

Permalink
Merge pull request #339 from Yoast/JRF/ghactions-switch-to-coveralls-…
Browse files Browse the repository at this point in the history
…reporter

GH Actions: switch to Coveralls action runner to upload reports
  • Loading branch information
jrfnl authored Nov 24, 2023
2 parents f201e4b + cf1f5b3 commit e588101
Showing 1 changed file with 18 additions and 42 deletions.
60 changes: 18 additions & 42 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,14 @@ jobs:
if: ${{ matrix.coverage == true }}
run: composer coverage

# PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version.
- name: Switch to PHP 7.4
if: ${{ success() && matrix.coverage == true && startsWith( matrix.php_version, '8' ) }}
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none

# Global install is used to prevent a conflict with the local composer.lock in PHP 8.0+.
- name: Install Coveralls
if: ${{ success() && matrix.coverage == true }}
run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction

- name: Upload coverage results to Coveralls
if: ${{ success() && matrix.coverage == true }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php_version }}
run: php-coveralls -v -x build/logs/clover.xml
uses: coverallsapp/github-action@v2
with:
format: clover
file: build/logs/clover.xml
flag-name: php-${{ matrix.php_version }}
parallel: true

wp-test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -234,34 +222,23 @@ jobs:
env:
WP_MULTISITE: 1

# PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version.
- name: Switch to PHP 7.4
if: ${{ success() && matrix.coverage == true && startsWith( matrix.php_version, '8' ) }}
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none

# Global install is used to prevent a conflict with the local composer.lock in PHP 8.0+.
- name: Install Coveralls
if: ${{ success() && matrix.coverage == true }}
run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction

- name: Upload coverage results to Coveralls
if: ${{ success() && matrix.coverage == true }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php_version }}-wp-${{ matrix.wp_version }}
run: php-coveralls -v -x build/logs/clover-wp.xml
uses: coverallsapp/github-action@v2
with:
format: clover
file: build/logs/clover-wp.xml
flag-name: php-${{ matrix.php_version }}-wp-${{ matrix.wp_version }}
parallel: true

- name: Upload coverage results to Coveralls - multisite
if: ${{ success() && matrix.multisite == true && matrix.coverage == true }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php_version }}-wp-${{ matrix.wp_version }}-ms
run: php-coveralls -v -x build/logs/clover-wp-ms.xml
uses: coverallsapp/github-action@v2
with:
format: clover
file: build/logs/clover-wp-ms.xml
flag-name: php-${{ matrix.php_version }}-wp-${{ matrix.wp_version }}-ms
parallel: true

coveralls-finish:
needs: [unit-test, wp-test]
Expand All @@ -271,5 +248,4 @@ jobs:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_TOKEN }}
parallel-finished: true

0 comments on commit e588101

Please sign in to comment.