astro/.github/workflows/benchmark.yml
Michael Rienstra d7b27a17e3
GitHub Actions: add install action (#5196)
* GitHub Actions: add install action
to reduce duplication

* debug, temp

* expect strings
add warnings

* minor, consistency

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2022-10-28 12:40:03 -04:00

89 lines
2.7 KiB
YAML

name: Benchmark
on:
issue_comment:
types: [created]
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
FORCE_COLOR: true
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:
NODE_VERSION: [14, 16]
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}}
- name: Install Tools & Dependencies
uses: ./.github/actions/install
with:
node-version: ${{ matrix.NODE_VERSION }}
- name: Build Packages
run: pnpm run build
- name: Run benchmark
id: benchmark-pr
run: |
pnpm run --silent benchmark > ./bench-result.md
result=$(awk '/requests in/' ./bench-result.md)
echo "::set-output name=BENCH_RESULT${{matrix.NODE_VERSION}}::$result"
# main benchmark
- uses: actions/checkout@v3
with:
persist-credentials: false
ref: 'main'
- name: Install
run: |
pnpm install
- name: Build Packages
run: pnpm run build
- name: Run benchmark
id: benchmark-main
run: |
pnpm run --silent benchmark > ./bench-result.md
result=$(awk '/requests in/' ./bench-result.md)
echo "::set-output name=BENCH_RESULT${{matrix.NODE_VERSION}}::$result"
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 }}
pr_number: ${{ github.event.issue.number }}
message: |
**Node**: 14
**PR**: ${{ needs.benchmark.outputs.PR-BENCH-14 }}
**MAIN**: ${{ needs.benchmark.outputs.MAIN-BENCH-14 }}
---
**Node**: 16
**PR**: ${{ needs.benchmark.outputs.PR-BENCH-16 }}
**MAIN**: ${{ needs.benchmark.outputs.MAIN-BENCH-16 }}