Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 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
21 changes: 20 additions & 1 deletion .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
Copy Markdown
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,6 +182,12 @@ 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
Copy Markdown
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
env:
Expand Down Expand Up @@ -252,6 +258,19 @@ jobs:
working-directory: app/client
env: "NODE_ENV=development"

- name: Stop Monitoring
if: always()
run: |
kill $(cat resource_monitor_pid) || true
echo "Resource monitoring stopped."
Comment on lines +261 to +266

Copy link
Copy Markdown
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)


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

Comment on lines +266 to +274

Copy link
Copy Markdown
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)

- name: Rename reports
if: failure()
run: |
Expand Down
2 changes: 1 addition & 1 deletion 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 Down