Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use openrpc-testgen tool for RPC testing #2799

Open
wants to merge 61 commits into
base: main
Choose a base branch
from

Conversation

Uacias
Copy link

@Uacias Uacias commented Dec 12, 2024

Description

This PR adds a new dojo-tests job to the CI pipeline (ci.yml), which runs tests for the katana node using the openrpc-testgen tool.

Related issue

Tests

The new CI job run the following test suites within the dojo-tests job:

  • katana
  • katana-no-mining
  • katana-no-fee
  • katana-no-account-validation
  • open-rpc
  • Yes
  • No, because they aren't needed
  • No, because I need help

Added to documentation?

  • README.md
  • Dojo Book
  • No documentation needed

Checklist

  • [] I've formatted my code (scripts/prettier.sh, scripts/rust_fmt.sh, scripts/cairo_fmt.sh)
  • [] I've linted my code (scripts/clippy.sh, scripts/docs.sh)
  • [] I've commented my code
  • [] I've requested a review after addressing the comments

Summary by CodeRabbit

  • New Features

    • Introduced a new CI job dojo-tests for comprehensive testing of the Katana application.
    • Added manual trigger capability to the release workflow with a required version input.
  • Improvements

    • Enhanced versioning process in the release workflow for better management and automation.

Copy link

coderabbitai bot commented Dec 12, 2024

Walkthrough

Ohayo, sensei! This pull request introduces significant enhancements to the CI workflow by adding a new job named dojo-tests in .github/workflows/ci.yml, which runs after the build job. Additionally, the .github/workflows/release-dispatch.yml file is modified to allow manual triggering of the release process with a version input. The changes aim to improve testing for the Katana application and streamline the release process through version management.

Changes

File Change Summary
.github/workflows/ci.yml Added a new job dojo-tests that runs tests for the Katana application with various configurations.
.github/workflows/release-dispatch.yml Modified to include a workflow_dispatch trigger with a required version input for manual releases.

Possibly related PRs

Suggested reviewers

  • kariy: Suggested reviewer for this pull request.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (3)
.github/workflows/release-dispatch.yml (2)

Line range hint 4-9: Ohayo sensei! Consider adding version input pattern validation.

The version input could benefit from a pattern constraint to ensure it follows semantic versioning format.

       version:
         description: Version to release
         required: true
         type: string
+        pattern: '^v?\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$'

Line range hint 31-32: Consider using environment protection rules for the PAT token.

The CREATE_PR_TOKEN secret is used directly. Consider using environment protection rules for better security.

.github/workflows/ci.yml (1)

105-163: Consider consolidating test suite execution.

The test suite execution steps are repetitive. Consider creating a helper script to reduce duplication.

+ # Create test-suite.sh
+ #!/bin/bash
+ run_test_suite() {
+   local port="$1"
+   local suite="$2"
+   URLS="http://${KATANA_ADDR}:${port}"
+   target/release/openrpc-testgen-runner \
+     --urls "${URLS}" \
+     --paymaster-account-address "${PAYMASTER_ACCOUNT_ADDRESS}" \
+     --paymaster-private-key "${PAYMASTER_PRIVATE_KEY}" \
+     --udc-address "${UDC_ADDRESS}" \
+     --account-class-hash "${ACCOUNT_CLASS_HASH}" \
+     --suite "${suite}"
+ }

Then use it in the workflow:

      - name: Run Test Suites
        run: |
          chmod +x ./test-suite.sh
          ./test-suite.sh "${KATANA_PORT}" "katana"
          ./test-suite.sh "${KATANA_OPENRPC_PORT}" "open-rpc"
          ./test-suite.sh "${KATANA_NO_MINING_PORT}" "katana-no-mining"
          ./test-suite.sh "${KATANA_NO_FEE_PORT}" "katana-no-fee"
          ./test-suite.sh "${KATANA_NO_ACCOUNT_VALIDATION_PORT}" "katana-no-account-validation"
        working-directory: katana-runner
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91c76d9 and 13f7f50.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml (2 hunks)
  • .github/workflows/release-dispatch.yml (1 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/ci.yml

[error] 8-8: trailing spaces

(trailing-spaces)


[error] 80-80: trailing spaces

(trailing-spaces)

🪛 Gitleaks (8.21.2)
.github/workflows/ci.yml

40-40: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🪛 actionlint (1.7.4)
.github/workflows/ci.yml

32-32: label "arc-runner-set" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)


46-46: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


53-53: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


58-58: shellcheck reported issue in this script: SC2086:info:2:98: Double quote to prevent globbing and word splitting

(shellcheck)


58-58: shellcheck reported issue in this script: SC2086:info:3:28: Double quote to prevent globbing and word splitting

(shellcheck)


72-72: shellcheck reported issue in this script: SC2086:info:14:3: Double quote to prevent globbing and word splitting

(shellcheck)


90-90: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (1)
.github/workflows/ci.yml (1)

32-32: ⚠️ Potential issue

Update runner label configuration.

The arc-runner-set label is not recognized. Consider:

  1. Adding it to actionlint.yaml configuration
  2. Or using a standard runner label
🧰 Tools
🪛 actionlint (1.7.4)

32-32: label "arc-runner-set" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

.github/workflows/ci.yml Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
@glihm glihm changed the title Feat/tests ci ci: use openrpc-testgen tool for RPC testing Dec 12, 2024
@@ -27,6 +27,142 @@ jobs:
name: dojo-bins
path: bins

dojo-tests:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dojo-tests:
starknet-rpc:

Wondering if this should be in the same file since we may not want to run this at every CI, only when crates/katana path is actually modified. cc @kariy

@@ -5,7 +5,7 @@ on:
branches:
- main
pull_request:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -27,6 +27,142 @@ jobs:
name: dojo-bins
path: bins

dojo-tests:
needs: build
runs-on: arc-runner-set
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From where this runner set is coming from?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is deployed on our visoft cluster.

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.75%. Comparing base (91c76d9) to head (13f7f50).
Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2799   +/-   ##
=======================================
  Coverage   55.74%   55.75%           
=======================================
  Files         439      439           
  Lines       55571    55571           
=======================================
+ Hits        30978    30981    +3     
+ Misses      24593    24590    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants