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

fix(ci): adjust sim conditional logic #3395

Merged
merged 6 commits into from
Jan 23, 2025
Merged

fix(ci): adjust sim conditional logic #3395

merged 6 commits into from
Jan 23, 2025

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Jan 22, 2025

Sim tests weren't automatically running on #3357 for changed files in x/.

Updates:

  • Just use tj-actions/changed-files which should better handle complicated branch history vs git diff
  • Align workflow logic to match e2e.yml logic
    • get PR labels via API rather than context to avoid race conditions (if you apply label after you open PR it will miss with context)
    • always run sim tests on merge queue. This should allow setting sim-ok as a required status check.
    • use reusable workflow for matrix logic so jobs show as skipped on pull request status
    • run on push to release/* branch

Run with no change and no label: https://github.com/zeta-chain/node/actions/runs/12914920558
Run with change in x/: https://github.com/zeta-chain/node/actions/runs/12914963998

Summary by CodeRabbit

  • New Features

    • Added a new reusable GitHub Actions workflow for running simulation tests
    • Enhanced workflow to dynamically handle different Makefile targets
    • Improved test execution logic with more flexible triggering conditions
  • Workflow Updates

    • Updated GitHub Actions workflow to support release/* branch pattern
    • Refined file change detection and test targeting mechanisms

@gartnera gartnera added the no-changelog Skip changelog CI check label Jan 22, 2025
Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

📝 Walkthrough

Walkthrough

A new reusable GitHub Actions workflow reusable-sim.yml has been introduced to standardize simulation test execution. The workflow provides a flexible, parameterized approach to running Makefile targets, with configurable inputs for target specification, execution conditions, and runner environment. It encapsulates a standard set of steps for checking out code, setting up Go, installing dependencies, and executing specified simulation tests.

Changes

File Change Summary
.github/workflows/reusable-sim.yml New reusable workflow file for simulation tests with configurable inputs and standardized execution steps
.github/workflows/sim.yaml Updated to use the new reusable workflow, modified file change detection, and simplified job logic

Sequence Diagram

sequenceDiagram
    participant Caller as Workflow Caller
    participant Reusable as Reusable Sim Workflow
    participant Makefile as Makefile Target

    Caller->>Reusable: Trigger with inputs
    Reusable->>Reusable: Validate inputs
    Reusable->>Reusable: Checkout code
    Reusable->>Reusable: Setup Go
    Reusable->>Reusable: Install dependencies
    Reusable->>Makefile: Execute specified target
Loading

Possibly related PRs

Suggested Labels

UPGRADE_LIGHT_TESTS

Suggested Reviewers

  • lumtis
  • julianrubino
  • skosito

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. (Beta)
  • @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.

@github-actions github-actions bot added the ci Changes to CI pipeline or github actions label Jan 22, 2025
@gartnera gartnera force-pushed the sim-tests-logic branch 5 times, most recently from 8b65aa9 to e46031c Compare January 22, 2025 18:21
@gartnera gartnera force-pushed the sim-tests-logic branch 5 times, most recently from ca7877b to ea8e9f2 Compare January 22, 2025 18:42
@gartnera gartnera marked this pull request as ready for review January 22, 2025 18:55
@gartnera gartnera requested a review from a team as a code owner January 22, 2025 18:55
Copy link
Contributor

@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: 2

🧹 Nitpick comments (4)
.github/workflows/reusable-sim.yml (2)

21-22: Consider adding matrix configuration options.

The strategy block is defined but only contains fail-fast: false. Consider adding the ability to pass matrix configuration through inputs for more flexibility.

     strategy:
       fail-fast: false
+      matrix: ${{ fromJSON(inputs.matrix || '{}') }}

This would require adding a new input:

      matrix:
        description: 'Optional matrix configuration in JSON format'
        required: false
        type: string

35-37: Consider adding error handling for make command.

The make command execution could benefit from additional error handling and output capture.

       - name: Run ${{ inputs.make-target }}
         run: |
+          set -eo pipefail
           make ${{ inputs.make-target }}
+          if [ $? -ne 0 ]; then
+            echo "::error::Failed to execute make target: ${{ inputs.make-target }}"
+            exit 1
+          fi
.github/workflows/sim.yaml (2)

33-36: Consider caching changed files output.

The tj-actions/changed-files action could benefit from caching to improve workflow execution time, especially for large repositories.

       - name: Get changed files in x directory
         id: x-changes
         uses: tj-actions/changed-files@v45
         with:
           files: x/**
+          cache: true

103-103: Consider adding timeout for sim-ok job.

The sim-ok job should have a timeout to prevent hanging in case of issues.

     if: ${{ !cancelled() }}
+    timeout-minutes: 5
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 815c8b8 and bcff8a5.

📒 Files selected for processing (2)
  • .github/workflows/reusable-sim.yml (1 hunks)
  • .github/workflows/sim.yaml (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: start-e2e-test / e2e
  • GitHub Check: test-sim-nondeterminism / sim
  • GitHub Check: gosec
  • GitHub Check: build-and-test
  • GitHub Check: build
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
.github/workflows/sim.yaml (1)

95-98: LGTM! Excellent use of reusable workflow.

The implementation of the reusable workflow pattern is clean and well-structured. This will improve maintainability and reduce duplication.

.github/workflows/reusable-sim.yml Show resolved Hide resolved
.github/workflows/sim.yaml Show resolved Hide resolved
@gartnera gartnera enabled auto-merge January 23, 2025 16:49
Copy link
Member

@julianrubino julianrubino left a comment

Choose a reason for hiding this comment

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

lgtm

@gartnera gartnera added this pull request to the merge queue Jan 23, 2025
Merged via the queue into develop with commit 115b21e Jan 23, 2025
47 checks passed
@gartnera gartnera deleted the sim-tests-logic branch January 23, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Changes to CI pipeline or github actions no-changelog Skip changelog CI check SIM_TESTS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants