Merge pull request #98 from utopia-os/doc-coverage-requirement

feat(workflow): test documentation coverage
This commit is contained in:
Ulf Gebhardt 2025-02-04 14:00:48 +01:00 committed by GitHub
commit ca03ee5de8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 32 additions and 3 deletions

View File

@ -37,11 +37,16 @@ jobs:
name: Docs
needs: files-changed
runs-on: ubuntu-latest
env:
COVERAGE_REQUIRED: 0
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
working-directory: ./
run: |
npm install
npm run docs:generate
./scripts/docs-coverage.sh
working-directory: ./

14
package-lock.json generated
View File

@ -69,6 +69,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"
@ -7966,6 +7967,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",

View File

@ -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"

9
scripts/docs-coverage.sh Executable file
View File

@ -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