From 8184471f783a1c78c815e79fe854a03cfa97c16b Mon Sep 17 00:00:00 2001 From: Martin Paulucci Date: Thu, 9 Jan 2025 19:32:53 +0100 Subject: [PATCH] refactor(levm): merge daily hive jobs into a single job. (#1666) **Motivation** DRY Merged the LEVM hive report and the REVM one --- .github/workflows/daily_loc.yaml | 74 +++++++++++ .github/workflows/daily_reports.yaml | 118 +++++------------- .../workflows/daily_reports_levm_hive.yaml | 92 -------------- 3 files changed, 107 insertions(+), 177 deletions(-) create mode 100644 .github/workflows/daily_loc.yaml delete mode 100644 .github/workflows/daily_reports_levm_hive.yaml diff --git a/.github/workflows/daily_loc.yaml b/.github/workflows/daily_loc.yaml new file mode 100644 index 0000000000..d47f22a0e2 --- /dev/null +++ b/.github/workflows/daily_loc.yaml @@ -0,0 +1,74 @@ +name: Daily Lines of Code Report + +on: + schedule: + # Every day at UTC midnight + - cron: "0 0 * * 1,2,3,4,5" + workflow_dispatch: + +jobs: + loc: + name: Count ethrex loc and generate report + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Rustup toolchain install + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.RUST_VERSION }} + + - name: Add Rust Cache + uses: Swatinem/rust-cache@v2 + + - name: Restore cache + id: cache-loc-report + uses: actions/cache@v4 + with: + path: loc_report.json + key: loc-report-${{ github.ref_name }} + restore-keys: | + loc-report- + + - name: Rename cached loc_report.json to loc_report.json.old + if: steps.cache-loc-report.outputs.cache-hit != '' + run: mv loc_report.json loc_report.json.old + + - name: Generate the loc report + run: | + make loc + + - name: Save new loc_report.json to cache + if: success() + uses: actions/cache@v4 + with: + path: loc_report.json + key: loc-report-${{ github.ref_name }} + + - name: Post results in summary + run: | + echo "# 'ethrex' lines of code report" >> $GITHUB_STEP_SUMMARY + cat loc_report_github.txt >> $GITHUB_STEP_SUMMARY + + - name: Post results to ethrex L1 slack channel + env: + url: ${{ secrets.ETHREX_L1_SLACK_WEBHOOK }} + run: sh .github/scripts/publish_loc.sh + + - name: Post results to ethrex L2 slack channel + env: + url: ${{ secrets.ETHREX_L2_SLACK_WEBHOOK }} + run: sh .github/scripts/publish_loc.sh + + - name: Post results to levm slack channel + env: + url: ${{ secrets.LEVM_SLACK_WEBHOOK }} + run: sh .github/scripts/publish_loc.sh + + # This is left commented out to ease debugging later on. + # Comment out all the other "Post to * slack channel" directives + # - name: Post results to test slack channel + # env: + # url: ${{ secrets.TEST_CHANNEL_SLACK }} + # run: sh .github/scripts/publish_loc.sh diff --git a/.github/workflows/daily_reports.yaml b/.github/workflows/daily_reports.yaml index a9de059310..56bda91618 100644 --- a/.github/workflows/daily_reports.yaml +++ b/.github/workflows/daily_reports.yaml @@ -11,26 +11,28 @@ env: jobs: run-hive: - name: Hive - ${{ matrix.name }} + name: Hive (${{ matrix.vm }}) - ${{ matrix.test.name }} runs-on: ubuntu-latest strategy: matrix: - include: - - name: "Rpc Compat tests" - file_name: rpc-compat - simulation: ethereum/rpc-compat - - name: "Devp2p eth tests" - file_name: devp2p - simulation: devp2p - - name: "Cancun Engine tests" - file_name: engine - simulation: ethereum/engine - - name: "Sync tests" - file_name: sync - simulation: ethereum/sync + vm: [levm, revm] + test: + - { + name: "Rpc Compat tests", + file_name: rpc-compat, + simulation: ethereum/rpc-compat, + } + - { name: "Devp2p eth tests", file_name: devp2p, simulation: devp2p } + - { + name: "Cancun Engine tests", + file_name: engine, + simulation: ethereum/engine, + } + - { name: "Sync tests", file_name: sync, simulation: ethereum/sync } steps: - name: Pull image + if: ${{ matrix.vm == 'revm' }} run: | docker pull ghcr.io/lambdaclass/ethrex:latest docker tag ghcr.io/lambdaclass/ethrex:latest ethrex:latest @@ -38,6 +40,10 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 + - name: Build Image with LEVM + if: ${{ matrix.vm == 'levm' }} + run: cd crates/vm/levm && make build-image-levm + - name: Setup Go uses: actions/setup-go@v5 @@ -45,19 +51,22 @@ jobs: run: make setup-hive - name: Run Hive Simulation - run: cd hive && ./hive --client ethrex --sim ${{ matrix.simulation }} --sim.parallelism 16 + run: cd hive && ./hive --client ethrex --sim ${{ matrix.test.simulation }} --sim.parallelism 16 continue-on-error: true - name: Upload results uses: actions/upload-artifact@v4 with: - name: ${{ matrix.file_name }}_logs + name: ${{ matrix.test.file_name }}_${{ matrix.vm }}_logs path: hive/workspace/logs/*-*.json hive-report: - name: Generate report and upload to summary and slack + name: Generate report and upload to slack (${{ matrix.vm }}) needs: run-hive runs-on: ubuntu-latest + strategy: + matrix: + vm: [levm, revm] steps: - name: Checkout sources uses: actions/checkout@v4 @@ -71,7 +80,7 @@ jobs: uses: actions/download-artifact@v4 with: path: hive/workspace/logs - pattern: "*_logs" + pattern: "*_${{ matrix.vm }}_logs" merge-multiple: true - name: Caching @@ -82,7 +91,7 @@ jobs: - name: Post results in summary run: | - echo "# Hive coverage report" >> $GITHUB_STEP_SUMMARY + echo "# Hive coverage report (${{ matrix.vm }})" >> $GITHUB_STEP_SUMMARY cat results.md >> $GITHUB_STEP_SUMMARY - name: Post results to ethrex L1 slack channel @@ -98,73 +107,12 @@ jobs: - name: Post results to levm slack channel env: url: ${{ secrets.LEVM_SLACK_WEBHOOK }} - run: sh .github/scripts/publish.sh - - loc: - name: Count ethrex loc and generate report - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Rustup toolchain install - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.RUST_VERSION }} - - - name: Add Rust Cache - uses: Swatinem/rust-cache@v2 - - - name: Restore cache - id: cache-loc-report - uses: actions/cache@v4 - with: - path: loc_report.json - key: loc-report-${{ github.ref_name }} - restore-keys: | - loc-report- - - - name: Rename cached loc_report.json to loc_report.json.old - if: steps.cache-loc-report.outputs.cache-hit != '' - run: mv loc_report.json loc_report.json.old - - - name: Generate the loc report run: | - make loc - - - name: Save new loc_report.json to cache - if: success() - uses: actions/cache@v4 - with: - path: loc_report.json - key: loc-report-${{ github.ref_name }} - - - name: Post results in summary - run: | - echo "# 'ethrex' lines of code report" >> $GITHUB_STEP_SUMMARY - cat loc_report_github.txt >> $GITHUB_STEP_SUMMARY - - - name: Post results to ethrex L1 slack channel - env: - url: ${{ secrets.ETHREX_L1_SLACK_WEBHOOK }} - run: sh .github/scripts/publish_loc.sh - - - name: Post results to ethrex L2 slack channel - env: - url: ${{ secrets.ETHREX_L2_SLACK_WEBHOOK }} - run: sh .github/scripts/publish_loc.sh - - - name: Post results to levm slack channel - env: - url: ${{ secrets.LEVM_SLACK_WEBHOOK }} - run: sh .github/scripts/publish_loc.sh - - # This is left commented out to ease debugging later on. - # Comment out all the other "Post to * slack channel" directives - # - name: Post results to test slack channel - # env: - # url: ${{ secrets.TEST_CHANNEL_SLACK }} - # run: sh .github/scripts/publish_loc.sh + if [ "${{ matrix.vm }}" = "revm" ]; then + sh .github/scripts/publish.sh + elif [ "${{ matrix.vm }}" = "levm" ]; then + sh .github/scripts/publish_levm_hive.sh + fi levm-test: name: Generate Report for LEVM EF Tests diff --git a/.github/workflows/daily_reports_levm_hive.yaml b/.github/workflows/daily_reports_levm_hive.yaml deleted file mode 100644 index 4e2e6fc98a..0000000000 --- a/.github/workflows/daily_reports_levm_hive.yaml +++ /dev/null @@ -1,92 +0,0 @@ -name: Daily Reports Hive LEVM - -on: - schedule: - # Every day at UTC midnight - - cron: "0 0 * * 1,2,3,4,5" - workflow_dispatch: - -env: - RUST_VERSION: 1.81.0 - -jobs: - run-hive: - name: Hive - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Setup Go - uses: actions/setup-go@v5 - - - name: Build Image with LEVM - run: cd crates/vm/levm && make build-image-levm - - - name: Setup Hive - run: make setup-hive - - - name: Run Hive RPC Simulation - run: cd hive && ./hive --sim ethereum/rpc-compat --client ethrex --sim.limit "*" --sim.parallelism 16 - continue-on-error: true - - - name: Run Hive Sync Simulation - run: cd hive && ./hive --sim ethereum/sync --client ethrex --sim.limit "*" --sim.parallelism 16 - continue-on-error: true - - - name: Run Hive Engine Simulation - run: cd hive && ./hive --sim ethereum/engine --client ethrex --sim.limit "*" --sim.parallelism 16 - continue-on-error: true - - - name: Run Hive P2P Simulation - run: cd hive && ./hive --sim devp2p --client ethrex --sim.limit "*" --sim.parallelism 16 - continue-on-error: true - - - name: Upload results - uses: actions/upload-artifact@v4 - with: - name: testing_logs - path: hive/workspace/logs/*-*.json - - hive-report: - name: Generate report and upload to summary and slack - needs: run-hive - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Rustup toolchain install - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.RUST_VERSION }} - - - name: Download all results - uses: actions/download-artifact@v4 - with: - path: hive/workspace/logs - pattern: "*_logs" - merge-multiple: true - - - name: Caching - uses: Swatinem/rust-cache@v2 - - - name: Generate the hive report - run: cargo run -p hive_report > results.md - - - name: Post results in summary - run: | - echo "# LEVM Hive coverage report" >> $GITHUB_STEP_SUMMARY - cat results.md >> $GITHUB_STEP_SUMMARY - - - name: Post results to levm slack channel - env: - url: ${{ secrets.LEVM_SLACK_WEBHOOK }} - run: sh .github/scripts/publish_levm_hive.sh - - # Note: Leave this commented, as it is for testing purposes. - # - name: Post results to test channel for debugging - # env: - # url: ${{ secrets.TEST_CHANNEL_SLACK }} - # run: sh .github/scripts/publish_levm_hive.sh