ci(l1, l2, levm): add PR <> main
lines of code comparison comment in PRs
#1
Workflow file for this run
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
name: Benchmark LEVM vs REVM in PR | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["**"] | |
jobs: | |
detailed-loc-pr: | |
name: Detailed Lines of Code Count for PR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
with: | |
components: rustfmt, clippy | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run Lines of Code Counter for PR | |
run: make loc | |
- name: Upload PR Detailed Lines of Code Count Data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr-loc-data | |
path: current_detailed_loc_report.json | |
detailed-loc-main: | |
name: Detailed Lines of Code Count for main | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
with: | |
components: rustfmt, clippy | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run Lines of Code Counter for main | |
run: | | |
make loc | |
mv current_detailed_loc_report.json previous_detailed_loc_report.json | |
- name: Upload main Detailed Lines of Code Count Data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: main-loc-data | |
path: previous_detailed_loc_report.json | |
detailed-loc-comparison: | |
name: Compare Detailed Lines of Code Count | |
runs-on: ubuntu-latest | |
needs: [detailed-loc-pr, detailed-loc-main] | |
steps: | |
- name: Download PR Detailed Lines of Code Count Data | |
uses: actions/download-artifact@v4 | |
with: | |
name: pr-loc-data | |
path: . | |
- name: Download main Detailed Lines of Code Count Data | |
uses: actions/download-artifact@v4 | |
with: | |
name: main-loc-data | |
path: . | |
- name: Compare Detailed Lines of Code Count | |
run: make loc-pr | |
- name: Find comment | |
continue-on-error: true | |
uses: peter-evans/find-comment@v3 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: "github-actions[bot]" | |
body-includes: "Total lines changed" | |
- name: Create Comment | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body-path: detailed_loc_report.txt | |
edit-mode: replace |