mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 04:27:58 +00:00
Update checkouts and report generation.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# This workflow will run on the default branch when triggered by a `workflow_run` event.
|
||||
|
||||
name: Benchmark
|
||||
|
||||
on:
|
||||
@@ -8,13 +10,14 @@ on:
|
||||
jobs:
|
||||
benchmark:
|
||||
runs-on: ubuntu-24.04
|
||||
# TODO: Add condition that the base branch in the PR is main.
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: Checkout PR Branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.workflow_run.head_sha }}
|
||||
|
||||
- name: Set Up Rust Toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
@@ -36,76 +39,81 @@ jobs:
|
||||
|
||||
- name: Install Benchmarking Tools
|
||||
run: |
|
||||
cargo install cargo-criterion critcmp
|
||||
cargo install critcmp
|
||||
|
||||
- name: Checkout and Compile Main Branch
|
||||
run: |
|
||||
git fetch origin "$GITHUB_DEFAULT_BRANCH":"$GITHUB_DEFAULT_BRANCH"
|
||||
git checkout -f "$GITHUB_DEFAULT_BRANCH"
|
||||
git fetch origin main
|
||||
git checkout -f main
|
||||
make install
|
||||
|
||||
- name: Run Benchmarks on Main Branch
|
||||
run: |
|
||||
cargo bench --package resolc --bench compile -- --save-baseline main-resolc
|
||||
cargo bench --package revive-yul --bench parse -- --save-baseline main-yul-parse
|
||||
cargo bench --package revive-yul --bench lower -- --save-baseline main-yul-lower
|
||||
cargo bench --package resolc --bench compile -- --save-baseline main_branch_resolc
|
||||
cargo bench --package revive-yul --bench parse -- --save-baseline main_branch_yul_parse
|
||||
cargo bench --package revive-yul --bench lower -- --save-baseline main_branch_yul_lower
|
||||
timeout-minutes: 20
|
||||
|
||||
- name: Checkout and Compile PR Branch
|
||||
run: |
|
||||
git checkout -f ${{ github.sha }}
|
||||
git checkout -f ${{ github.event.workflow_run.head_sha }}
|
||||
make install
|
||||
|
||||
- name: Run Benchmarks on PR Branch
|
||||
run: |
|
||||
cargo bench --package resolc --bench compile -- --save-baseline pr-resolc
|
||||
cargo bench --package revive-yul --bench parse -- --save-baseline pr-yul-parse
|
||||
cargo bench --package revive-yul --bench lower -- --save-baseline pr-yul-lower
|
||||
cargo bench --package resolc --bench compile -- --save-baseline pr_branch_resolc
|
||||
cargo bench --package revive-yul --bench parse -- --save-baseline pr_branch_yul_parse
|
||||
cargo bench --package revive-yul --bench lower -- --save-baseline pr_branch_yul_lower
|
||||
timeout-minutes: 20
|
||||
|
||||
- name: Compare Benchmarks
|
||||
run: |
|
||||
critcmp main-resolc pr-resolc > benchmarks-resolc
|
||||
critcmp main-yul-parse pr-yul-parse > benchmarks-yul-parse
|
||||
critcmp main-yul-lower pr-yul-lower > benchmarks-yul-lower
|
||||
critcmp main_branch_resolc pr_branch_resolc > benchmarks_resolc
|
||||
critcmp main_branch_yul_parse pr_branch_yul_parse > benchmarks_yul_parse
|
||||
critcmp main_branch_yul_lower pr_branch_yul_lower > benchmarks_yul_lower
|
||||
|
||||
- name: Post PR Comment with Benchmark Results
|
||||
- name: Create Report
|
||||
run: |
|
||||
cat > BENCHMARK_REPORT.md << EOF
|
||||
# Benchmarks
|
||||
|
||||
## Compile E2E
|
||||
|
||||
<details>
|
||||
<summary>Details</summary>
|
||||
|
||||
\`\`\`
|
||||
$(cat benchmarks_resolc)
|
||||
\`\`\`
|
||||
|
||||
</details>
|
||||
|
||||
## Parse Yul
|
||||
|
||||
<details>
|
||||
<summary>Details</summary>
|
||||
|
||||
\`\`\`
|
||||
$(cat benchmarks_yul_parse)
|
||||
\`\`\`
|
||||
|
||||
</details>
|
||||
|
||||
## Lower Yul
|
||||
|
||||
<details>
|
||||
<summary>Details</summary>
|
||||
|
||||
\`\`\`
|
||||
$(cat benchmarks_yul_lower)
|
||||
\`\`\`
|
||||
|
||||
</details>
|
||||
EOF
|
||||
|
||||
- name: Post PR Comment with Benchmark Report
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
header: benchmark
|
||||
number: ${{ github.event.workflow_run.pull_requests[0].number }}
|
||||
message: |
|
||||
# Benchmarks
|
||||
|
||||
## Compile E2E
|
||||
|
||||
<details>
|
||||
<summary>Details</summary>
|
||||
|
||||
```
|
||||
$(cat benchmarks-resolc)
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Parse Yul
|
||||
|
||||
<details>
|
||||
<summary>Details</summary>
|
||||
|
||||
```
|
||||
$(cat benchmarks-yul-parse)
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Lower Yul
|
||||
|
||||
<details>
|
||||
<summary>Details</summary>
|
||||
|
||||
```
|
||||
$(cat benchmarks-yul-lower)
|
||||
```
|
||||
|
||||
</details>
|
||||
path: BENCHMARK_REPORT.md
|
||||
|
||||
Reference in New Issue
Block a user