feat: Performance benchmark!! (#153)
This commit is contained in:
parent
ce5ef7c7cb
commit
0aa4d11bdd
20 changed files with 538 additions and 54 deletions
50
.github/workflows/benchmark.yml
vendored
Normal file
50
.github/workflows/benchmark.yml
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
name: Benchmark
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
push:
|
||||
branches:
|
||||
- perf-test
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
# if: >-
|
||||
# github.event.issue.pull_request != '' &&
|
||||
# (
|
||||
# contains(github.event.comment.body, '/benchmark')
|
||||
# )
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- run: lscpu
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
# with:
|
||||
# ref: refs/pull/${{ github.event.issue.number }}/head
|
||||
- run: npm i -g pnpm@9.0.4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: "pnpm"
|
||||
- run: pnpm install
|
||||
- run: pnpm build
|
||||
- run: nohup pnpm prod-start &
|
||||
- run: pnpm test:benchmark
|
||||
id: benchmark
|
||||
continue-on-error: true
|
||||
# read benchmark results from stdout
|
||||
- run: |
|
||||
if [ -f benchmark.txt ]; then
|
||||
# Format the benchmark results for GitHub comment
|
||||
BENCHMARK_RESULT=$(cat benchmark.txt | sed 's/^/- /')
|
||||
echo "BENCHMARK_RESULT<<EOF" >> $GITHUB_ENV
|
||||
echo "$BENCHMARK_RESULT" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
else
|
||||
echo "BENCHMARK_RESULT=Benchmark failed to run or produce results" >> $GITHUB_ENV
|
||||
fi
|
||||
- uses: mshick/add-pr-comment@v2
|
||||
with:
|
||||
allow-repeats: true
|
||||
message: |
|
||||
Benchmark result: ${{ env.BENCHMARK_RESULT }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue