Compare commits

...

5 Commits

Author SHA1 Message Date
elle-j 6187f76d63 Control concurrency and cancel in-progress runs when re-triggered. 2025-12-02 16:38:06 +01:00
LJ e6ccaa0bab Merge branch 'main' into lj/ci-benchmarks 2025-12-02 08:13:11 +01:00
elle-j 7cc1921c01 Update naming. 2025-11-27 21:31:31 +01:00
elle-j 3446aaa238 Update checkouts and report generation. 2025-11-27 17:21:41 +01:00
elle-j 0847b99a7d Implement initial workflow to run benchmarks. 2025-11-26 11:35:30 +01:00
+123
View File
@@ -0,0 +1,123 @@
# This workflow will run on the default branch when triggered by a `workflow_run` event.
name: Benchmark
on:
workflow_run:
workflows: [Test]
types: [completed]
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
jobs:
benchmark:
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
permissions:
pull-requests: write
steps:
- 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
with:
# Without this it will override our rust flags.
rustflags: ""
- name: Install Solc
uses: ./.github/actions/get-solc
- name: Download LLVM
uses: ./.github/actions/get-llvm
with:
target: x86_64-unknown-linux-gnu
- name: Set LLVM Environment Variables
run: |
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
- name: Install Benchmarking Tools
run: |
cargo install critcmp
- name: Checkout and Compile Main Branch
run: |
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
timeout-minutes: 20
- name: Checkout and Compile PR Branch
run: |
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
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
- name: Create Report
run: |
cat > BENCHMARK_REPORT.md << EOF
# Benchmarks
## Compile E2E
<details>
<summary>Results</summary>
\`\`\`
$(cat benchmarks_resolc)
\`\`\`
</details>
## Parse Yul
<details>
<summary>Results</summary>
\`\`\`
$(cat benchmarks_yul_parse)
\`\`\`
</details>
## Lower Yul
<details>
<summary>Results</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 }}
path: BENCHMARK_REPORT.md