Skip to content

Commit f4e7e54

Browse files
chore: switch from Coveralls to Codecov (#5447)
* Mark coverage upload CI job as optional * Fixup comment * Revert "Fixup comment" This reverts commit 313fc34. * Reapply "Fixup comment" This reverts commit 4c23b11. * Revert "Reapply "Fixup comment"" This reverts commit 8ba474c. * Revert "Mark coverage upload CI job as optional" This reverts commit 2c2ce90. * Remove "Coveralls finished" step * Use Codecov instead of Coveralls in npm-script * mark docs for updates * Remove unused job * Link to Codecov info and dashboard * Pass Codecov token explicitly * Test fail condition * Use OIDC instead of token * Fix OIDC syntax * Fix OIDC perm location * Add contents read perm * Move both permissions back to npm-script (Doubting AI on this one but let's see) * Revert "Move both permissions back to npm-script" This reverts commit 2806589. * Add write perms back to sub flow explicitly * Globalize perms * Link how to run Codecov on a fork * Update to Codecov badge in readme * Update .github/CONTRIBUTING.md Co-authored-by: Josh Goldberg ✨ <[email protected]> --------- Co-authored-by: Josh Goldberg ✨ <[email protected]>
1 parent 1aeb89d commit f4e7e54

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Then:
9292
- This will run both Node.js-based and browser-based tests.
9393
- Ultimately, your pull request will be built on our continuous integration servers ([GitHub Actions](https://github.com/mochajs/mocha/actions?query=workflow%3A%22Tests%22)).
9494
The first step to ensuring these checks pass is to test on your own machine.
95-
- A coverage check will be sent to [Coveralls](https://coveralls.io/github/mochajs/mocha).
95+
- When tests are run in CI, a coverage check is sent to [Codecov](https://app.codecov.io/gh/mochajs/mocha. You'll need to [add the Codecov GitHub app](https://app.codecov.io/login) to upload these results from your fork. This is recommended but not necessary to open a PR.
9696
**A drop in code coverage % is considered a failed check**.
9797
1. Commit your changes.
9898
- Use a brief message on the first line, referencing a relevant issue (e.g. `closes #12345`).

.github/workflows/mocha.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313

1414
permissions:
1515
contents: read
16+
id-token: write # for Codecov OIDC
1617

1718
jobs:
1819
lint:
@@ -46,6 +47,9 @@ jobs:
4647

4748
test-node-all:
4849
name: Test ${{ matrix.test-part }} in all environments
50+
permissions:
51+
id-token: write # for Codecov OIDC
52+
contents: read # for Codecov OIDC
4953
# TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module
5054
uses: ./.github/workflows/npm-script.yml
5155
needs: test-node-lts
@@ -71,16 +75,6 @@ jobs:
7175
npm-script: test-node:${{ matrix.test-part }}
7276
coverage: ${{ matrix.coverage }}
7377

74-
test-node-upload-coverage:
75-
needs: test-node-all
76-
if: always()
77-
runs-on: ubuntu-latest
78-
steps:
79-
- name: Coveralls Finished
80-
uses: coverallsapp/github-action@v2
81-
with:
82-
parallel-finished: true
83-
8478
test-browser-local:
8579
uses: ./.github/workflows/npm-script.yml
8680
with:

.github/workflows/npm-script.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ on:
2626

2727
permissions:
2828
contents: read
29+
id-token: write
2930

3031
jobs:
3132
resolve-inputs:
@@ -73,12 +74,16 @@ jobs:
7374
NODE_OPTIONS: '--trace-warnings'
7475
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
7576
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
77+
# Generate and upload coverage, even if tests fail
7678
- name: Generate coverage report
7779
if: always() && inputs.coverage
7880
run: npm run test-coverage-generate
79-
- name: Coveralls Parallel
81+
# https://github.com/marketplace/actions/codecov
82+
# https://app.codecov.io/gh/mochajs/mocha
83+
- name: Upload coverage reports
8084
if: always() && inputs.coverage
81-
uses: coverallsapp/github-action@v2
85+
uses: codecov/codecov-action@v5
8286
with:
83-
flag-name: run-${{ inputs.npm-script }}-${{ join(matrix.*, '-') }}
84-
parallel: true
87+
fail_ci_if_error: true
88+
use_oidc: true
89+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<a href="https://www.npmjs.com/package/mocha"><img src="https://img.shields.io/npm/v/mocha.svg" alt="NPM Version"></a>
1010
<a href="https://github.com/mochajs/mocha"><img src="https://img.shields.io/node/v/mocha.svg" alt="Node Version"></a>
1111
[![GitHub Actions Build Status](https://github.com/mochajs/mocha/actions/workflows/mocha.yml/badge.svg)](https://github.com/mochajs/mocha/actions/workflows/mocha.yml)
12-
<a href="https://coveralls.io/github/mochajs/mocha"><img src="https://coveralls.io/repos/github/mochajs/mocha/badge.svg" alt="Coverage Status"></a>
12+
<a href="https://codecov.io/gh/mochajs/mocha"><img src="https://codecov.io/gh/mochajs/mocha/branch/main/graph/badge.svg" alt="Codecov Coverage Status"></a>
1313

1414
</div>
1515

0 commit comments

Comments
 (0)