Skip to content

Commit 8596e1d

Browse files
authored
Upload coverage and spec reports to code quality services (#1339)
Configures JUnit output files and processing on these three coverage services: * Otterwise * Codecov (current winner) * Coveralls Note that they all provide the most capabilities for "open source", public repos like this - so seemed like a good starting point to see how they behave.
1 parent 9a4f100 commit 8596e1d

File tree

10 files changed

+364
-20
lines changed

10 files changed

+364
-20
lines changed

.github/workflows/create-new-release.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,13 @@ jobs:
7474
- name: Install dependencies
7575
run: yarn install
7676

77-
# Build assets
78-
- run: yarn build
79-
- run: npm pack
77+
- name: Compile assets bundle
78+
run: yarn build
79+
env:
80+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
81+
82+
- name: Pack bundle tarball
83+
run: npm pack
8084

8185
- name: Create Release
8286
id: create_release

.github/workflows/test.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
steps:
99
- name: Checkout branch
1010
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 2
1113

1214
- name: Setup Node
1315
uses: actions/setup-node@v4
@@ -25,3 +27,29 @@ jobs:
2527

2628
- name: Test
2729
run: yarn test
30+
31+
- name: Upload coverage to OtterWise
32+
if: ${{ !cancelled() && vars.OTTERWISE_ENABLED == 'true' }}
33+
uses: getOtterWise/github-action@v1
34+
with:
35+
token: ${{ secrets.OTTERWISE_TOKEN }}
36+
37+
- name: Upload coverage to Coveralls
38+
if: ${{ !cancelled() && vars.COVERALLS_ENABLED == 'true' }}
39+
uses: coverallsapp/github-action@v2
40+
with:
41+
# github-token: ${{ secrets.GITHUB_TOKEN }}
42+
format: lcov
43+
file: ./coverage/lcov.info
44+
45+
- name: Upload coverage to Codecov
46+
if: ${{ !cancelled() && vars.CODECOV_ENABLED == 'true' }}
47+
uses: codecov/codecov-action@v5
48+
with:
49+
token: ${{ secrets.CODECOV_TOKEN }}
50+
51+
- name: Upload test results to Codecov
52+
if: ${{ !cancelled() && vars.CODECOV_ENABLED == 'true' }}
53+
uses: codecov/test-results-action@v1
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ yarn-debug.log*
3535
yarn-error.log*
3636
*.mp4
3737
/DS/.idea
38+
/junit.xml

.storybook/webpack.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
const path = require('path');
2+
const { codecovWebpackPlugin } = require("@codecov/webpack-plugin");
23

34
module.exports = function({ config }) {
5+
config.plugins = config.plugins || [];
6+
config.plugins.push(
7+
codecovWebpackPlugin({
8+
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
9+
bundleName: "design-system",
10+
uploadToken: process.env.CODECOV_TOKEN,
11+
}),
12+
);
13+
414
config.module.rules.push({
515
test: /\.scss$/,
616
use: [

codecov.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
informational: true
6+
patch:
7+
default:
8+
informational: true

jest.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module.exports = {
3434
// A list of reporter names that Jest uses when writing coverage reports
3535
coverageReporters: [
3636
"text",
37+
"lcov",
3738
],
3839

3940
// An object that configures minimum threshold enforcement for coverage results
@@ -98,7 +99,9 @@ module.exports = {
9899
// projects: null,
99100

100101
// Use this configuration option to add custom reporters to Jest
101-
// reporters: undefined,
102+
reporters: [
103+
'jest-junit',
104+
],
102105

103106
// Automatically reset mock state between every test
104107
// resetMocks: false,

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"@babel/preset-react": "^7.28.5",
9898
"@babel/preset-typescript": "^7.28.5",
9999
"@babel/runtime": "^7.28.4",
100+
"@codecov/webpack-plugin": "^1.9.1",
100101
"@eslint/compat": "^1.4.1",
101102
"@fortawesome/fontawesome-svg-core": "^6.7.2",
102103
"@fortawesome/free-brands-svg-icons": "^6.7.2",
@@ -148,6 +149,7 @@
148149
"jest": "^29.7.0",
149150
"jest-css-modules-transform": "^4.4.2",
150151
"jest-environment-jsdom": "^29.7.0",
152+
"jest-junit": "^16.0.0",
151153
"nodemon": "^3.1.10",
152154
"postcss": "^8.5.6",
153155
"prop-types": "^15.8.1",

src/Toast/__snapshots__/withToast.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`test withToast it can create a new Toast message 1`] = `
3+
exports[`withToast() can create a new Toast message 1`] = `
44
[
55
<div
66
className="Alert Alert-success"

src/Toast/withToast.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function WrappedComponent() {
1616
return <div />;
1717
}
1818

19-
describe('test withToast', () => {
20-
test('it can create a new Toast message', async () => {
19+
describe('withToast()', () => {
20+
it('can create a new Toast message', async () => {
2121
const newMessage = 'This is just a test...';
2222
const ComponentWithToast = withToast(WrappedComponent);
2323
const toast = create(<ComponentWithToast />);

0 commit comments

Comments
 (0)