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: when build fail will exit the release process #4319

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

winchesHe
Copy link
Member

@winchesHe winchesHe commented Dec 10, 2024

Closes #

📝 Description

⛳️ Current behavior (updates)

🚀 New behavior

💣 Is this a breaking change (Yes/No):

📝 Additional Information

Summary by CodeRabbit

  • Chores
    • Enhanced error handling and control flow in the release workflow.
    • Updated conditions for executing release steps based on build success.

Copy link

changeset-bot bot commented Dec 10, 2024

⚠️ No Changeset found

Latest commit: 2dbcdf3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nextui-docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 3:24pm
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 3:24pm

Copy link
Contributor

coderabbitai bot commented Dec 10, 2024

Walkthrough

The pull request modifies the release workflow configuration in .github/workflows/release.yaml to enhance error handling and control flow. Key changes include adding an id to the Build step, setting continue-on-error to false, and wrapping the build command in a conditional block to capture its exit code. Subsequent steps are now contingent on the success of the build, ensuring that the release process only proceeds if the build is successful. The conditions for creating a canary release have also been refined.

Changes

File Change Summary
.github/workflows/release.yaml - Modified Build step to include id and continue-on-error: false.
- Wrapped pnpm build command in a conditional block to capture exit code.
- Updated Create Release Pull Request or Publish to NPM step to execute only on successful build.
- Changed condition for Create canary release step to require successful build and specific changesets output.

Possibly related PRs

  • fix(workflows): release & pre-release flow #4184: The changes in this PR also involve modifications to the .github/workflows/release.yaml file, specifically related to the conditions for executing steps in the release workflow, which aligns with the enhancements made in the main PR regarding error handling and control flow.

Suggested reviewers

  • jrgarciadev

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
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: 0

🧹 Outside diff range and nitpick comments (2)
.github/workflows/release.yaml (2)

30-37: Simplify the build step while maintaining error visibility

While the error handling is good, we can simplify this without losing the error information.

Consider this simpler approach:

  - name: Build
    id: build
-   continue-on-error: false
-   # Custom turbo build failure information
    run: |
-     pnpm build || {
-       echo "Turbo build failed with exit code $?"
-       exit 1
-     }
+     echo "::group::Build Output"
+     pnpm build
+     echo "::endgroup::"

The continue-on-error: false is redundant as it's the default behavior. GitHub Actions will automatically show the exit code and error information. Using group commands improves log readability.


Line range hint 30-55: Well-structured fail-fast implementation for the release process

The changes implement a robust fail-fast approach in the release workflow:

  1. Early failure detection in the build step
  2. Proper step dependency chain using build status
  3. Consistent error handling across both regular and canary releases

This creates a more reliable release process by preventing potentially broken releases from being published.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2b1eb1b and 2dbcdf3.

📒 Files selected for processing (1)
  • .github/workflows/release.yaml (2 hunks)
🔇 Additional comments (2)
.github/workflows/release.yaml (2)

40-41: LGTM! Good safety check implementation

The condition steps.build.outcome == 'success' is a crucial safety measure that ensures the release process only continues if the build succeeds. This directly addresses the PR's objective.


55-55: Verify if the 15-minute timeout is sufficient

The condition steps.build.outcome == 'success' && steps.changesets.outputs.published != 'true' is correct, but let's verify if the 15-minute timeout is adequate for canary releases.

✅ Verification successful

Let me analyze the workflow durations:

  1. Run 1: 8 minutes 5 seconds (14:29:25 to 14:37:30)
  2. Run 2: 6 minutes 11 seconds (14:21:50 to 14:28:01)
  3. Run 3: 3 minutes 13 seconds (13:50:33 to 13:53:46)
  4. Run 4: 11 minutes 59 seconds (13:26:12 to 13:38:11)
  5. Run 5: 6 minutes 15 seconds (13:25:56 to 13:32:11)

Let me check if there's a timeout configuration in the workflow:


15-minute timeout is sufficient for canary releases

Based on the analysis of recent workflow runs, the longest execution took approximately 12 minutes, which is well within the 15-minute timeout limit. The average duration is around 7 minutes, providing adequate buffer for normal variations in build times.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check recent workflow runs to analyze build durations
gh api -X GET /repos/nextui-org/nextui/actions/workflows/release.yaml/runs \
  --jq '.workflow_runs[0:5] | .[] | {status: .status, conclusion: .conclusion, duration: .updated_at, created_at: .created_at}'

Length of output: 782


Script:

#!/bin/bash
# Check for timeout configurations in the workflow
rg "timeout-minutes" .github/workflows/release.yaml

Length of output: 103

@jrgarciadev jrgarciadev merged commit a289ff8 into canary Dec 10, 2024
8 checks passed
@jrgarciadev jrgarciadev deleted the fix/when-fail-exist-publish branch December 10, 2024 15:33
jrgarciadev added a commit that referenced this pull request Dec 10, 2024
* ci: when build fail will exit the release process (#4319)

* fix: on click event on interactive elements (#4322)

* chore: deprecated style added to api table

* ci(changesets): version packages (#4323)

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

---------

Co-authored-by: winches <329487092@qq.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Dec 10, 2024
@coderabbitai coderabbitai bot mentioned this pull request Jan 12, 2025
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