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

Update build.sh #46

Merged
merged 16 commits into from
Nov 18, 2024
Merged

Update build.sh #46

merged 16 commits into from
Nov 18, 2024

Conversation

strawmelonjuice
Copy link
Owner

@strawmelonjuice strawmelonjuice commented Nov 18, 2024

Pretty straight forward I think.

Summary by CodeRabbit

  • New Features

    • Introduced new flags for tracking frontend build status for TypeScript and Gleam.
    • Added a --help option for improved user guidance.
  • Bug Fixes

    • Enhanced error handling for invalid frontend options during tests.
    • Updated test execution logic for better feedback on test outcomes.
  • Chores

    • Improved directory creation for generated assets.
    • Standardised handling of the --quiet flag output.
    • Streamlined testing process in the GitHub Actions workflow.

Copy link
Contributor

coderabbitai bot commented Nov 18, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces significant updates to the build.sh script and the GitHub Actions workflow configuration in .github/workflows/test.yml. The build.sh script now includes new boolean variables for tracking frontend build statuses, enhanced error handling, and improved user guidance through a help option. The GitHub Actions workflow has been renamed and modified to trigger on pushes to both master and main, with a simplified command for testing that removes the frontend specification.

Changes

File Change Summary
build.sh - Introduced new variables: TEST_FE_TS, TEST_FE_GLEAM, TESTS_SUCCEEDED.
- Added --help option for usage instructions.
- Standardised --quiet flag handling.
- Updated directory creation to use mkdir -p.
- Revised logic for invalid frontend options.
- Refined test execution section for frontend tests.
.github/workflows/test.yml - Renamed workflow from test-fe-ts to tests.
- Updated triggers to include both master and main branches.
- Simplified run command in the testing job by removing --frontend-ts flag.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BuildScript as Build Script
    participant GitHubActions as GitHub Actions

    User->>BuildScript: Execute build.sh
    BuildScript->>BuildScript: Check for flags and options
    alt Help requested
        BuildScript->>User: Display usage instructions
    else Valid options
        BuildScript->>BuildScript: Create directories
        BuildScript->>BuildScript: Run tests
        alt Tests pass
            BuildScript->>User: Display success message
        else Tests fail
            BuildScript->>User: Display failure message
        end
    else Invalid options
        BuildScript->>User: Handle invalid options
    end
    User->>GitHubActions: Trigger workflow
    GitHubActions->>BuildScript: Execute build.sh --test
Loading

Possibly related PRs

  • Update build.sh #46: The changes in this PR directly modify the build.sh script, including the addition of the same new boolean variables (TEST_FE_TS, TEST_FE_GLEAM, and TESTS_SUCCEEDED) and enhancements to error handling and functionality, which are also present in the main PR.

Poem

🐰 In the land of code, where scripts do play,
A build was crafted in a brand new way.
With tests to run and flags to show,
Our rabbit hops high, as improvements flow!
So let’s cheer for changes, both big and small,
For in this code garden, we’ll flourish for all! 🌼

Warning

Rate limit exceeded

@strawmelonjuice has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5ff7c77 and 39c6bc3.


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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 1323bc9 and 1fd6ec8.

📒 Files selected for processing (1)
  • build.sh (8 hunks)
🧰 Additional context used
🪛 Shellcheck
build.sh

[info] 38-38: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 39-39: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 40-40: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 41-41: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 42-42: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 43-43: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 44-44: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 155-155: Double quote to prevent globbing and word splitting.

(SC2086)

🔇 Additional comments (1)
build.sh (1)

10-11: LGTM: Well-structured variable declarations

The new boolean flags for tracking frontend test status are properly initialised and follow consistent naming conventions.

build.sh Outdated Show resolved Hide resolved
build.sh Outdated Show resolved Hide resolved
build.sh Outdated Show resolved Hide resolved
build.sh Show resolved Hide resolved
build.sh Outdated Show resolved Hide resolved
build.sh Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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 comments (1)
build.sh (1)

Line range hint 202-250: Consider enhancing error handling in test execution

While the test tracking is good, consider these improvements:

  1. Add cleanup steps after test failures
  2. Capture and display test output for debugging
  3. Add error codes or categories for different types of failures

Example implementation:

 TESTS_SUCCEEDED=true
+TEST_OUTPUT_DIR="$LOCA/test_outputs"
+mkdir -p "$TEST_OUTPUT_DIR"
+
+cleanup_test_artifacts() {
+    if [ -d "$TEST_OUTPUT_DIR" ]; then
+        rm -rf "$TEST_OUTPUT_DIR"
+    fi
+}
+
+trap cleanup_test_artifacts EXIT
+
 clear
 res_noti 1 "Build completed, took $((duration / 60)) minutes and $((duration % 60)) seconds."
 res_noti 2 "Running tests"
 res_noti 1 "Running Cargo tests"
 cd "$LOCA/rsffi/" || exit 1
-cargo test || {
+cargo test 2>&1 | tee "$TEST_OUTPUT_DIR/cargo_test.log" || {
     res_fail "\t--> Cargo tests ran into an error."
+    res_fail "\t--> See $TEST_OUTPUT_DIR/cargo_test.log for details"
     TESTS_SUCCEEDED=false
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 1fd6ec8 and 7ad9907.

📒 Files selected for processing (1)
  • build.sh (8 hunks)
🧰 Additional context used
📓 Learnings (1)
build.sh (1)
Learnt from: strawmelonjuice
PR: strawmelonjuice/lumina#46
File: build.sh:155-155
Timestamp: 2024-11-18T20:07:27.251Z
Learning: In the Lumina project's `build.sh` script (Bash), the `$BUNFLAGS` variable is intentionally left unquoted to allow word splitting. Do not flag unquoted `$BUNFLAGS` as an issue in this script.
🪛 Shellcheck
build.sh

[info] 38-38: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 39-39: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 40-40: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 41-41: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 42-42: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 43-43: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 44-44: echo may not expand escape sequences. Use printf.

(SC2028)


[info] 155-155: Double quote to prevent globbing and word splitting.

(SC2086)

🔇 Additional comments (2)
build.sh (2)

10-11: LGTM: Well-structured variable declarations

The new boolean flags for tracking frontend test status are properly declared and initialised.


115-115: LGTM: Robust directory creation

Good use of mkdir -p to ensure parent directories are created as needed, preventing potential errors.

Also applies to: 157-157, 173-173

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

🧹 Outside diff range comments (1)
.github/workflows/test.yml (1)

Line range hint 1-1: Update workflow name to reflect its current purpose

The workflow name test-fe-gleam suggests it's specific to Gleam frontend testing, but the command now runs general tests without frontend specification. Consider renaming it to something more appropriate like test or test-all.

-name: test-fe-gleam
+name: test
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 7ad9907 and 5ff7c77.

📒 Files selected for processing (3)
  • .github/workflows/test-fe-ts.yml (0 hunks)
  • .github/workflows/test.yml (1 hunks)
  • build.sh (7 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/test-fe-ts.yml
🧰 Additional context used
📓 Learnings (1)
build.sh (1)
Learnt from: strawmelonjuice
PR: strawmelonjuice/lumina#46
File: build.sh:155-155
Timestamp: 2024-11-18T20:07:27.251Z
Learning: In the Lumina project's `build.sh` script (Bash), the `$BUNFLAGS` variable is intentionally left unquoted to allow word splitting. Do not flag unquoted `$BUNFLAGS` as an issue in this script.
🪛 Shellcheck
build.sh

[info] 121-121: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 123-123: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 124-124: Double quote to prevent globbing and word splitting.

(SC2086)


[info] 155-155: Double quote to prevent globbing and word splitting.

(SC2086)

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

29-29: Verify test coverage and required dependencies

The command has been simplified to bash ./build.sh --test, but we should ensure:

  1. Both TypeScript and Gleam frontend tests are covered
  2. All setup steps (Gleam, Bun) are still necessary
✅ Verification successful

Based on the shell script results, I can now provide the final response as the verification is complete:

Both frontend test suites and dependencies are properly handled

The build script correctly handles:

  • TypeScript frontend tests using Bun test runner
  • Gleam frontend tests using Gleam test runner
  • Required dependencies: both Gleam and Bun are used in the build script
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the build script's test coverage and dependency usage

# Check if build script uses both frontend test flags
echo "Checking build script for frontend test flags..."
rg -A 5 'TEST_FE_(TS|GLEAM)' build.sh

# Check if build script uses Gleam
echo "Checking Gleam usage..."
rg -l 'gleam' build.sh

# Check if build script uses Bun
echo "Checking Bun usage..."
rg -l 'bun' build.sh

Length of output: 1817

build.sh Outdated Show resolved Hide resolved
strawmelonjuice and others added 2 commits November 18, 2024 21:29
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Owner Author

@strawmelonjuice strawmelonjuice left a comment

Choose a reason for hiding this comment

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

👍

build.sh Outdated Show resolved Hide resolved
build.sh Outdated Show resolved Hide resolved
build.sh Outdated Show resolved Hide resolved
build.sh Outdated Show resolved Hide resolved
@strawmelonjuice
Copy link
Owner Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Nov 18, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@strawmelonjuice strawmelonjuice merged commit d419db8 into master Nov 18, 2024
5 checks passed
@strawmelonjuice strawmelonjuice deleted the update-build.sh branch November 18, 2024 20:44
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.

1 participant