This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
feat(rome_css_parser): CSS lexer #4682 #6141
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parser benchmark, compares main and PR branch with Criterion. | |
# Comment with text containing `!bench`, a new result will be commented at the bottom of this PR. | |
name: Formatter Benchmark | |
on: | |
issue_comment: | |
types: [ created ] | |
env: | |
RUST_LOG: info | |
jobs: | |
bench: | |
name: Bench | |
if: github.event.issue.pull_request && contains(github.event.comment.body, '!bench_formatter') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get PR SHA | |
id: sha | |
uses: actions/github-script@v6 | |
with: | |
result-encoding: string | |
script: | | |
const response = await github.request(context.payload.issue.pull_request.url); | |
return response.data.head.sha; | |
- name: Checkout PR Branch | |
uses: actions/checkout@v3 | |
with: | |
submodules: false | |
ref: ${{ steps.sha.outputs.result }} | |
- name: Install toolchain | |
uses: moonrepo/setup-rust@v0 | |
- name: Install critcmp | |
run: cargo install critcmp | |
- name: Compile | |
run: cargo build --release --locked -p xtask_bench | |
- name: Run Bench on PR Branch | |
run: cargo bench_formatter --save-baseline pr | |
- name: Checkout Main Branch | |
uses: actions/checkout@v3 | |
with: | |
clean: false | |
ref: main | |
- name: Run Bench on Main Branch | |
run: cargo bench_formatter --save-baseline main | |
- name: Compare Bench Results | |
id: bench_comparison | |
shell: bash | |
run: | | |
echo "### Formatter Benchmark Results" > output | |
echo "\`\`\`" >> output | |
critcmp main pr >> output | |
echo "\`\`\`" >> output | |
cat output | |
echo "comment<<EOF" >> $GITHUB_OUTPUT | |
cat output >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Write a new comment | |
uses: peter-evans/[email protected] | |
continue-on-error: true | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
${{ steps.bench_comparison.outputs.comment }} | |
- name: Remove Criterion Artifact | |
run: rm -rf ./target/criterion |