Skip to content

Commit c36eccc

Browse files
committed
WIP: TEST BENCHMARK!
1 parent a8d6ab4 commit c36eccc

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

.github/workflows/performance.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,27 @@ jobs:
2828
run: npm i -g hyperfine @redocly/cli@latest
2929
- name: Prepare
3030
run: |
31-
jq '.bin = {"redocly-next":"bin/cli.js"} | .name = "@redocly/cli-next"' packages/cli/package.json > __tmp__.json
32-
mv __tmp__.json packages/cli/package.json
33-
cat packages/cli/package.json
31+
npm run compile
3432
npm run pack:prepare
35-
npm i -g redocly-cli.tgz
36-
- run: redocly-next --version
37-
- run: redocly --version
33+
cd tests/performance/
34+
npm i
35+
npm run make-test
36+
3837
- name: Run Benchmark
39-
run: hyperfine -i --warmup 3 'redocly lint resources/rebilly.yaml' 'redocly-next lint resources/rebilly.yaml' --export-markdown benchmark_check.md --export-json benchmark_check.json
38+
run: |
39+
cd tests/performance/
40+
npm run compare-latest-vs-next
4041
4142
- name: Comment PR
4243
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
4344
uses: thollander/actions-comment-pull-request@v2
4445
with:
45-
filePath: benchmark_check.md
46+
filePath: tests/performance/benchmark_chart.md
4647
comment_tag: latest-vs-next-comparison
4748

4849
historical-versions:
4950
# Run only on release branch (changeset-release/main):
50-
if: github.head_ref == 'changeset-release/main'
51+
# if: github.head_ref == 'changeset-release/main' # FIXME: Uncomment this!
5152
runs-on: ubuntu-latest
5253
steps:
5354
- uses: actions/checkout@v4
@@ -66,10 +67,11 @@ jobs:
6667
cd tests/performance/
6768
npm i
6869
npm run make-test
70+
6971
- name: Run Benchmark
7072
run: |
7173
cd tests/performance/
72-
npm test # This command is generated and injected into package.json in the previous step.
74+
npm run compare-historical-versions # This command is generated and injected into package.json in the previous step.
7375
cat benchmark_check.md
7476
npm run chart # Creates benchmark_chart.md with the performance bar chart.
7577

tests/performance/make-test-command.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ git clone https://github.com/Rebilly/api-definitions.git
77
cd api-definitions && npm install && cd ..
88

99
# Store the command into a text file:
10-
echo REDOCLY_SUPPRESS_UPDATE_NOTICE=true hyperfine --warmup 3 $(cat package.json | jq '.dependencies' | jq 'keys' | jq 'map("'\''node node_modules/" + . + "/bin/cli.js lint --config=api-definitions/redocly.yaml --generate-ignore-file'\''")' | jq 'join(" ")' | xargs) --export-markdown benchmark_check.md --export-json benchmark_check.json > test-command.txt
10+
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.test = \"$(cat test-command.txt)\"" > package.json
13+
cat package.json | jq ".scripts.compare-historical-versions = \"$(cat test-command.txt)\"" > package.json

tests/performance/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
"private": true,
66
"scripts": {
77
"chart": "node chart.js > benchmark_chart.md",
8-
"make-test": "bash make-test-command.sh"
8+
"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..."
911
},
1012
"dependencies": {
11-
"cli-2.0.0": "npm:@redocly/cli@2.0.0",
12-
"cli-2.3.1": "npm:@redocly/cli@2.3.1",
13-
"cli-2.8.0": "npm:@redocly/cli@2.8.0",
14-
"cli-2.9.0": "npm:@redocly/cli@2.9.0",
15-
"cli-2.11.1": "npm:@redocly/cli@2.11.1",
13+
"cli-latest": "npm:@redocly/cli@latest",
1614
"cli-next": "file:../../redocly-cli.tgz"
1715
}
1816
}

0 commit comments

Comments
 (0)