Skip to content

Conversation

@pandeymangg
Copy link
Contributor

@pandeymangg pandeymangg commented Jul 2, 2025

Fixes #9
Adds github actions for building the project and running unit tests

Summary by CodeRabbit

  • Chores

    • Introduced automated workflows for building, testing, and code quality analysis.
    • Added new scripts to simplify build, test, and coverage commands.
    • Enhanced task definitions to improve build and test automation.
    • Improved test coverage reporting configuration.
    • Added SonarQube setup for continuous code quality monitoring.
  • Refactor

    • Renamed test scripts for improved clarity and consistency.

@pandeymangg pandeymangg requested a review from mattinannt July 2, 2025 09:56
@coderabbitai
Copy link

coderabbitai bot commented Jul 2, 2025

"""

Walkthrough

This change introduces GitHub Actions workflows for building, testing, and SonarQube scanning of the React Native package and its playground. It updates package.json, turbo.json, and Vite configuration files to support new build and test scripts, coverage reporting, and task orchestration using Turbo. A SonarQube configuration file is also added.

Changes

File(s) Change Summary
.github/workflows/build.yml, .github/workflows/test.yml, .github/workflows/sonarqube.yml Added GitHub Actions workflows for building, testing, and SonarQube scanning, triggered on push, PR, and manual events.
apps/playground/package.json Added a build script using expo export.
package.json Added test and test:coverage scripts using Turbo.
packages/react-native/package.json Renamed test coverage script from coverage to test:coverage.
packages/react-native/vite.config.ts Broadened coverage include pattern, excluded type files, reformatted plugins array.
turbo.json Added build and test task definitions for Turbo, including dependencies and output specifications.
sonar-project.properties Added SonarQube configuration file for project analysis and coverage exclusions.

Assessment against linked issues

Objective Addressed Explanation
Add GitHub Actions for building the project (sdk and playground) (#9)
Add GitHub Actions for running unit tests and coverage reports (#9)
Add SonarQube scanning GitHub Action and config (#9)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Broadened coverage include/exclude patterns in vite.config.ts (packages/react-native/vite.config.ts) This change refines coverage reporting configuration and supports the objectives related to test coverage and SonarQube scanning. It is not out of scope.
Added/modified build and test scripts in package.json and turbo.json These changes support the automation objectives and are in scope.

No clear out-of-scope functional code changes were found.
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f6c2956 and ee1d311.

📒 Files selected for processing (3)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/sonarqube.yml (1 hunks)
  • .github/workflows/test.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/build.yml
  • .github/workflows/test.yml
  • .github/workflows/sonarqube.yml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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

@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)
package.json (1)

9-11: Test scripts look good, consider cache implications.

The addition of test orchestration scripts at the root level is excellent for monorepo management. The --no-cache flag ensures fresh test runs which is appropriate for CI environments.

Consider whether --no-cache is necessary for local development, as it might slow down test execution during development. You might want to create separate scripts for CI vs local development if performance becomes an issue.

.github/workflows/build.yml (1)

1-10: Consider paths-filter to skip builds for non-code changes

The workflow is triggered on every change to main and every PR. For doc-only or CI-only edits we still pay the full build cost.
Add a paths (or paths-ignore) section under push and pull_request to run the build only when relevant files change.

turbo.json (2)

20-23: Missing outputs means no remote caching for the React-Native build

@formbricks/react-native:build sets cache: false, so every CI run recompiles the package even if nothing changed.
If the generated artefacts are deterministic (e.g. dist/**), expose them and turn caching back on:

-    "@formbricks/react-native:build": {
-      "dependsOn": ["^build"],
-      "cache": false
-    },
+    "@formbricks/react-native:build": {
+      "dependsOn": ["^build"],
+      "outputs": ["packages/react-native/dist/**"],
+      "cache": true
+    },

This halves CI time for no-op PRs.


29-34: Prefer cache: false over empty outputs for test tasks

Turbo treats an empty outputs array as “cache with no outputs”, which is easy to mis-read. Use the explicit switch instead:

-    "test": {
-      "outputs": []
-    },
-    "test:coverage": {
-      "outputs": []
-    },
+    "test": {
+      "cache": false
+    },
+    "test:coverage": {
+      "cache": false
+    },

This documents intent and prevents accidental remote-cache pollution.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b5cc02 and d21fcab.

📒 Files selected for processing (7)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/test.yml (1 hunks)
  • apps/playground/package.json (1 hunks)
  • package.json (1 hunks)
  • packages/react-native/package.json (1 hunks)
  • packages/react-native/vite.config.ts (1 hunks)
  • turbo.json (1 hunks)
🔇 Additional comments (7)
apps/playground/package.json (1)

9-10: LGTM! Build script addition looks good.

The addition of a trailing comma and the new build script using expo export follows standard practices for Expo applications. This integrates well with the CI/CD workflow setup.

packages/react-native/package.json (1)

41-41: Good standardization of script naming.

Renaming from "coverage" to "test:coverage" improves consistency and makes the script purpose clearer. This aligns well with the monorepo's testing strategy.

packages/react-native/vite.config.ts (2)

34-36: Good formatting improvement.

The multi-line array formatting improves readability and makes future additions easier.


42-43: Excellent expansion of test coverage scope.

Broadening the coverage from src/lib/**/*.ts to src/**/*.ts while excluding src/types/**/*.ts is a smart improvement. This will provide better visibility into test coverage across the codebase while appropriately excluding type definitions that don't contain executable code.

.github/workflows/test.yml (2)

1-11: Well-structured workflow with appropriate triggers.

The workflow name is descriptive and the trigger events (workflow_dispatch, push to main, pull requests, merge_group) are appropriate for a comprehensive CI test strategy.


24-31: Good use of pinned action versions and standard workflow steps.

The pnpm installation and dependency setup steps follow best practices. Using commit hashes for action versions provides good security, and the workflow steps are logically structured.

.github/workflows/build.yml (1)

19-23: Pin the Node version explicitly

actions/setup-node accepts a semver. "20.x" will move to 21 the moment Node 21 becomes “latest-LTS”. If the React-Native tool-chain proves sensitive, pin to the current LTS (20.14.0) or set node-version-file: .nvmrc to source the version from the repo.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 3, 2025

@pandeymangg pandeymangg requested a review from Dhruwang July 3, 2025 05:20
Copy link
Member

@mattinannt mattinannt left a comment

Choose a reason for hiding this comment

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

thank you for adding the Github Actions :-) Looks good! 👍

@mattinannt mattinannt added this pull request to the merge queue Jul 3, 2025
Merged via the queue into main with commit 094fd9f Jul 3, 2025
8 checks passed
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.

Add github actions for building, testing and scanning code on sonarqube

2 participants