Skip to content

Build your personal knowledge base with Trilium Notes

feat(ci): upload test info

Elian Doranfbc4d0f06c79
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index cd326f3694..55a87fb8de 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -73,6 +73,15 @@ jobs:
flags: client
fail_ci_if_error: false
+ - name: Upload client test results to Codecov
+ uses: codecov/test-results-action@v1
+ if: ${{ !cancelled() }}
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: apps/client/test-output/vitest/junit.xml
+ flags: client
+ fail_ci_if_error: false
+
- name: Upload server coverage to Codecov
uses: codecov/codecov-action@v6
if: always()
@@ -81,6 +90,15 @@ jobs:
flags: server
fail_ci_if_error: false
+ - name: Upload server test results to Codecov
+ uses: codecov/test-results-action@v1
+ if: ${{ !cancelled() }}
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: apps/server/test-output/vitest/junit.xml
+ 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
@@ -96,6 +114,15 @@ jobs:
flags: standalone
fail_ci_if_error: false
+ - name: Upload standalone test results to Codecov
+ uses: codecov/test-results-action@v1
+ if: ${{ !cancelled() }}
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: apps/standalone/test-output/vitest/junit.xml
+ flags: standalone
+ fail_ci_if_error: false
+
- name: Run CKEditor e2e tests
run: |
export CHROMEDRIVER_PATH=$(which chromedriver || find /usr/local/share -name chromedriver -type f 2>/dev/null | head -1)
@@ -114,6 +141,15 @@ jobs:
flags: desktop
fail_ci_if_error: false
+ - name: Upload desktop test results to Codecov
+ uses: codecov/test-results-action@v1
+ if: ${{ !cancelled() }}
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: apps/desktop/test-output/vitest/junit.xml
+ flags: desktop
+ fail_ci_if_error: false
+
- name: Run the commons tests
run: pnpm run --filter=commons test --coverage
@@ -125,6 +161,15 @@ jobs:
flags: commons
fail_ci_if_error: false
+ - name: Upload commons test results to Codecov
+ uses: codecov/test-results-action@v1
+ if: ${{ !cancelled() }}
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: packages/commons/test-output/vitest/junit.xml
+ flags: commons
+ fail_ci_if_error: false
+
- name: Run the rest of the tests
run: pnpm run --filter=\!client --filter=\!standalone --filter=\!server --filter=\!desktop --filter=\!commons --filter=\!ckeditor5-mermaid --filter=\!ckeditor5-math test
diff --git a/apps/client/vite.config.mts b/apps/client/vite.config.mts
index ca6658cc60..2059dfbae1 100644
--- a/apps/client/vite.config.mts
+++ b/apps/client/vite.config.mts
@@ -124,7 +124,8 @@ export default defineConfig(() => ({
],
reporters: [
"verbose",
- ["html", { outputFile: "./test-output/vitest/html/index.html" }]
+ ["html", { outputFile: "./test-output/vitest/html/index.html" }],
+ ["junit", { outputFile: "./test-output/vitest/junit.xml", addFileAttribute: true }]
],
coverage: {
reportsDirectory: "./test-output/vitest/coverage",
diff --git a/apps/desktop/vitest.config.mts b/apps/desktop/vitest.config.mts
index b22ba04c34..5c8ee19d70 100644
--- a/apps/desktop/vitest.config.mts
+++ b/apps/desktop/vitest.config.mts
@@ -18,7 +18,10 @@ export default defineConfig(() => ({
TRILIUM_ENV: "dev"
},
include: ["src/**/*.spec.ts"],
- reporters: ["verbose"],
+ reporters: [
+ "verbose",
+ ["junit", { outputFile: "./test-output/vitest/junit.xml", addFileAttribute: true }]
+ ],
coverage: {
reportsDirectory: "./test-output/vitest/coverage",
provider: "v8" as const,
diff --git a/apps/server/vite.config.mts b/apps/server/vite.config.mts
index 9c83ce4034..22a033358b 100644
--- a/apps/server/vite.config.mts
+++ b/apps/server/vite.config.mts
@@ -33,7 +33,8 @@ export default defineConfig(() => ({
testTimeout: 40_000,
reporters: [
"verbose",
- ["html", { outputFile: "./test-output/vitest/html/index.html" }]
+ ["html", { outputFile: "./test-output/vitest/html/index.html" }],
+ ["junit", { outputFile: "./test-output/vitest/junit.xml", addFileAttribute: true }]
],
coverage: {
reportsDirectory: './test-output/vitest/coverage',
diff --git a/apps/standalone/vite.config.mts b/apps/standalone/vite.config.mts
index 7d6ce982d2..427bc22990 100644
--- a/apps/standalone/vite.config.mts
+++ b/apps/standalone/vite.config.mts
@@ -303,6 +303,13 @@ export default defineConfig(() => ({
environment: "happy-dom",
setupFiles: [join(__dirname, "src/test_setup.ts")],
dir: join(__dirname),
+ reporters: [
+ "default",
+ // Absolute path on purpose: the Vite `root` above is `src`, so a
+ // relative outputFile would land in `src/test-output`. Anchor to the
+ // package dir to match the other apps and the CI upload path.
+ ["junit", { outputFile: join(__dirname, "test-output/vitest/junit.xml"), addFileAttribute: true }]
+ ],
include: [
"src/**/*.{test,spec}.{ts,tsx}",
"../../packages/trilium-core/src/**/*.{test,spec}.{ts,tsx}"
diff --git a/packages/commons/vite.config.ts b/packages/commons/vite.config.ts
index 642428bd53..da8a87d7f6 100644
--- a/packages/commons/vite.config.ts
+++ b/packages/commons/vite.config.ts
@@ -10,7 +10,10 @@ export default defineConfig(() => ({
'globals': true,
'environment': "node",
'include': ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
- 'reporters': ["default"],
+ 'reporters': [
+ "default",
+ ["junit", { outputFile: "./test-output/vitest/junit.xml", addFileAttribute: true }]
+ ],
'coverage': {
'reportsDirectory': './test-output/vitest/coverage',
'provider': 'v8' as const,