From 1700fa9db5ce28fbce051d12a6756f6174cc678c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 4 Feb 2025 12:57:27 +0100 Subject: [PATCH 1/7] test documentation coverage --- .github/workflows/test.docs.yml | 7 ++++++- package.json | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.docs.yml b/.github/workflows/test.docs.yml index b03e813d..823d1048 100644 --- a/.github/workflows/test.docs.yml +++ b/.github/workflows/test.docs.yml @@ -37,11 +37,16 @@ jobs: name: Docs needs: files-changed runs-on: ubuntu-latest + env: + COVERAGE_REQUIRED: 10 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7 - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3 with: node-version-file: './.tool-versions' - name: Docs - run: npm install && npm run docs:generate + run: | + npm install + npm run docs:generate + bash -c "if (( $(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1) > $COVERAGE_REQUIRED )) then exit 0; else exit 1; fi" working-directory: ./ diff --git a/package.json b/package.json index 685cb2f4..74100dcb 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "test:lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.json,.yml,.yaml --max-warnings 0 .", "test:unit": "npm run test:unit:dev -- run --coverage", "test:unit:dev": "vitest", - "docs:generate": "typedoc src/index.tsx", + "docs:generate": "typedoc --plugin typedoc-plugin-coverage src/index.tsx", "update": "npx npm-check-updates" }, "files": [ @@ -61,6 +61,7 @@ "rollup-plugin-typescript2": "^0.32.1", "tailwindcss": "^3.3.1", "typedoc": "^0.27.6", + "typedoc-plugin-coverage": "^3.4.1", "typescript": "^5.7.3", "vite": "^6.0.11", "vitest": "^3.0.5" From b6bf4a2cffe66e02a6563d76bafed7a8996b7d29 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 4 Feb 2025 13:02:34 +0100 Subject: [PATCH 2/7] coverage debug output when quota is not met --- .github/workflows/test.docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.docs.yml b/.github/workflows/test.docs.yml index 823d1048..688e6c5b 100644 --- a/.github/workflows/test.docs.yml +++ b/.github/workflows/test.docs.yml @@ -48,5 +48,5 @@ jobs: run: | npm install npm run docs:generate - bash -c "if (( $(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1) > $COVERAGE_REQUIRED )) then exit 0; else exit 1; fi" + bash -c "if (( $(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1) > $COVERAGE_REQUIRED )) then echo \"echo "Coverage: $(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1)/$COVERAGE_REQUIRED\";exit 0; else exit 1; fi" working-directory: ./ From 4c58a90ab35b6c93d63620dda975719a3268ae25 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 4 Feb 2025 13:12:37 +0100 Subject: [PATCH 3/7] docs-coverage script --- .github/workflows/test.docs.yml | 5 ++++- scripts/docs-coverage.sh | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 scripts/docs-coverage.sh diff --git a/.github/workflows/test.docs.yml b/.github/workflows/test.docs.yml index 688e6c5b..3e4cb83e 100644 --- a/.github/workflows/test.docs.yml +++ b/.github/workflows/test.docs.yml @@ -48,5 +48,8 @@ jobs: run: | npm install npm run docs:generate - bash -c "if (( $(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1) > $COVERAGE_REQUIRED )) then echo \"echo "Coverage: $(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1)/$COVERAGE_REQUIRED\";exit 0; else exit 1; fi" + ./scripts/docs-coverage.sh working-directory: ./ + + +bash -c "COVERAGE=$(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1); echo $COVERAGE;if (( $COVERAGE >= $COVERAGE_REQUIRED )) then exit 0; else echo \"Coverage: $COVERAGE/$COVERAGE_REQUIRED\"; exit 1; fi" \ No newline at end of file diff --git a/scripts/docs-coverage.sh b/scripts/docs-coverage.sh new file mode 100755 index 00000000..97ad4b10 --- /dev/null +++ b/scripts/docs-coverage.sh @@ -0,0 +1,9 @@ +#!/bin/bash +COVERAGE=$(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1) + +if (( $COVERAGE >= $COVERAGE_REQUIRED )) then + exit 0; +else + echo "Coverage: $COVERAGE/$COVERAGE_REQUIRED"; + exit 1; +fi \ No newline at end of file From 627a6446bd2c7ca3b38f7950ad4d92a1dcb490ed Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 4 Feb 2025 13:12:50 +0100 Subject: [PATCH 4/7] missing package-lock --- package-lock.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package-lock.json b/package-lock.json index dfeb8d44..122f2a83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -70,6 +70,7 @@ "rollup-plugin-typescript2": "^0.32.1", "tailwindcss": "^3.3.1", "typedoc": "^0.27.6", + "typedoc-plugin-coverage": "^3.4.1", "typescript": "^5.7.3", "vite": "^6.0.11", "vitest": "^3.0.5" @@ -7972,6 +7973,19 @@ "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x" } }, + "node_modules/typedoc-plugin-coverage": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/typedoc-plugin-coverage/-/typedoc-plugin-coverage-3.4.1.tgz", + "integrity": "sha512-V23DAwinAMpGMGcL1R1s8Snr26hrjfIdwGf+4jR/65ZdmeAN+yRX0onfx5JlembTQhR6AePQ/parfQNS0AZ64A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "typedoc": "0.25.x || 0.26.x || 0.27.x" + } + }, "node_modules/typedoc/node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", From 96ce2f1a8fc9f73a9cb106d02db6bd8e5d0aa8c5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 4 Feb 2025 13:15:31 +0100 Subject: [PATCH 5/7] fix workflow --- .github/workflows/test.docs.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.docs.yml b/.github/workflows/test.docs.yml index 3e4cb83e..43f3f465 100644 --- a/.github/workflows/test.docs.yml +++ b/.github/workflows/test.docs.yml @@ -49,7 +49,4 @@ jobs: npm install npm run docs:generate ./scripts/docs-coverage.sh - working-directory: ./ - - -bash -c "COVERAGE=$(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1); echo $COVERAGE;if (( $COVERAGE >= $COVERAGE_REQUIRED )) then exit 0; else echo \"Coverage: $COVERAGE/$COVERAGE_REQUIRED\"; exit 1; fi" \ No newline at end of file + working-directory: ./ \ No newline at end of file From 1c966300ecfc3c7ce08aa243f5c099fd37247d11 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 4 Feb 2025 13:17:44 +0100 Subject: [PATCH 6/7] better debug output for doc-coverage script --- scripts/docs-coverage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/docs-coverage.sh b/scripts/docs-coverage.sh index 97ad4b10..4dea7c05 100755 --- a/scripts/docs-coverage.sh +++ b/scripts/docs-coverage.sh @@ -4,6 +4,6 @@ COVERAGE=$(sed -nE 's/.*>([0-9]{1,3})%<.*/\1/p' docs/coverage.svg | head -1) if (( $COVERAGE >= $COVERAGE_REQUIRED )) then exit 0; else - echo "Coverage: $COVERAGE/$COVERAGE_REQUIRED"; + echo "Coverage: $COVERAGE/$COVERAGE_REQUIRED%"; exit 1; fi \ No newline at end of file From b3559bbf043776b9d246ba751d0e7ae948647f64 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 4 Feb 2025 13:21:01 +0100 Subject: [PATCH 7/7] reduce docs coverage requirement to 0 --- .github/workflows/test.docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.docs.yml b/.github/workflows/test.docs.yml index 43f3f465..325fb2bd 100644 --- a/.github/workflows/test.docs.yml +++ b/.github/workflows/test.docs.yml @@ -38,7 +38,7 @@ jobs: needs: files-changed runs-on: ubuntu-latest env: - COVERAGE_REQUIRED: 10 + COVERAGE_REQUIRED: 0 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7 - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3