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

chore(tests): Update infra script #16956

Merged
merged 6 commits into from
Nov 21, 2024
Merged

Conversation

svanaeinars
Copy link
Member

@svanaeinars svanaeinars commented Nov 20, 2024

Summary by CodeRabbit

  • Documentation

    • Updated the README to enhance clarity with specific installation commands and refined setup instructions.
    • Changed terminology from "CLI Tool" to "Infra Tool" in the CLI documentation, updating command references accordingly.
    • Expanded notes on running a proxy against development services with specific commands and warnings.
  • Chores

    • Updated script commands in package.json to execute in the infra directory context.
    • Deprecated the old CLI command in favor of the new Infra command.
  • New Features

    • Added a --print option to the run-local-env command for output control.

@svanaeinars svanaeinars requested review from a team as code owners November 20, 2024 13:37
Copy link
Contributor

coderabbitai bot commented Nov 20, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces several modifications primarily focused on enhancing the documentation within the README.md and infra/README.md files. Key updates include clearer installation commands, refined setup instructions, and improved formatting. Additionally, the command prefix in the CLI documentation has been changed from yarn cli to yarn infra, accompanied by updates in the package.json scripts to reflect this change. A new command option has been added in the CLI, and an obsolete script file has been removed.

Changes

File Change Summary
README.md Updated prerequisites with specific installation commands; refined development environment setup instructions; expanded proxy notes; improved formatting.
infra/README.md Changed terminology from "CLI Tool" to "Infra Tool"; updated command references from yarn cli to yarn infra.
infra/package.json Updated script command for "cli" to deprecate it; added a new script command "infra" for CLI functionality.
infra/src/cli/cli.ts Renamed cli constant to infra; added --print option to run-local-env command.
package.json Updated scripts to change execution context to infra/ directory.
scripts/infra-cmds.js Deleted file that managed infrastructure commands via CLI; included command loading and logging functionality.

Possibly related PRs

Suggested labels

deploy-feature

Suggested reviewers

  • svanaeinars

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.

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

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.41%. Comparing base (738ce63) to head (7e53f10).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16956   +/-   ##
=======================================
  Coverage   36.41%   36.41%           
=======================================
  Files        6898     6898           
  Lines      144881   144881           
  Branches    41407    41407           
=======================================
  Hits        52756    52756           
  Misses      92125    92125           
Flag Coverage Δ
api 3.34% <ø> (ø)
application-system-api 41.02% <ø> (ø)
application-template-api-modules 27.70% <ø> (-0.03%) ⬇️
application-templates-mortgage-certificate 43.45% <ø> (ø)
application-templates-parental-leave 29.92% <ø> (ø)
application-ui-shell 20.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 738ce63...7e53f10. Read the comment docs.

---- 🚨 Try these New Features:

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 (3)
infra/package.json (1)

39-40: Consider updating to a newer yarn version

While pinning the yarn version is good practice, version 3.2.3 is relatively old. Consider updating to the latest stable 3.x or 4.x version for security updates and improvements.

libs/testing/e2e/src/lib/config/playwright-config.ts (1)

28-28: Update JSDoc to reflect required cwd parameter

The cwd parameter is now required in the type interface, but the JSDoc still shows it as optional. This inconsistency should be addressed.

- * @param {string} config.cwd - Working directory for the web server command.
+ * @param {string} config.cwd - Required. Working directory for the web server command.
README.md (1)

78-78: LGTM! Consider using yarn workspace command instead.

The subshell command for installing infrastructure dependencies is clear and functional. However, for consistency with monorepo practices, you might consider using yarn's workspace command instead:

-(cd infra/ && yarn install)
+yarn workspace @island.is/infra install

This approach maintains consistency with yarn workspace conventions while achieving the same result.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c2d4dfb and 1471753.

📒 Files selected for processing (7)
  • README.md (1 hunks)
  • infra/README.md (3 hunks)
  • infra/package.json (2 hunks)
  • infra/src/cli/cli.ts (2 hunks)
  • libs/testing/e2e/src/lib/config/playwright-config.ts (1 hunks)
  • package.json (1 hunks)
  • scripts/infra-cmds.js (0 hunks)
💤 Files with no reviewable changes (1)
  • scripts/infra-cmds.js
✅ Files skipped from review due to trivial changes (1)
  • package.json
🧰 Additional context used
📓 Path-based instructions (1)
libs/testing/e2e/src/lib/config/playwright-config.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🪛 LanguageTool
infra/README.md

[style] ~1-~1: To make your text as clear as possible to all readers, do not use this foreign term. Possible alternatives are “below” or “further on” (in a document).
Context: # Infra Tool Documentation This CLI tool simpl...

(INFRA)


[style] ~13-~13: To make your text as clear as possible to all readers, do not use this foreign term. Possible alternatives are “below” or “further on” (in a document).
Context: ...ervices. ### Available Commands While infra offers various commands, one of the mos...

(INFRA)

🔇 Additional comments (4)
infra/package.json (1)

10-10: LGTM: Script rename aligns with project conventions

The rename from "cli" to "infra" maintains consistency with the broader changes in the project.

libs/testing/e2e/src/lib/config/playwright-config.ts (1)

Line range hint 31-57: Verify impact of removing project configurations

The removal of the projects array from the configuration simplifies the setup but might impact test organization and filtering capabilities. Please ensure that:

  1. Test filtering requirements are met through alternative means (e.g., test tags or file organization)
  2. The simplified configuration still supports all necessary test scenarios across different NextJS apps
  3. Teams are aware of the new way to organize and run different test suites (smoke, acceptance, etc.)
infra/src/cli/cli.ts (2)

10-11: LGTM! CLI tool renaming is consistent.

The renaming from 'cli' to 'infra' aligns with the documentation updates and maintains consistency across the codebase.


133-134: Verify the necessity of these logging statements.

While the TTY and CWD information can be useful for debugging, consider:

  1. Are these logs necessary for all executions?
  2. Should they be behind a debug flag?
  3. Would structured logging (JSON format) be more appropriate for machine parsing?

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 20, 2024

Datadog Report

Branch report: chore/improve-infra-command-script
Commit report: e8a08c8
Test service: judicial-system-web

✅ 0 Failed, 333 Passed, 0 Skipped, 1m 14.13s Total Time
➡️ Test Sessions change in coverage: 1 no change

@svanaeinars svanaeinars changed the title chore(tests): Update infra script and remove playwright projects chore(tests): Update infra script Nov 20, 2024
Copy link
Member

@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr left a comment

Choose a reason for hiding this comment

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

LGTM

infra/package.json Show resolved Hide resolved
Co-authored-by: Kristofer <kristofer@andes.is>
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 (3)
infra/README.md (3)

Line range hint 1-12: LGTM! Consider adding installation instructions.

The introduction and key features sections are well-structured and clear. Consider adding an "Installation" or "Getting Started" section before the Key Features to help new users get up and running quickly.

🧰 Tools
🪛 LanguageTool

[style] ~1-~1: To make your text as clear as possible to all readers, do not use this foreign term. Possible alternatives are “below” or “further on” (in a document).
Context: # Infra Tool Documentation This CLI tool simpl...

(INFRA)


Line range hint 18-40: Consider adding examples for each command.

While the commands are well-documented, adding simple usage examples for each command would make the documentation more user-friendly. For instance:

yarn infra render-env dev service-name
yarn infra render-urls staging

49-49: Enhance the example with real-world use cases.

Consider expanding the example to show common scenarios:

# Start a single service
yarn infra run-local-env my-service

# Start multiple services with dependencies
yarn infra run-local-env my-service --dependencies=redis,postgres

# Dry run to preview configuration
yarn infra run-local-env my-service --dry
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1471753 and ebc7430.

📒 Files selected for processing (3)
  • infra/README.md (3 hunks)
  • infra/package.json (1 hunks)
  • infra/src/cli/cli.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • infra/package.json
🧰 Additional context used
🪛 LanguageTool
infra/README.md

[style] ~1-~1: To make your text as clear as possible to all readers, do not use this foreign term. Possible alternatives are “below” or “further on” (in a document).
Context: # Infra Tool Documentation This CLI tool simpl...

(INFRA)

🔇 Additional comments (3)
infra/README.md (1)

23-31: Clarify the difference between render-env-vars and render-local-env commands.

These commands appear to have identical descriptions. If they serve different purposes, please clarify the distinction. If they're aliases, consider documenting this or deprecating one in favor of the other.

infra/src/cli/cli.ts (2)

11-11: Script name update looks good

The script name change from 'yarn cli' to 'yarn infra' is consistent with the PR objectives and documentation updates.


Line range hint 108-108: New print option is well integrated

The --print option has been properly added to the run-local-env command with:

  • Correct type definition as boolean
  • Appropriate default value (false)
  • Proper passing to the runLocalServices function

Also applies to: 116-116, 124-124

@svanaeinars svanaeinars added the automerge Merge this PR as soon as all checks pass label Nov 20, 2024
Copy link
Member

@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr left a comment

Choose a reason for hiding this comment

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

LGTM

More minor comments 😄

infra/README.md Outdated Show resolved Hide resolved
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 (1)
infra/README.md (1)

26-26: Consider enhancing the command documentation with examples

To make the documentation more helpful, consider adding:

  1. A concrete example with actual service names
  2. Sample output or expected behavior
  3. Common option combinations and their use cases

Example enhancement:

 yarn infra run-local-env <services> [options]
+
+# Example with specific services
+yarn infra run-local-env auth-api web-app --dependencies redis,postgres
+
+# Common combinations
+yarn infra run-local-env auth-api --dry --json  # Preview configuration in JSON format
+yarn infra run-local-env web-app --no-secrets --proxies  # Development with proxies
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ebc7430 and 31ae52b.

📒 Files selected for processing (1)
  • infra/README.md (3 hunks)
🧰 Additional context used
🪛 LanguageTool
infra/README.md

[style] ~1-~1: To make your text as clear as possible to all readers, do not use this foreign term. Possible alternatives are “below” or “further on” (in a document).
Context: # Infra Tool Documentation This CLI tool simpl...

(INFRA)

🔇 Additional comments (2)
infra/README.md (2)

Line range hint 1-11: Well-structured introduction and key features section!

The introduction clearly explains the tool's purpose, and the key features are well-organized with descriptive bullet points.

🧰 Tools
🪛 LanguageTool

[style] ~1-~1: To make your text as clear as possible to all readers, do not use this foreign term. Possible alternatives are “below” or “further on” (in a document).
Context: # Infra Tool Documentation This CLI tool simpl...

(INFRA)


11-16: LGTM! Changes align with previous review suggestions.

Copy link
Contributor

@snaerseljan snaerseljan left a comment

Choose a reason for hiding this comment

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

Nice work

@kodiakhq kodiakhq bot merged commit 6028a61 into main Nov 21, 2024
51 of 52 checks passed
@kodiakhq kodiakhq bot deleted the chore/improve-infra-command-script branch November 21, 2024 09:54
jonnigs pushed a commit that referenced this pull request Nov 26, 2024
* chore(tests): Update infra script and remove playwright projects

* Minor changes

* Revert Playwright change

* Update infra/package.json

Co-authored-by: Kristofer <kristofer@andes.is>

* Fix docs

---------

Co-authored-by: Kristofer <kristofer@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants