Skip to content

Commit f2a5c4e

Browse files
authored
build(ci): add codecov for unit test coverage reporting (#43)
2 parents 1f4f1c6 + d04cd63 commit f2a5c4e

File tree

6 files changed

+1420
-59
lines changed

6 files changed

+1420
-59
lines changed

.github/codecov.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
informational: true
6+
target: auto
7+
threshold: 0.5%
8+
base: auto
9+
10+
github_checks:
11+
annotations: false

.github/workflows/unit-tests.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ jobs:
1717
run: npm install
1818
- name: ⚙️ Run tests
1919
run: npm run test --coverage
20+
- name: Upload coverage reports to Codecov
21+
uses: codecov/codecov-action@v4.0.1
22+
with:
23+
token: ${{ secrets.CODECOV_TOKEN }}
24+
slug: securesign/rekor-search-ui

README.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1+
[![🧪 Unit Tests (Jest) 🧪](https://github.com/securesign/rekor-search-ui/actions/workflows/unit-tests.yaml/badge.svg)](https://github.com/securesign/rekor-search-ui/actions/workflows/unit-tests.yaml)
2+
[![codecov](https://codecov.io/gh/securesign/rekor-search-ui/graph/badge.svg?token=1QS2BK1PQL)](https://codecov.io/gh/securesign/rekor-search-ui)
3+
14
This repo contains a simple UI for searching Search the Rekor public transparency log.
25

36
https://securesign.github.io/rekor-search-ui/
47

58
![Rekor UI Screenshot](assets/screenshot.png)
69

10+
## Requirements
11+
12+
- [Node.js](https://nodejs.org/en) 18.x+
13+
- Access to a [Rekor server](https://github.com/securesign/rekor), or a full deployment of [Trusted Artifact Signer (TAS)](https://access.redhat.com/documentation/en-us/red_hat_trusted_artifact_signer/2024-q1/html/deployment_guide/verify_the_trusted_artifact_signer_installation)
14+
715
## Getting Started
816

9-
Install dependencies:
17+
First, install the dependencies:
1018

1119
```bash
1220
npm install
1321
```
1422

15-
First, run the development server:
23+
Then, run the development server:
1624

1725
```bash
1826
npm run dev
@@ -32,17 +40,17 @@ npm run test
3240

3341
Launches the test runner in the interactive watch mode.
3442

35-
Tests are colocated and live as closely to corresponding code as possible.
43+
Tests are co-located and live as closely to corresponding code as possible.
3644

3745
## Deploy
3846

3947
The app is based on [Next.JS](https://nextjs.org/) and is automatically built & deployed to GitHub Pages when pushing to the `main` branch.
4048

4149
## Internal Server Configuration
4250

43-
This app supports overriding of the default rekor server instance for those running private instances of the sigstore stack.
51+
This app supports overriding of the default rekor server instance for those running private instances of the Trusted Artifact Signer (TAS) stack.
4452
Create a `.env.local` file at the root and include in it this environment variable
4553

4654
```properties
47-
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN=https://privaterekor.sigstore.dev
55+
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN=https://privaterekor.example.com
4856
```

next.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { codecovWebpackPlugin } = require("@codecov/webpack-plugin");
2+
13
/** @type {import('next').NextConfig} */
24
const nextConfig = {
35
reactStrictMode: true,
@@ -14,6 +16,21 @@ const nextConfig = {
1416
"@patternfly/react-icons",
1517
"@patternfly/react-styles",
1618
],
19+
webpack: config => {
20+
config.plugins = [
21+
...config.plugins,
22+
23+
// keep codecov webpack plugin after all other plugins
24+
codecovWebpackPlugin({
25+
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
26+
bundleName: "rekor-search-ui-webpack-bundle",
27+
uploadToken: process.env.CODECOV_TOKEN,
28+
}),
29+
];
30+
31+
// important: return the modified config
32+
return config;
33+
},
1734
};
1835

1936
module.exports = nextConfig;

0 commit comments

Comments
 (0)