chore: update issue template and add changesets validation, improve benchmark output (#1679)

This commit is contained in:
Andrew Tatomyr
2024-08-28 12:44:50 +03:00
committed by GitHub
parent b53b648359
commit 8d3d99045a
7 changed files with 43 additions and 8 deletions

View File

@@ -39,6 +39,10 @@ At a minimum, please state the specification version(s) you're using (e.g. 2.0,
<!-- What version of `node.js` are you using? -->
**OS, environment**
<!-- What OS are you using? -->
**Additional context**
<!-- Add any other context about the problem here. -->

View File

@@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: errata-ai/vale-action@reviewdog
with:
files: '["README.md", "docs"]'
files: '["README.md", "docs", ".changeset"]'
filter_mode: file
fail_on_error: true

View File

@@ -66,6 +66,7 @@ jobs:
cd benchmark/
npm test # This command is generated and injected into package.json in the previous step.
cat benchmark_check.md
npm run chart # Creates benchmark_chart.md with the performance bar chart.
env:
CI: true
REDOCLY_TELEMETRY: off
@@ -74,5 +75,5 @@ jobs:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
uses: thollander/actions-comment-pull-request@v2
with:
filePath: benchmark/benchmark_check.md
filePath: benchmark/benchmark_chart.md
comment_tag: historical-versions-comparison

View File

@@ -122,7 +122,7 @@ It only checks links within the local docs (it can't check links to other docs s
## Built-in rules changes
After adding a new rule, make sure it is added to the `minimal`, `recommended` and `all` rulesets with appropriate severity levels. The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
After adding a new rule, make sure it is added to the `minimal`, `recommended`, `recommended-strict` (the same as the previous but with warnings turned into error) and `all` rulesets with appropriate severity levels. The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
Also add the rule to the `builtInRulesList` in [the config types tree](../packages/core/src/types/redocly-yaml.ts).
Separately, open a merge request with the corresponding documentation changes.
@@ -150,10 +150,10 @@ The **redocly.yaml** file is the most flexible way of providing arguments. Pleas
The application maintains the following exit codes.
| Exit code | Description |
| --------- | ------------------------ |
| --------- | ------------------------- |
| 0 | Success |
| 1 | Command execution error |
| 2 | Config resolving failure |
| 2 | Config resolution failure |
## Tests

View File

@@ -4,3 +4,4 @@ package-lock.json
test-command.txt
benchmark_check.md
benchmark_check.json
benchmark_chart.md

26
benchmark/chart.mjs Normal file
View File

@@ -0,0 +1,26 @@
import fs from 'node:fs';
const content = fs.readFileSync('benchmark_check.json', 'utf8');
const json = JSON.parse(content);
const arr = json.results.map((r) => [
r.command.replace(/^node node_modules\/([^/]+)\/.*/, (_, cliVersion) => cliVersion),
r.mean,
]);
const min = Math.min(...arr.map(([_, mean]) => mean));
const max = Math.max(...arr.map(([_, mean]) => mean));
const constructBarForChart = (x) => {
const length = Math.floor(x * 30);
return '▓' + '▓'.repeat(length);
};
const output = [
'| CLI Version | Performance benchmark (test duration) |',
'|---|---|',
...arr.map(
([cliVersion, mean]) =>
`| ${cliVersion} | ${constructBarForChart((mean - min) / (max - min))} |`
),
].join('\n');
process.stdout.write(output);

View File

@@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "Test benchmark for Redocly CLI",
"scripts": {
"chart": "node chart.mjs > benchmark_chart.md",
"make-test": "bash make-test-command.sh"
},
"dependencies": {
@@ -26,6 +27,8 @@
"cli-1.17": "npm:@redocly/cli@1.17.1",
"cli-1.18": "npm:@redocly/cli@1.18.1",
"cli-1.19": "npm:@redocly/cli@1.19.0",
"cli-1.20": "npm:@redocly/cli@1.20.1",
"cli-1.21": "npm:@redocly/cli@1.21.1",
"cli-next": "file:../redocly-cli.tgz"
}
}