2022-10-03 15:11:20 -05:00
|
|
|
name: Benchmark
|
|
|
|
|
|
|
|
on:
|
|
|
|
issue_comment:
|
|
|
|
types: [created]
|
|
|
|
|
2022-10-03 15:29:56 -05:00
|
|
|
env:
|
|
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
|
|
|
FORCE_COLOR: true
|
|
|
|
|
2022-10-03 15:11:20 -05:00
|
|
|
jobs:
|
|
|
|
benchmark:
|
|
|
|
if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && startsWith(github.event.comment.body, '!bench') }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
outputs:
|
|
|
|
PR-BENCH-14: ${{ steps.benchmark-pr.outputs.BENCH_RESULT14 }}
|
|
|
|
PR-BENCH-16: ${{ steps.benchmark-pr.outputs.BENCH_RESULT16 }}
|
|
|
|
MAIN-BENCH-14: ${{ steps.benchmark-main.outputs.BENCH_RESULT14 }}
|
|
|
|
MAIN-BENCH-16: ${{ steps.benchmark-main.outputs.BENCH_RESULT16 }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-10-28 13:36:50 -05:00
|
|
|
node-version: [14, 16]
|
2022-10-03 15:11:20 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
ref: ${{github.event.pull_request.head.sha}}
|
|
|
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
|
|
|
|
2022-10-28 13:36:50 -05:00
|
|
|
- name: Setup PNPM
|
|
|
|
uses: pnpm/action-setup@v2.2.1
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v3
|
2022-10-03 15:11:20 -05:00
|
|
|
with:
|
2022-10-28 13:36:50 -05:00
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
cache: 'pnpm'
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install
|
2022-10-03 15:11:20 -05:00
|
|
|
|
2022-10-03 15:29:56 -05:00
|
|
|
- name: Build Packages
|
|
|
|
run: pnpm run build
|
|
|
|
|
2022-10-03 15:11:20 -05:00
|
|
|
- name: Run benchmark
|
|
|
|
id: benchmark-pr
|
|
|
|
run: |
|
2022-12-06 10:19:51 -05:00
|
|
|
pnpm run --silent benchmark 2> ./bench-result.md
|
2022-10-13 14:53:47 -05:00
|
|
|
result=$(awk '/requests in/' ./bench-result.md)
|
2022-10-28 13:36:50 -05:00
|
|
|
echo "::set-output name=BENCH_RESULT${{matrix.node-version}}::$result"
|
2022-12-06 09:32:45 -05:00
|
|
|
echo "$result"
|
2022-12-06 10:19:51 -05:00
|
|
|
shell: bash
|
2022-10-03 15:11:20 -05:00
|
|
|
|
|
|
|
# main benchmark
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
ref: 'main'
|
|
|
|
|
|
|
|
- name: Install
|
|
|
|
run: |
|
|
|
|
pnpm install
|
|
|
|
|
2022-10-03 15:29:56 -05:00
|
|
|
- name: Build Packages
|
|
|
|
run: pnpm run build
|
|
|
|
|
2022-10-03 15:11:20 -05:00
|
|
|
- name: Run benchmark
|
|
|
|
id: benchmark-main
|
|
|
|
run: |
|
2022-12-06 10:19:51 -05:00
|
|
|
pnpm run --silent benchmark 2> ./bench-result.md
|
2022-10-13 14:53:47 -05:00
|
|
|
result=$(awk '/requests in/' ./bench-result.md)
|
2022-10-28 13:36:50 -05:00
|
|
|
echo "::set-output name=BENCH_RESULT${{matrix.node-version}}::$result"
|
2022-12-06 09:32:45 -05:00
|
|
|
echo "$result"
|
2022-12-06 10:19:51 -05:00
|
|
|
shell: bash
|
2022-10-03 15:11:20 -05:00
|
|
|
|
|
|
|
output-benchmark:
|
|
|
|
if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && startsWith(github.event.comment.body, '!bench') }}
|
|
|
|
needs: [benchmark]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
pull-requests: write
|
|
|
|
steps:
|
|
|
|
- name: Comment PR
|
|
|
|
uses: thollander/actions-comment-pull-request@v1
|
|
|
|
with:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-10-03 15:44:41 -05:00
|
|
|
pr_number: ${{ github.event.issue.number }}
|
2022-10-03 15:11:20 -05:00
|
|
|
message: |
|
|
|
|
**Node**: 14
|
2022-10-13 14:53:47 -05:00
|
|
|
**PR**: ${{ needs.benchmark.outputs.PR-BENCH-14 }}
|
|
|
|
**MAIN**: ${{ needs.benchmark.outputs.MAIN-BENCH-14 }}
|
2022-10-03 15:11:20 -05:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
**Node**: 16
|
2022-10-13 14:53:47 -05:00
|
|
|
**PR**: ${{ needs.benchmark.outputs.PR-BENCH-16 }}
|
|
|
|
**MAIN**: ${{ needs.benchmark.outputs.MAIN-BENCH-16 }}
|