feat(l1): ethrex_replay
add new command to create cache for block
#8664
This file contains hidden or 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: PR Lines of Code Analysis | |
on: | |
pull_request: | |
branches: ["**"] | |
permissions: | |
pull-requests: write | |
jobs: | |
report-loc-changes: | |
name: Report PR Line Changes | |
runs-on: ubuntu-latest | |
# Skip the job if the PR is from a fork since it doesn't have permissions to post comments | |
if: github.event.pull_request.head.repo.fork == false | |
steps: | |
- name: Checkout PR Code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Find merge base | |
id: find_merge_base | |
env: | |
HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
BASE_REF: ${{ github.event.pull_request.base.ref }} | |
run: | | |
git fetch --depth=100000 origin $HEAD_REF | |
git fetch --depth=100000 origin $BASE_REF | |
MERGE_BASE=$(git merge-base origin/$HEAD_REF origin/$BASE_REF) | |
echo "merge_base=$MERGE_BASE" >> $GITHUB_OUTPUT | |
- name: Checkout merge base commit | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ steps.find_merge_base.outputs.merge_base }} | |
- name: Setup Rust Environment | |
uses: ./.github/actions/setup-rust | |
with: | |
components: rustfmt, clippy | |
- name: Run Lines of Code Counter for base | |
run: cd tooling/loc && make loc-detailed | |
# This creates current_detailed_loc_report.json for the base branch | |
- name: Rename base report to previous_detailed_loc_report.json | |
run: mv tooling/loc/current_detailed_loc_report.json tooling/loc/previous_detailed_loc_report.json | |
- name: Checkout PR | |
uses: actions/checkout@v4 | |
with: | |
clean: "false" # Don't clean the workspace, so we can keep the previous report | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Rust Environment | |
uses: ./.github/actions/setup-rust | |
with: | |
components: rustfmt, clippy | |
- name: Run Lines of Code Counter for PR | |
run: cd tooling/loc && make loc-detailed | |
# This creates current_detailed_loc_report.json | |
- name: Compare Detailed Lines of Code Count | |
run: cd tooling/loc && make loc-compare-detailed | |
# This reads current_detailed_loc_report.json and previous_detailed_loc_report.json | |
# and outputs detailed_loc_report.txt | |
- name: Check if report exists | |
id: check_report | |
run: | | |
if [ -s tooling/loc/detailed_loc_report.txt ]; then | |
echo "report_exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "report_exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Find comment | |
if: steps.check_report.outputs.report_exists == 'true' | |
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 | |
if: steps.check_report.outputs.report_exists == 'true' | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body-path: tooling/loc/detailed_loc_report.txt | |
edit-mode: replace |