Skip to content

Commit

Permalink
Send JS packages' coverage to coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
diedexx committed Dec 5, 2023
1 parent b166963 commit dca0ae7
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 12 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/finish-coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Finish Coveralls build
on:
workflow_run:
workflows:
- Test
- TestJS
types:
- completed

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
finish_coveralls_build:
name: "Finish coveralls build"
runs-on: ubuntu-latest
steps:

# Wait for the PHP and JS tests to finish.
# NOTE: The ref value should be different when triggered by pull_request event.
# See: https://github.com/lewagon/wait-on-check-action/issues/25.
- name: "Wait on tests (PR)"
uses: lewagon/wait-on-check-action@e106e5c43e8ca1edea6383a39a01c5ca495fd812 # lewagon/[email protected]
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
check-regexp: Test|TestJS

- name: "Wait on tests (push)"
if: github.event_name != 'pull_request'
uses: lewagon/wait-on-check-action@e106e5c43e8ca1edea6383a39a01c5ca495fd812 # lewagon/[email protected]
with:
ref: ${{ github.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
check-regexp: Test|TestJS


- name: "Coveralls Finished"
uses: coverallsapp/github-action@v2
env:
COVERALLS_SERVICE_NUMBER: ${{ github.sha }} # Connect all builds together.
with:
github-token: ${{ secrets.COVERALLS_TOKEN }}
carryforward: "unit-php-7.2,unit-php-8.3,php-7.2-wp-6.2,php-7.2-wp-6.2-ms,php-8.3-wp-trunk,php-8.3-wp-trunk-ms,package-analysis-report,package-browserslist-config,package-components,package-feature-flag,package-helpers,package-js,package-replacement-variable-editor,package-search-metadata-previews,package-social-metadata-forms,package-social-metadata-previews,package-yoast-components"
parallel-finished: true
16 changes: 14 additions & 2 deletions .github/workflows/jstest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,15 @@ jobs:
working-directory: packages/${{ matrix.package }}

- name: Run Javascript tests
run: yarn test --ci
run: yarn test --ci --coverage
working-directory: packages/${{ matrix.package }}

- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@v2
with:
flag-name: package-${{ matrix.package }}
parallel: true


#########################################################################################
# For packages in this job, PRs will only run the tests related to changed files
Expand Down Expand Up @@ -198,5 +204,11 @@ jobs:

- name: Run Javascript tests
if: ${{ steps.checks-run.outputs.should == 'true' }}
run: yarn test --ci
run: yarn test --ci --coverage
working-directory: packages/${{ matrix.package }}

- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@v2
with:
flag-name: package-${{ matrix.package }}
parallel: true
10 changes: 0 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,3 @@ jobs:
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]
runs-on: ubuntu-latest

steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true

0 comments on commit dca0ae7

Please sign in to comment.