mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-06 04:21:09 +00:00
chore: add historical performance benchmarking (#1432)
This commit is contained in:
43
.github/workflows/performance.yaml
vendored
43
.github/workflows/performance.yaml
vendored
@@ -6,13 +6,13 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
hyperfine:
|
latest-vs-next:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 20
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -38,4 +38,41 @@ jobs:
|
|||||||
uses: thollander/actions-comment-pull-request@v2
|
uses: thollander/actions-comment-pull-request@v2
|
||||||
with:
|
with:
|
||||||
filePath: benchmark_check.md
|
filePath: benchmark_check.md
|
||||||
comment_tag: hyperfine-comparison
|
comment_tag: latest-vs-next-comparison
|
||||||
|
|
||||||
|
historical-versions:
|
||||||
|
# Run only on release branch (changeset-release/main):
|
||||||
|
if: github.head_ref == 'changeset-release/main'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: 'npm'
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
- name: Install External
|
||||||
|
run: npm i -g hyperfine
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
npm run compile
|
||||||
|
npm run pack:prepare
|
||||||
|
cd benchmark/
|
||||||
|
npm i
|
||||||
|
npm run make-test
|
||||||
|
- name: Run Benchmark
|
||||||
|
run: |
|
||||||
|
cd benchmark/
|
||||||
|
npm test
|
||||||
|
cat benchmark_check.md
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
REDOCLY_TELEMETRY: off
|
||||||
|
|
||||||
|
- name: Comment PR
|
||||||
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||||
|
uses: thollander/actions-comment-pull-request@v2
|
||||||
|
with:
|
||||||
|
filePath: benchmark/benchmark_check.md
|
||||||
|
comment_tag: historical-versions-comparison
|
||||||
|
|||||||
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -199,7 +199,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Send to a Slack channel
|
- name: Send to a Slack channel
|
||||||
id: slack
|
id: slack
|
||||||
uses: slackapi/slack-github-action@v1.23.0
|
uses: slackapi/slack-github-action@v1.25.0
|
||||||
with:
|
with:
|
||||||
channel-id: C019K52TC0L #releases
|
channel-id: C019K52TC0L #releases
|
||||||
payload-file-path: './output/release-message.json'
|
payload-file-path: './output/release-message.json'
|
||||||
|
|||||||
10
.github/workflows/tests.yaml
vendored
10
.github/workflows/tests.yaml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 20
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 20
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -56,7 +56,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 20
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
- name: Coverage Report
|
- name: Coverage Report
|
||||||
uses: artiomtr/jest-coverage-report-action@v2.0.8
|
uses: artiomtr/jest-coverage-report-action@v2.0.8
|
||||||
@@ -72,7 +72,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 20
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -86,7 +86,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 20
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|||||||
6
benchmark/.gitignore
vendored
Normal file
6
benchmark/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
api-definitions
|
||||||
|
node_modules
|
||||||
|
package-lock.json
|
||||||
|
test-command.txt
|
||||||
|
benchmark_check.md
|
||||||
|
benchmark_check.json
|
||||||
4
benchmark/README.md
Normal file
4
benchmark/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Historical versions benchmark
|
||||||
|
|
||||||
|
This directory is for automated benchmark testing of the existing versions of **Redocly CLI**.
|
||||||
|
After releasing a new version, please add its reference to the `dependencies` section of the [package.json](./package.json) file.
|
||||||
12
benchmark/make-test-command.sh
Normal file
12
benchmark/make-test-command.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eo pipefail # Fail on script errors
|
||||||
|
|
||||||
|
# Clone the repo with test openapi files:
|
||||||
|
git clone https://github.com/Rebilly/api-definitions.git
|
||||||
|
|
||||||
|
# Store the command into a text file:
|
||||||
|
echo hyperfine -i --warmup 3 $(cat package.json | jq '.dependencies' | jq 'keys' | jq 'map("'\''node node_modules/" + . + "/bin/cli.js lint api-definitions/openapi/openapi.yaml'\''")' | jq 'join(" ")' | xargs) --export-markdown benchmark_check.md --export-json benchmark_check.json > test-command.txt
|
||||||
|
|
||||||
|
# Put the command in the test section of the package.json:
|
||||||
|
cat package.json | jq ".scripts.test = \"$(cat test-command.txt)\"" > package.json
|
||||||
21
benchmark/package.json
Normal file
21
benchmark/package.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "benchmark",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Test benchmark for Redocly CLI",
|
||||||
|
"scripts": {
|
||||||
|
"make-test": "bash make-test-command.sh"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"cli-100": "npm:@redocly/cli@1.0.0",
|
||||||
|
"cli-110": "npm:@redocly/cli@1.1.0",
|
||||||
|
"cli-120": "npm:@redocly/cli@1.2.0",
|
||||||
|
"cli-130": "npm:@redocly/cli@1.3.0",
|
||||||
|
"cli-140": "npm:@redocly/cli@1.4.0",
|
||||||
|
"cli-150": "npm:@redocly/cli@1.5.0",
|
||||||
|
"cli-160": "npm:@redocly/cli@1.6.0",
|
||||||
|
"cli-170": "npm:@redocly/cli@1.7.0",
|
||||||
|
"cli-180": "npm:@redocly/cli@1.8.0",
|
||||||
|
"cli-190": "npm:@redocly/cli@1.9.0",
|
||||||
|
"cli-next": "file:../redocly-cli.tgz"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user