Skip to content

Commit 4019b63

Browse files
fix: report tests and bundle to codecov
1 parent 4512fa7 commit 4019b63

File tree

4 files changed

+225
-2
lines changed

4 files changed

+225
-2
lines changed

.github/workflows/build.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ jobs:
9797
9898
- name: Run build
9999
shell: bash
100+
env:
101+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
100102
run: |
101103
npm run build
102104
@@ -219,7 +221,7 @@ jobs:
219221
shell: bash
220222
id: tests
221223
run: |
222-
npm run test -- --reporter=basic --reporter=github-actions --coverage.reporter=text --coverage.reporter=lcovonly
224+
npm run test -- --reporter=basic --reporter=github-actions --reporter=junit --coverage.reporter=text --coverage.reporter=lcovonly
223225
continue-on-error: true
224226

225227
- name: Upload coverage results (to Codecov.io)
@@ -231,6 +233,14 @@ jobs:
231233
plugins: ""
232234
token: ${{ secrets.CODECOV_TOKEN }}
233235

236+
- name: Upload test results to Codecov
237+
uses: codecov/test-results-action@1b5b448b98e58ba90d1a1a1d9fcb72ca2263be46 # v1
238+
with:
239+
disable_search: true
240+
fail_ci_if_error: true
241+
files: reports/test-report.xml
242+
token: ${{ secrets.CODECOV_TOKEN }}
243+
234244
- name: Fail if tests failed
235245
shell: bash
236246
if: steps.tests.outcome != 'success'

package-lock.json

+204
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"url": "https://github.com/actions-rs-plus/core/issues"
4141
},
4242
"devDependencies": {
43+
"@codecov/vite-plugin": "0.0.1-beta.10",
4344
"@eslint/compat": "1.1.1",
4445
"@eslint/eslintrc": "3.1.0",
4546
"@eslint/js": "9.9.1",

vite.config.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { codecovVitePlugin } from "@codecov/vite-plugin";
12
import type { UserConfig } from "vite";
23
import viteTsConfigPaths from "vite-tsconfig-paths";
34
import { coverageConfigDefaults, defineConfig } from "vitest/config";
@@ -8,7 +9,14 @@ const deps: string[] = ["@actions-rs-plus/core"];
89
export default defineConfig(() => {
910
const config: UserConfig = {
1011
appType: "custom",
11-
plugins: [viteTsConfigPaths()],
12+
plugins: [
13+
viteTsConfigPaths(),
14+
codecovVitePlugin({
15+
enableBundleAnalysis: process.env["CODECOV_TOKEN"] !== undefined,
16+
bundleName: "library",
17+
uploadToken: process.env["CODECOV_TOKEN"] ?? "",
18+
}),
19+
],
1220
test: {
1321
coverage: {
1422
exclude: [...coverageConfigDefaults.exclude, "./dependency-cruiser.config.mjs"],

0 commit comments

Comments
 (0)