Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .github/workflows/ci-test-hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

if: |
github.event.pull_request.head.repo.full_name == github.repository ||
github.event_name == 'push' ||
Expand Down Expand Up @@ -182,8 +182,14 @@ jobs:
echo "COMMIT_INFO_MESSAGE=Manual workflow run for Hosted tests" >> $GITHUB_ENV
fi

- 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

Comment on lines +185 to +190
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)

- name: Run the cypress test
uses: cypress-io/github-action@v6
uses: cypress-io/github-action@v6.7.8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
Expand Down Expand Up @@ -245,13 +251,27 @@ jobs:
CYPRESS_S3_ACCESS: ${{ secrets.CYPRESS_S3_ACCESS }}
CYPRESS_S3_SECRET: ${{ secrets.CYPRESS_S3_SECRET }}
CYPRESS_STATIC_ALLOCATION: true
DEBUG: 'cypress:*'
with:
browser: ${{ env.BROWSER_PATH }}
install: false
config-file: cypress_ci_hosted.config.ts
working-directory: app/client
env: "NODE_ENV=development"

- name: Stop Monitoring
if: always()
run: |
kill $(cat resource_monitor_pid) || true
echo "Resource monitoring stopped."

- name: Upload Resource Usage Log
if: always()
uses: actions/upload-artifact@v3
with:
name: resource-usage-log
path: resource_usage.log

- name: Rename reports
if: failure()
run: |
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe.skip(
gsheetHelper.AddNewSpreadsheetQuery(
dataSourceName,
spreadSheetName,
JSON.stringify(GSHEET_DATA),
JSON.stringify(GSHEET_DATA.slice(2, 10)),
);
cy.get("@postExecute", {
timeout: Cypress.config("pageLoadTimeout"),
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe.skip(
gsheetHelper.AddNewSpreadsheetQuery(
dataSourceName.allAccess,
spreadSheetName,
JSON.stringify(GSHEET_DATA),
JSON.stringify(GSHEET_DATA.slice(2, 10)),
);
cy.get("@postExecute").then((interception: any) => {
expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe.skip(
gsheetHelper.AddNewSpreadsheetQuery(
dataSourceName,
spreadSheetName,
JSON.stringify(GSHEET_DATA),
JSON.stringify(GSHEET_DATA.slice(2, 10)),
);
cy.get("@postExecute").then((interception: any) => {
expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe(
"Insert Many",
dataSourceName,
spreadSheetName,
JSON.stringify(GSHEET_DATA),
JSON.stringify(GSHEET_DATA.slice(2, 10)),
);
cy.get("@postExecute").then((interception: any) => {
expect(interception.response.body.data.body.message).to.deep.equal(
Expand Down
4 changes: 2 additions & 2 deletions app/client/cypress/support/Pages/GSheetHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ export class GsheetHelper {
operation == "Update One"
? "Update row object"
: "Update row object(s)";
}

}
this.agHelper.EnterValue(rowData, {
propFieldName: "",
directInput: false,
inputFieldName: inputField,
});

if (executeQuery) this.dataSources.RunQuery();
}

Expand Down
4 changes: 2 additions & 2 deletions app/client/cypress_ci_hosted.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default defineConfig({
pageLoadTimeout: 60000,
videoCompression: false,
video: true,
numTestsKeptInMemory: 5,
numTestsKeptInMemory: 1,
experimentalMemoryManagement: true,
reporter: "cypress-mochawesome-reporter",
reporterOptions: {
Expand All @@ -26,7 +26,7 @@ export default defineConfig({
viewportWidth: 1400,
scrollBehavior: "center",
retries: {
runMode: 0,
runMode: 2,
openMode: 0,
},
e2e: {
Expand Down
Loading