Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(ci): set up Codecov
Elian Dorand5ea87b5b4af
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.ymlindex 8495b32f35..150b1ca703 100644--- a/.github/workflows/dev.yml+++ b/.github/workflows/dev.yml@@ -44,7 +44,7 @@ jobs:run: pnpm typecheck- name: Run the client-side tests- run: pnpm run --filter=client test+ run: pnpm run --filter=client test --coverage- name: Upload client test reportuses: actions/upload-artifact@v7@@ -55,7 +55,7 @@ jobs:retention-days: 30- name: Run the server-side tests- run: pnpm run --filter=server test+ run: pnpm run --filter=server test --coverage- name: Upload server test reportuses: actions/upload-artifact@v7@@ -65,12 +65,36 @@ jobs:path: apps/server/test-output/vitest/html/retention-days: 30+ - name: Upload client coverage to Codecov+ uses: codecov/codecov-action@v5+ if: always()+ with:+ files: apps/client/test-output/vitest/coverage/lcov.info+ flags: client+ fail_ci_if_error: false++ - name: Upload server coverage to Codecov+ uses: codecov/codecov-action@v5+ if: always()+ with:+ files: apps/server/test-output/vitest/coverage/lcov.info+ flags: server+ fail_ci_if_error: false+- name: Run the standalone tests# Runs the same trilium-core spec set as the server suite, but in# happy-dom + sql.js WASM via BrowserSqlProvider (see# apps/standalone/src/test_setup.ts). Catches differences# between the Node-side and browser-side runtimes.- run: pnpm run --filter=standalone test+ run: pnpm run --filter=standalone test --coverage++ - name: Upload standalone coverage to Codecov+ uses: codecov/codecov-action@v5+ if: always()+ with:+ files: apps/standalone/test-output/vitest/coverage/lcov.info+ flags: standalone+ fail_ci_if_error: false- name: Run CKEditor e2e testsrun: |@@ -79,8 +103,19 @@ jobs:pnpm run --filter=ckeditor5-mermaid testpnpm run --filter=ckeditor5-math test+ - name: Run the desktop tests+ run: pnpm run --filter=desktop test --coverage++ - name: Upload desktop coverage to Codecov+ uses: codecov/codecov-action@v5+ if: always()+ with:+ files: apps/desktop/test-output/vitest/coverage/lcov.info+ flags: desktop+ fail_ci_if_error: false+- name: Run the rest of the tests- run: pnpm run --filter=\!client --filter=\!standalone --filter=\!server --filter=\!ckeditor5-mermaid --filter=\!ckeditor5-math test+ run: pnpm run --filter=\!client --filter=\!standalone --filter=\!server --filter=\!desktop --filter=\!ckeditor5-mermaid --filter=\!ckeditor5-math testbuild_docker:name: Build Docker imagediff --git a/apps/client/vite.config.mts b/apps/client/vite.config.mtsindex e5cb48c87f..b34aedd8ad 100644--- a/apps/client/vite.config.mts+++ b/apps/client/vite.config.mts@@ -121,6 +121,11 @@ export default defineConfig(() => ({"verbose",["html", { outputFile: "./test-output/vitest/html/index.html" }]],+ coverage: {+ reportsDirectory: "./test-output/vitest/coverage",+ provider: "v8" as const,+ reporter: ["text", "html", "lcov"]+ },},commonjsOptions: {transformMixedEsModules: true,diff --git a/apps/desktop/vitest.config.mts b/apps/desktop/vitest.config.mtsindex 705d3d115e..b22ba04c34 100644--- a/apps/desktop/vitest.config.mts+++ b/apps/desktop/vitest.config.mts@@ -18,6 +18,11 @@ export default defineConfig(() => ({TRILIUM_ENV: "dev"},include: ["src/**/*.spec.ts"],- reporters: ["verbose"]+ reporters: ["verbose"],+ coverage: {+ reportsDirectory: "./test-output/vitest/coverage",+ provider: "v8" as const,+ reporter: ["text", "html", "lcov"]+ }}}));diff --git a/apps/server/vite.config.mts b/apps/server/vite.config.mtsindex 39b0b65592..9c83ce4034 100644--- a/apps/server/vite.config.mts+++ b/apps/server/vite.config.mts@@ -38,7 +38,7 @@ export default defineConfig(() => ({coverage: {reportsDirectory: './test-output/vitest/coverage',provider: 'v8' as const,- reporter: [ "text", "html" ]+ reporter: [ "text", "html", "lcov" ]},pool: "forks",maxWorkers: 6diff --git a/apps/standalone/vite.config.mts b/apps/standalone/vite.config.mtsindex faefa45100..7d6ce982d2 100644--- a/apps/standalone/vite.config.mts+++ b/apps/standalone/vite.config.mts@@ -307,6 +307,11 @@ export default defineConfig(() => ({"src/**/*.{test,spec}.{ts,tsx}","../../packages/trilium-core/src/**/*.{test,spec}.{ts,tsx}"],+ coverage: {+ reportsDirectory: "./test-output/vitest/coverage",+ provider: "v8" as const,+ reporter: ["text", "html", "lcov"]+ },server: {deps: {inline: ["@sqlite.org/sqlite-wasm"]diff --git a/codecov.yml b/codecov.ymlnew file mode 100644index 0000000000..86cfb815d8--- /dev/null+++ b/codecov.yml@@ -0,0 +1,34 @@+coverage:+ status:+ project:+ default:+ target: auto+ threshold: 1%+ patch:+ default:+ target: 80%+ threshold: 5%++flags:+ client:+ paths:+ - apps/client/src/+ carryforward: true+ server:+ paths:+ - apps/server/src/+ - packages/trilium-core/src/+ carryforward: true+ standalone:+ paths:+ - apps/standalone/src/+ - packages/trilium-core/src/+ carryforward: true+ desktop:+ paths:+ - apps/desktop/src/+ carryforward: true++comment:+ layout: "condensed_header, condensed_files, condensed_footer"+ require_changes: true