Skip to content

Commit c4c9b20

Browse files
committed
WIP: TEST BENCHMARK!
1 parent 70ce714 commit c4c9b20

3 files changed

Lines changed: 50 additions & 38 deletions

File tree

.github/workflows/performance.yaml

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,45 @@ env:
1414
REDOCLY_TELEMETRY: off
1515

1616
jobs:
17-
latest-vs-next:
18-
# Do not run on the release branch (changeset-release/main):
19-
if: github.head_ref != 'changeset-release/main'
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/checkout@v4
23-
- uses: actions/setup-node@v3
24-
with:
25-
node-version: 24
26-
cache: npm
27-
- name: Install Dependencies
28-
run: npm ci
29-
- name: Install External
30-
run: npm i -g hyperfine
31-
- name: Prepare
32-
run: |
33-
npm run compile
34-
npm run pack:prepare
35-
cd tests/performance/
36-
npm i
37-
npm run make-test
17+
# latest-vs-next:
18+
# # Do not run on the release branch (changeset-release/main):
19+
# if: github.head_ref != 'changeset-release/main'
20+
# runs-on: ubuntu-latest
21+
# steps:
22+
# - uses: actions/checkout@v4
23+
# - uses: actions/setup-node@v3
24+
# with:
25+
# node-version: 24
26+
# cache: npm
27+
# - name: Install Dependencies
28+
# run: npm ci
29+
# - name: Install External
30+
# run: npm i -g hyperfine
31+
# - name: Prepare
32+
# run: |
33+
# npm run compile
34+
# npm run pack:prepare
35+
# cd tests/performance/
36+
# npm i
37+
# npm run make-test
3838

39-
- name: Run Benchmark
40-
run: |
41-
cd tests/performance/
42-
npm run compare_latest_vs_next
43-
cat benchmark_check.md
44-
npm run chart # Creates benchmark_chart.md with the performance bar chart.
39+
# - name: Run Benchmark
40+
# run: |
41+
# cd tests/performance/
42+
# npm run compare_latest_vs_next
43+
# cat benchmark_check.md
44+
# npm run chart # Creates benchmark_chart.md with the performance bar chart.
4545

46-
- name: Comment PR
47-
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
48-
uses: thollander/actions-comment-pull-request@v2
49-
with:
50-
filePath: tests/performance/benchmark_chart.md
51-
comment_tag: latest-vs-next-comparison
46+
# - name: Comment PR
47+
# if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
48+
# uses: thollander/actions-comment-pull-request@v2
49+
# with:
50+
# filePath: tests/performance/benchmark_chart.md
51+
# comment_tag: latest-vs-next-comparison
5252

5353
historical-versions:
5454
# Run only on release branch (changeset-release/main):
55-
if: github.head_ref == 'changeset-release/main'
55+
# if: github.head_ref == 'changeset-release/main'
5656
runs-on: ubuntu-latest
5757
steps:
5858
- uses: actions/checkout@v4
@@ -64,6 +64,13 @@ jobs:
6464
run: npm ci
6565
- name: Install External
6666
run: npm i -g hyperfine
67+
68+
- name: Clean up versions
69+
# Do not run on the release branch (changeset-release/main):
70+
if: github.head_ref != 'changeset-release/main'
71+
run: |
72+
echo "Cleaning up versions..."
73+
6774
- name: Prepare
6875
run: |
6976
npm run compile
@@ -75,7 +82,7 @@ jobs:
7582
- name: Run Benchmark
7683
run: |
7784
cd tests/performance/
78-
npm run compare_historical_versions # This command is generated and injected into package.json in the previous step.
85+
npm run test # This command is generated and injected into package.json in the previous step.
7986
cat benchmark_check.md
8087
npm run chart # Creates benchmark_chart.md with the performance bar chart.
8188

tests/performance/make-test-command.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ cd api-definitions && npm install && cd ..
1010
echo REDOCLY_SUPPRESS_UPDATE_NOTICE=true hyperfine --warmup 1 $(cat package.json | jq '.dependencies' | jq 'keys' | jq 'map("'\''node node_modules/" + . + "/bin/cli.js lint core@public --config=api-definitions/redocly.yaml --generate-ignore-file'\''")' | jq 'join(" ")' | xargs) --export-markdown benchmark_check.md --export-json benchmark_check.json > test-command.txt
1111

1212
# Put the command in the test section of the package.json:
13-
cat package.json | jq ".scripts.compare_historical_versions = \"$(cat test-command.txt)\"" > package.json
13+
cat package.json | jq ".scripts.test = \"$(cat test-command.txt)\"" > package.json

tests/performance/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
"scripts": {
77
"chart": "node chart.js > benchmark_chart.md",
88
"make-test": "bash make-test-command.sh",
9-
"compare_latest_vs_next": "REDOCLY_SUPPRESS_UPDATE_NOTICE=true hyperfine --warmup 1 'node node_modules/cli-latest/bin/cli.js lint core@public --config=api-definitions/redocly.yaml --generate-ignore-file' 'node node_modules/cli-next/bin/cli.js lint core@public --config=api-definitions/redocly.yaml --generate-ignore-file' --export-markdown benchmark_check.md --export-json benchmark_check.json",
10-
"compare_historical_versions": "Placeholder..."
9+
"FIXME: remove compare_latest_vs_next": "REDOCLY_SUPPRESS_UPDATE_NOTICE=true hyperfine --warmup 1 'node node_modules/cli-latest/bin/cli.js lint core@public --config=api-definitions/redocly.yaml --generate-ignore-file' 'node node_modules/cli-next/bin/cli.js lint core@public --config=api-definitions/redocly.yaml --generate-ignore-file' --export-markdown benchmark_check.md --export-json benchmark_check.json",
10+
"test": "Placeholder..."
1111
},
1212
"dependencies": {
13+
"cli-2.0.0": "npm:@redocly/cli@2.0.0",
14+
"cli-2.3.1": "npm:@redocly/cli@2.3.1",
15+
"cli-2.8.0": "npm:@redocly/cli@2.8.0",
16+
"cli-2.9.0": "npm:@redocly/cli@2.9.0",
17+
"cli-2.11.1": "npm:@redocly/cli@2.11.1",
1318
"cli-latest": "npm:@redocly/cli@latest",
1419
"cli-next": "file:../../redocly-cli.tgz"
1520
}

0 commit comments

Comments
 (0)