mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-23 14:11:07 +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
|
name: Benchmark
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -8,13 +10,14 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
benchmark:
|
benchmark:
|
||||||
runs-on: ubuntu-24.04
|
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' }}
|
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout PR Branch
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
|
||||||
- name: Set Up Rust Toolchain
|
- name: Set Up Rust Toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
@@ -36,76 +39,81 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Benchmarking Tools
|
- name: Install Benchmarking Tools
|
||||||
run: |
|
run: |
|
||||||
cargo install cargo-criterion critcmp
|
cargo install critcmp
|
||||||
|
|
||||||
- name: Checkout and Compile Main Branch
|
- name: Checkout and Compile Main Branch
|
||||||
run: |
|
run: |
|
||||||
git fetch origin "$GITHUB_DEFAULT_BRANCH":"$GITHUB_DEFAULT_BRANCH"
|
git fetch origin main
|
||||||
git checkout -f "$GITHUB_DEFAULT_BRANCH"
|
git checkout -f main
|
||||||
make install
|
make install
|
||||||
|
|
||||||
- name: Run Benchmarks on Main Branch
|
- name: Run Benchmarks on Main Branch
|
||||||
run: |
|
run: |
|
||||||
cargo bench --package resolc --bench compile -- --save-baseline main-resolc
|
cargo bench --package resolc --bench compile -- --save-baseline main_branch_resolc
|
||||||
cargo bench --package revive-yul --bench parse -- --save-baseline main-yul-parse
|
cargo bench --package revive-yul --bench parse -- --save-baseline main_branch_yul_parse
|
||||||
cargo bench --package revive-yul --bench lower -- --save-baseline main-yul-lower
|
cargo bench --package revive-yul --bench lower -- --save-baseline main_branch_yul_lower
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
|
|
||||||
- name: Checkout and Compile PR Branch
|
- name: Checkout and Compile PR Branch
|
||||||
run: |
|
run: |
|
||||||
git checkout -f ${{ github.sha }}
|
git checkout -f ${{ github.event.workflow_run.head_sha }}
|
||||||
make install
|
make install
|
||||||
|
|
||||||
- name: Run Benchmarks on PR Branch
|
- name: Run Benchmarks on PR Branch
|
||||||
run: |
|
run: |
|
||||||
cargo bench --package resolc --bench compile -- --save-baseline pr-resolc
|
cargo bench --package resolc --bench compile -- --save-baseline pr_branch_resolc
|
||||||
cargo bench --package revive-yul --bench parse -- --save-baseline pr-yul-parse
|
cargo bench --package revive-yul --bench parse -- --save-baseline pr_branch_yul_parse
|
||||||
cargo bench --package revive-yul --bench lower -- --save-baseline pr-yul-lower
|
cargo bench --package revive-yul --bench lower -- --save-baseline pr_branch_yul_lower
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
|
|
||||||
- name: Compare Benchmarks
|
- name: Compare Benchmarks
|
||||||
run: |
|
run: |
|
||||||
critcmp main-resolc pr-resolc > benchmarks-resolc
|
critcmp main_branch_resolc pr_branch_resolc > benchmarks_resolc
|
||||||
critcmp main-yul-parse pr-yul-parse > benchmarks-yul-parse
|
critcmp main_branch_yul_parse pr_branch_yul_parse > benchmarks_yul_parse
|
||||||
critcmp main-yul-lower pr-yul-lower > benchmarks-yul-lower
|
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
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
with:
|
with:
|
||||||
header: benchmark
|
header: benchmark
|
||||||
number: ${{ github.event.workflow_run.pull_requests[0].number }}
|
number: ${{ github.event.workflow_run.pull_requests[0].number }}
|
||||||
message: |
|
path: BENCHMARK_REPORT.md
|
||||||
# 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>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user