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: updated cores #38420

Closed
wants to merge 13 commits into from
Closed

ci: updated cores #38420

wants to merge 13 commits into from

Conversation

sagar-qa007
Copy link
Contributor

@sagar-qa007 sagar-qa007 commented Dec 31, 2024

Description

Identified multiple crashes in GSheet test cases, primarily caused by high memory usage. To address this, we are improving performance by updating the base image to a higher configuration.

Fixes # https://app.zenhub.com/workspaces/stability-pod-6690c4814e31602e25cab7fd/issues/gh/appsmithorg/appsmith/38421

Automation

/ok-to-test tags="@tag.Datasource"

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12583570995
Commit: 9b0dd98
Cypress dashboard.
Tags: @tag.Datasource
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ServerSide/ApiTests/API_MultiPart_Spec.ts
List of identified flaky tests.
Thu, 02 Jan 2025 14:52:26 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Updated GitHub Actions workflow configuration for CI testing.
    • Modified test runner to use an 8-core Ubuntu environment for improved performance.
    • Enhanced workflow input handling by adding a parameter for specifying pull request numbers.
    • Adjusted Cypress configuration to reduce memory usage by changing the number of tests kept in memory from 5 to 1.
    • Added resource monitoring during Cypress tests for better performance insights.
    • Improved notifications to Slack based on test outcomes with detailed messages and color coding.
    • Updated Cypress action version for enhanced functionality.
    • Increased retry count for Cypress tests in run mode from 0 to 2 for better reliability.
    • Modified test data insertion method to utilize a specific slice of data for improved testing accuracy.

Copy link
Contributor

coderabbitai bot commented Dec 31, 2024

Walkthrough

The pull request modifies the GitHub Actions workflow configuration for Appsmith's CI Test on hosted instances. Key changes include updating the runner to ubuntu-latest-8-cores and introducing a new pr input parameter for workflow dispatch and call scenarios. The workflow retains its core logic for test execution but enhances resource monitoring, result tracking, and notification mechanisms, focusing on improving resource allocation and input handling for CI processes.

Changes

File Change Summary
.github/workflows/ci-test-hosted.yml - Updated runs-on to ubuntu-latest-8-cores
- Added pr input parameter for workflow dispatch and call
- Introduced resource monitoring steps
- Refined test result handling and caching logic
- Enhanced Slack notification conditions
- Updated Cypress action version from v6 to v6.7.8
app/client/cypress_ci_hosted.config.ts - Updated numTestsKeptInMemory from 5 to 1
- Increased runMode retries from 0 to 2
app/client/cypress/support/Pages/GSheetHelper.ts - Adjusted formatting in AddInsertOrUpdateQuery method
app/client/cypress/e2e/GSheet/WidgetBinding_SelectedAccess_Spec.ts - Modified data insertion to Google Sheets, changing from full array to a slice (index 2 to 10)
app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts - Modified data passed to gsheetHelper.AddNewSpreadsheetQuery, changing from full array to a slice (index 2 to 10)
app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts - Modified data passed to gsheetHelper.AddNewSpreadsheetQuery, changing from full array to a slice (index 2 to 10)
app/client/cypress/e2e/GSheet/WidgetBinding_AllAccess_Spec.ts - Modified data passed to gsheetHelper.AddNewSpreadsheetQuery, changing from full array to a slice (index 2 to 10)

Suggested labels

Bug, Task, Google Sheets

Suggested reviewers

  • ApekshaBhosale
  • yatinappsmith
  • NandanAnantharamu

Possibly related PRs

Poem

🤖 CI Workflow, sleek and bright
Cores now eight, tests take flight
Input pr joins the dance
Slack alerts with every glance
Resource logs in the night! 🚀


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 44d9700 and 9b0dd98.

📒 Files selected for processing (3)
  • app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts (1 hunks)
  • app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts (1 hunks)
  • app/client/cypress/e2e/GSheet/WidgetBinding_AllAccess_Spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
app/client/cypress/e2e/GSheet/WidgetBinding_AllAccess_Spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (3)
app/client/cypress/e2e/GSheet/WidgetBinding_AllAccess_Spec.ts (1)

44-44: Verify potential impact of slicing out the first two elements.

You're discarding the first two entries of GSHEET_DATA. Please confirm that the test suite doesn't rely on row indices 0 or 1 (e.g., rowIndex: "0" or rowIndex: "1") in subsequent usages.

Run this shell script to search for references to rowIndex = 0 or 1 in the GSheet tests:

✅ Verification successful

Slicing GSHEET_DATA is safe in this context

The slice operation GSHEET_DATA.slice(2, 10) is safe because:

  • The test file GsheetMisc_Spec.ts uses indices 0 and 1 only for data verification, not for test data manipulation
  • The sliced data (rows 2-9) is used only for widget binding tests
  • Other test files that use indices 0 and 1 (SelectedSheet_Access_Spec.ts, ReadNWrite_Access_Spec.ts) access the data directly through array indexing, not through the sliced subset

The original data structure remains intact for other test cases.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Searching for references to rowIndex=0 or rowIndex=1 in the GSheet test code.
rg 'rowIndex.*[=:\(].*(0|1)' app/client/cypress/e2e/GSheet

Length of output: 669


Script:

#!/bin/bash
# Let's check the content of GSHEET_DATA to understand what data is being sliced
rg -B2 -A2 'GSHEET_DATA\s*=' app/client/cypress/e2e/GSheet

Length of output: 60


Script:

#!/bin/bash
# Let's try to find the GSHEET_DATA constant definition with a broader search
rg -B2 -A2 'GSHEET_DATA' app/client/cypress/e2e/GSheet --type ts

Length of output: 27980


Script:

#!/bin/bash
# Let's check the content of the test data file to understand the structure
cat app/client/cypress/fixtures/test-data-gsheet.ts

Length of output: 10121

app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts (1)

55-55: Confirm test coverage with reduced dataset.

This slicing omits elements at indices 0 and 1. Ensure that all tests depending on the first two dataset rows still behave as intended or are no longer required.

app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts (1)

42-42: Check if slicing excludes required test data.

By omitting the first two elements in GSHEET_DATA, you could inadvertently skip critical rows needed for certain validations. Confirm that no test relies on those omitted elements.


🪧 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 skip-changelog Adding this label to a PR prevents it from being listed in the changelog CI labels Dec 31, 2024
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

🧹 Nitpick comments (1)
.github/workflows/ci-test-hosted.yml (1)

Line range hint 127-134: Consider using a version variable for Chrome installation

Hard-coding the Chrome version might lead to maintenance overhead. Consider using a variable or environment parameter for easier version management.

- wget -q https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_129.0.6668.100-1_amd64.deb
- sudo apt-get install -y ./google-chrome-stable_129.0.6668.100-1_amd64.deb
+ CHROME_VERSION="129.0.6668.100"
+ wget -q "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb"
+ sudo apt-get install -y "./google-chrome-stable_${CHROME_VERSION}-1_amd64.deb"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between de2d5a4 and ce14fb1.

📒 Files selected for processing (1)
  • .github/workflows/ci-test-hosted.yml (1 hunks)
🔇 Additional comments (3)
.github/workflows/ci-test-hosted.yml (3)

Line range hint 11-19: LGTM: Well-structured input parameter addition

The new pr parameter is properly configured with appropriate type validation and default values.


24-24: LGTM: Enhanced runner configuration

The upgrade to 8-cores aligns with the PR objective to address memory-related crashes in Google Sheets test cases.


Line range hint 308-311: Consider obfuscating internal URLs in Slack notifications

The Slack messages contain direct links to the internal Cypress dashboard. Consider using a URL shortener or removing sensitive parts of the URL path for security.

Also applies to: 317-320

@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Dec 31, 2024
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

🧹 Nitpick comments (1)
.github/workflows/ci-test-hosted.yml (1)

Line range hint 308-321: Consider enhancing error reporting with failure categories.

While the current implementation effectively reports test failures, consider categorizing failures (e.g., memory issues, timeouts) to help track the impact of the resource updates.

 - name: Generate slack message
   continue-on-error: true
   if: always()
   id: slack_notification
   run: |
     if [[ "${{ steps.test_status.outputs.run_result }}" == "failedtest" ]]; then
-      echo "slack_message=There are test failures in the run. Cypress Dashboard: <https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}&selectiontype=test&testsstatus=failed&specsstatus=fail|Click here!>" >> $GITHUB_OUTPUT
+      # Extract failure category from test results
+      FAILURE_TYPE=$(jq -r '.stats.failures[] | .category' ~/results/*/results.json | sort | uniq -c | tr '\n' ',' | sed 's/,$//')
+      echo "slack_message=Test failures detected ($FAILURE_TYPE). Cypress Dashboard: <https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}&selectiontype=test&testsstatus=failed&specsstatus=fail|Click here!>" >> $GITHUB_OUTPUT
       echo "slack_color=#FF0000" >> $GITHUB_OUTPUT
       echo "slack_icon=:parachute:" >> $GITHUB_OUTPUT
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d761634 and 40a52cb.

📒 Files selected for processing (1)
  • .github/workflows/ci-test-hosted.yml (2 hunks)
🔇 Additional comments (2)
.github/workflows/ci-test-hosted.yml (2)

Line range hint 132-140: LGTM: Chrome installation properly configured.

The explicit Chrome version specification ensures consistent test environment across runs.


254-254: LGTM: Headless mode optimizes resource usage.

Running Cypress tests in headless mode reduces memory consumption, which aligns with the optimization goals.

@@ -21,7 +21,7 @@ on:

jobs:
ci-test:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-8-cores
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Warning: ubuntu-latest-8-cores is not a standard GitHub-hosted runner

The runner configuration ubuntu-latest-8-cores appears to be a custom runner label that's used in several workflows:

  • ci-test-hosted.yml
  • server-build.yml
  • client-lint.yml
  • client-unit-tests.yml

GitHub's standard hosted runners are ubuntu-latest, windows-latest, and macos-latest. Unless your organization has set up self-hosted runners with this label, this change will cause workflow failures.

🔗 Analysis chain

LGTM: Runner upgrade addresses memory issues.

The upgrade to 8 cores aligns with the goal of resolving Google Sheets test crashes due to high memory usage.

Let's verify the runner's availability:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify if the runner is available in the GitHub Actions environment
gh api \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/$GITHUB_REPOSITORY/actions/runners | jq '.runners[] | select(.name | contains("ubuntu-latest-8-cores"))'

Length of output: 264


Script:

#!/bin/bash
# Let's check the GitHub Actions workflow files for runner configurations
rg -U "runs-on:.*ubuntu.*" .github/workflows/

Length of output: 4235


Script:

#!/bin/bash
# Let's also check if there are any other workflow files using similar runner configurations
fd -e yml -e yaml . .github/workflows/ --exec grep -l "runs-on.*8-cores" {}

Length of output: 225


Script:

#!/bin/bash
# Check GitHub Actions documentation references or comments about runner specs
rg -i "runner|cores|compute" .github/workflows/

Length of output: 1924

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 (1)
.github/workflows/ci-test-hosted.yml (1)

185-190: Optimize resource monitoring implementation

The current implementation could be improved for better efficiency:

  1. Consider using vmstat or pidstat instead of top for lower overhead
  2. Increase the monitoring interval to reduce system load
-          nohup bash -c 'while true; do echo "==== CPU & RAM Usage ===="; top -b -n 1 | head -n 10; echo "==== Disk Usage ===="; df -h; sleep 10; done' > resource_usage.log &
+          nohup bash -c 'while true; do echo "==== CPU & RAM Usage ===="; vmstat 1 1; echo "==== Process Stats ===="; pidstat 1 1; echo "==== Disk Usage ===="; df -h; sleep 30; done' > resource_usage.log &
🧰 Tools
🪛 yamllint (1.35.1)

[error] 189-189: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1c03b30 and 26a25a8.

📒 Files selected for processing (1)
  • .github/workflows/ci-test-hosted.yml (3 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/ci-test-hosted.yml

[error] 189-189: trailing spaces

(trailing-spaces)


[error] 265-265: trailing spaces

(trailing-spaces)


[error] 270-270: trailing spaces

(trailing-spaces)

🪛 actionlint (1.7.4)
.github/workflows/ci-test-hosted.yml

262-262: shellcheck reported issue in this script: SC2046:warning:1:6: Quote this to prevent word splitting

(shellcheck)


267-267: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

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

24-24: Verify runner availability before merging

The ubuntu-latest-8-cores runner appears to be a custom configuration. Ensure this runner is properly configured in your GitHub organization's self-hosted runners to prevent workflow failures.

Comment on lines 266 to 271
- name: Upload Resource Usage Log
uses: actions/upload-artifact@v3
with:
name: resource-usage-log
path: resource_usage.log

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update upload-artifact action to v4

For consistency with other upload-artifact actions in this workflow, update to v4.

-        uses: actions/upload-artifact@v3
+        uses: actions/upload-artifact@v4
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Upload Resource Usage Log
uses: actions/upload-artifact@v3
with:
name: resource-usage-log
path: resource_usage.log
- name: Upload Resource Usage Log
uses: actions/upload-artifact@v4
with:
name: resource-usage-log
path: resource_usage.log
🧰 Tools
🪛 actionlint (1.7.4)

267-267: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)

[error] 270-270: trailing spaces

(trailing-spaces)

Comment on lines 261 to 264
- name: Stop Monitoring
run: |
kill $(cat resource_monitor_pid) || true
echo "Resource monitoring stopped."
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix shell script quoting in cleanup command

The kill command should use proper quoting to handle PIDs with spaces safely.

-          kill $(cat resource_monitor_pid) || true
+          kill "$(cat resource_monitor_pid)" || true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Stop Monitoring
run: |
kill $(cat resource_monitor_pid) || true
echo "Resource monitoring stopped."
- name: Stop Monitoring
run: |
kill "$(cat resource_monitor_pid)" || true
echo "Resource monitoring stopped."
🧰 Tools
🪛 actionlint (1.7.4)

262-262: shellcheck reported issue in this script: SC2046:warning:1:6: Quote this to prevent word splitting

(shellcheck)

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

🧹 Nitpick comments (1)
.github/workflows/ci-test-hosted.yml (1)

185-190: Enhance resource monitoring implementation

Consider structuring the output in JSON format for better parsing and analysis.

-          nohup bash -c 'while true; do echo "==== CPU & RAM Usage ===="; top -b -n 1 | head -n 10; echo "==== Disk Usage ===="; df -h; sleep 10; done' > resource_usage.log &
+          nohup bash -c '
+            while true; do
+              echo "{\"timestamp\":\"$(date -Iseconds)\",\"cpu_ram\":\"$(top -bn1 | head -n 10 | jq -Rsc)\",\"disk\":\"$(df -h | jq -Rsc)\"}"
+              sleep 10
+            done
+          ' > resource_usage.log 2>&1 &
🧰 Tools
🪛 yamllint (1.35.1)

[error] 189-189: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 26a25a8 and d0d46ea.

📒 Files selected for processing (1)
  • .github/workflows/ci-test-hosted.yml (3 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/ci-test-hosted.yml

[error] 189-189: trailing spaces

(trailing-spaces)


[error] 266-266: trailing spaces

(trailing-spaces)


[error] 268-268: trailing spaces

(trailing-spaces)


[error] 272-272: trailing spaces

(trailing-spaces)

🪛 actionlint (1.7.4)
.github/workflows/ci-test-hosted.yml

263-263: shellcheck reported issue in this script: SC2046:warning:1:6: Quote this to prevent word splitting

(shellcheck)


269-269: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (3)
.github/workflows/ci-test-hosted.yml (3)

261-264: ⚠️ Potential issue

Fix shell script quoting for safety

The kill command should use proper quoting to handle PIDs safely.

-          kill $(cat resource_monitor_pid) || true
+          kill "$(cat resource_monitor_pid)" || true

Likely invalid or redundant comment.

🧰 Tools
🪛 actionlint (1.7.4)

263-263: shellcheck reported issue in this script: SC2046:warning:1:6: Quote this to prevent word splitting

(shellcheck)


267-273: 🛠️ Refactor suggestion

Update upload-artifact action to v4

For consistency with other upload-artifact actions in this workflow, update to v4.

-        uses: actions/upload-artifact@v3
+        uses: actions/upload-artifact@v4

Likely invalid or redundant comment.

🧰 Tools
🪛 actionlint (1.7.4)

269-269: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)

[error] 268-268: trailing spaces

(trailing-spaces)


[error] 272-272: trailing spaces

(trailing-spaces)


24-24: Verify custom runner configuration

The ubuntu-latest-8-cores appears to be a custom runner. Ensure it's properly configured in your GitHub organization's self-hosted runners.

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

♻️ Duplicate comments (1)
.github/workflows/ci-test-hosted.yml (1)

262-274: ⚠️ Potential issue

Fix shell script quoting and update upload-artifact action.

  1. The kill command needs proper quoting
  2. The upload-artifact action should be updated to v4

Apply this diff to fix the issues:

-          kill $(cat resource_monitor_pid) || true
+          kill "$(cat resource_monitor_pid)" || true

-        uses: actions/upload-artifact@v3
+        uses: actions/upload-artifact@v4
🧰 Tools
🪛 actionlint (1.7.4)

264-264: shellcheck reported issue in this script: SC2046:warning:1:6: Quote this to prevent word splitting

(shellcheck)


270-270: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)

[error] 267-267: trailing spaces

(trailing-spaces)


[error] 269-269: trailing spaces

(trailing-spaces)


[error] 273-273: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d0d46ea and 5439d4d.

📒 Files selected for processing (1)
  • .github/workflows/ci-test-hosted.yml (3 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/ci-test-hosted.yml

[error] 189-189: trailing spaces

(trailing-spaces)


[error] 267-267: trailing spaces

(trailing-spaces)


[error] 269-269: trailing spaces

(trailing-spaces)


[error] 273-273: trailing spaces

(trailing-spaces)

🪛 actionlint (1.7.4)
.github/workflows/ci-test-hosted.yml

264-264: shellcheck reported issue in this script: SC2046:warning:1:6: Quote this to prevent word splitting

(shellcheck)


270-270: the runner of "actions/upload-artifact@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (2)
.github/workflows/ci-test-hosted.yml (2)

24-24: Verify the availability of the custom runner.

The runner ubuntu-latest-8-cores appears to be a custom configuration. While this aligns with the PR objective to address memory issues, ensure it's properly configured in your GitHub organization.


Line range hint 192-254: Enable Cypress debug mode with caution.

The addition of DEBUG: 'cypress:*' will generate verbose logs. While this helps with debugging, it might impact performance and generate large log files.

Run this script to check the impact on log size:

✅ Verification successful

Let me analyze the Cypress configuration and workflow files to better understand the debug logging setup. Since the GitHub API access is not available, we'll look at the local configuration to verify the debug mode settings and their potential impact.


Debug mode is already configured appropriately in the CI pipeline

The DEBUG: 'cypress:*' setting is already being used selectively in the CI setup script (app/client/cypress/setup-test-ci.sh) and the project uses proper reporters (cypress-mochawesome-reporter, cypress-multi-reporters) to handle logs efficiently. The debug configuration in the workflow file follows Cypress's recommended practices for CI environments.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check recent workflow runs for log size comparison
gh api -X GET /repos/$GITHUB_REPOSITORY/actions/runs \
  --jq '.workflow_runs[] | select(.name=="Appsmith CI Test Workflow For Hosted Instance") | {id: .id, status: .status, conclusion: .conclusion}'

Length of output: 293


Script:

#!/bin/bash
# Let's check the Cypress configuration and test files to understand the debug logging impact
fd -e json -e js cypress.config
rg -l "DEBUG" --type yaml .github/workflows/

Length of output: 208


Script:

#!/bin/bash
# Check if there are any existing debug configurations or patterns
rg "DEBUG.*cypress" -A 2 -B 2

Length of output: 492


Script:

#!/bin/bash
# Look for any Cypress reporter configurations that might be affected
rg "reporter" --type json
rg "reporter" -g "cypress.config*"

Length of output: 297

🧰 Tools
🪛 yamllint (1.35.1)

[error] 189-189: trailing spaces

(trailing-spaces)

Comment on lines +185 to +190
- name: Monitor Resource Usage
run: |
echo "Monitoring system metrics during Cypress tests..."
nohup bash -c 'while true; do echo "==== CPU & RAM Usage ===="; top -b -n 1 | head -n 10; echo "==== Disk Usage ===="; df -h; sleep 10; done' > resource_usage.log &
echo $! > resource_monitor_pid

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Resource monitoring implementation needs improvement.

The current implementation has several issues:

  1. The monitoring interval (10s) might be too frequent and could impact test performance
  2. The output format makes it difficult to parse and analyze the data
  3. There's no error handling for the background process

Apply this diff to improve the implementation:

-      - name: Monitor Resource Usage
-        run: |
-          echo "Monitoring system metrics during Cypress tests..."
-          nohup bash -c 'while true; do echo "==== CPU & RAM Usage ===="; top -b -n 1 | head -n 10; echo "==== Disk Usage ===="; df -h; sleep 10; done' > resource_usage.log &
-          echo $! > resource_monitor_pid    
+      - name: Monitor Resource Usage
+        run: |
+          echo "Monitoring system metrics during Cypress tests..."
+          nohup bash -c '
+            while true; do
+              timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
+              echo "{"
+              echo "  \"timestamp\": \"$timestamp\","
+              echo "  \"cpu_ram\": $(top -bn1 | head -n 10 | jq -R -s .),"
+              echo "  \"disk\": $(df -h | jq -R -s .)"
+              echo "},"
+            sleep 30
+            done
+          ' > resource_usage.log 2>&1 &
+          echo $! > resource_monitor_pid
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Monitor Resource Usage
run: |
echo "Monitoring system metrics during Cypress tests..."
nohup bash -c 'while true; do echo "==== CPU & RAM Usage ===="; top -b -n 1 | head -n 10; echo "==== Disk Usage ===="; df -h; sleep 10; done' > resource_usage.log &
echo $! > resource_monitor_pid
- name: Monitor Resource Usage
run: |
echo "Monitoring system metrics during Cypress tests..."
nohup bash -c '
while true; do
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "{"
echo " \"timestamp\": \"$timestamp\","
echo " \"cpu_ram\": $(top -bn1 | head -n 10 | jq -R -s .),"
echo " \"disk\": $(df -h | jq -R -s .)"
echo "},"
sleep 30
done
' > resource_usage.log 2>&1 &
echo $! > resource_monitor_pid
🧰 Tools
🪛 yamllint (1.35.1)

[error] 189-189: trailing spaces

(trailing-spaces)

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)
app/client/cypress/support/Pages/GSheetHelper.ts (1)

Line range hint 88-89: Avoid using agHelper.Sleep calls.
This code calls this.agHelper.Sleep(500), which is strongly discouraged according to the Cypress guidelines for stable e2e tests. It is preferable to ensure the required element or resource is ready without introducing arbitrary wait times.

- this.agHelper.Sleep(500);
+ // Wait for an explicit element to appear or rely on assertion-based checks
🧹 Nitpick comments (1)
app/client/cypress/support/Pages/GSheetHelper.ts (1)

93-98: Clean up commented-out code.
The old EnterValue approach is now commented out. If you no longer intend to use it, removing these lines will help keep the code concise and maintainable.

- // this.agHelper.EnterValue(rowData, {
- //   propFieldName: "",
- //   directInput: false,
- //   inputFieldName: inputField,
- // });
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8b3fe32 and 4b858d8.

📒 Files selected for processing (1)
  • app/client/cypress/support/Pages/GSheetHelper.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/support/Pages/GSheetHelper.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (1)
app/client/cypress/support/Pages/GSheetHelper.ts (1)

99-100: Confirm usage of data- attributes and stable locators.*
Replacing EnterValue with Paste is valid, but confirm that this.locator._inputFieldByName(inputField) leverages data-* attributes (as recommended by the coding guidelines) for robust and stable selector usage in Cypress.

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

🧹 Nitpick comments (1)
app/client/cypress/e2e/GSheet/WidgetBinding_SelectedAccess_Spec.ts (1)

Line range hint 75-75: Avoid usage of agHelper.Sleep(500)
Per the Cypress coding guidelines, using sleep calls is discouraged. Consider alternative solutions such as waiting on specific events or network calls, or using built-in Cypress commands with proper timeouts.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4b858d8 and 44d9700.

📒 Files selected for processing (2)
  • app/client/cypress/e2e/GSheet/WidgetBinding_SelectedAccess_Spec.ts (1 hunks)
  • app/client/cypress/support/Pages/GSheetHelper.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/support/Pages/GSheetHelper.ts
🧰 Additional context used
📓 Path-based instructions (1)
app/client/cypress/e2e/GSheet/WidgetBinding_SelectedAccess_Spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
🔇 Additional comments (1)
app/client/cypress/e2e/GSheet/WidgetBinding_SelectedAccess_Spec.ts (1)

44-44: Use caution with partial data insertion
Reducing the inserted rows from indexes 2 to 10 might improve performance or test reliability, but ensure that downstream functionalities expecting the full dataset still work properly.

@sagar-qa007 sagar-qa007 closed this Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant