ci: Update version and checking failure (#39138)

## Description
Problem: We see cypress retry happening for the only it block. Due to
this we see failed cases always as some cases are dependent.
Solution: Updated the workflow with library to retry only failed specs.


Fixes #
https://app.zenhub.com/workspaces/qa-63316faf86bb2e170ed2e46b/issues/gh/appsmithorg/appsmith/39211

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13285964571>
> Commit: 9c4fb375775839503a2800eb84bc87a6abc61ac9
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13285964571&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Wed, 12 Feb 2025 14:31:18 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
- Updated a key dependency to incorporate backward-compatible
improvements.

- **Tests**
- Enhanced the automated testing process with improved error handling
and the ability to conditionally execute tests.
- Introduced configurable options for test repetition and snapshot
updates, ensuring more reliable reporting and feedback.
- Improved the logic for commenting on pull request statuses based on CI
test results.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Sagar Khalasi 2025-02-13 08:22:01 +05:30 committed by GitHub
parent be3809ff7e
commit cdd8034674
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 40 additions and 41 deletions

View File

@ -314,7 +314,7 @@ jobs:
fi
- name: Add a comment on the PR with new CI failures
if: env.ci_test_failed != 'true' && needs.file-check.outputs.pr != '0'
if: env.ci_test_failed == 'true' && needs.file-check.outputs.pr != '0'
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{fromJson(needs.file-check.outputs.pr)}}
@ -328,7 +328,7 @@ jobs:
```
- name: Add a comment on the PR when ci-test-limited is successful
if: env.ci_test_failed == 'true' && needs.file-check.outputs.pr != '0'
if: env.ci_test_failed != 'true' && needs.file-check.outputs.pr != '0'
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{fromJson(needs.file-check.outputs.pr)}}
@ -473,7 +473,7 @@ jobs:
fi
- name: Add a comment on the PR with new CI failures
if: env.ci_test_failed != 'true' && needs.file-check.outputs.pr != '0'
if: env.ci_test_failed == 'true' && needs.file-check.outputs.pr != '0'
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{fromJson(needs.file-check.outputs.pr)}}
@ -487,7 +487,7 @@ jobs:
```
- name: Add a comment on the PR when ci-test-limited-existing-docker-image is success
if: env.ci_test_failed == 'true' && needs.file-check.outputs.pr != '0'
if: env.ci_test_failed != 'true' && needs.file-check.outputs.pr != '0'
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{fromJson(needs.file-check.outputs.pr)}}

View File

@ -302,7 +302,6 @@ jobs:
fi
- name: Run the cypress test
uses: cypress-io/github-action@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
@ -371,13 +370,21 @@ jobs:
CYPRESS_SNOWFLAKE_ACCOUNT_NAME: ${{ secrets.SNOWFLAKE_ACCOUNT_NAME }}
CYPRESS_SNOWFLAKE_USERNAME: ${{ secrets.SNOWFLAKE_USERNAME }}
CYPRESS_SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
with:
browser: ${{ env.BROWSER_PATH }}
install: false
config-file: cypress_ci_custom.config.ts
spec: ${{ inputs.spec }}
working-directory: app/client
env: "NODE_ENV=development"
NODE_ENV: development
run: |
cd app/client
ls -la
if [[ -n "${{ inputs.spec }}" ]]; then
npx cypress-repeat-pro run -n 3 --rerun-failed-only \
--spec "${{ inputs.spec }}" \
--config-file "cypress_ci_custom.config.ts" \
--browser "${{ env.BROWSER_PATH }}"
else
npx cypress-repeat-pro run -n 3 --rerun-failed-only \
--config-file "cypress_ci_custom.config.ts" \
--browser "${{ env.BROWSER_PATH }}"
fi
cat cy-repeat-summary.txt
- name: Trim number of cypress log files
if: failure()

View File

@ -434,26 +434,29 @@ jobs:
CYPRESS_updateSnapshots=true npx cypress-repeat-pro run -n "${{ inputs.run_count }}" --force \
--spec "${{ inputs.specs_to_run }}" \
--config-file "cypress_ci_custom.config.ts" \
--browser "${{ env.BROWSER_PATH }}"
--browser "${{ env.BROWSER_PATH }}" || echo "Cypress tests failed, proceeding with summary check..."
else
echo "Running Cypress tests without snapshot updates..."
npx cypress-repeat-pro run -n "${{ inputs.run_count }}" --force \
--spec "${{ env.specs_to_run }}" \
--config-file "cypress_ci_custom.config.ts" \
--browser "${{ env.BROWSER_PATH }}"
--browser "${{ env.BROWSER_PATH }}" || echo "Cypress tests failed, proceeding with summary check..."
fi
cat cy-repeat-summary.txt
# Define the path for the failure flag file
FAILURE_FLAG_FILE="ci_test_status.txt"
# Check for test results and store the status in the file
if ! grep -q "Total Failed: 0" cy-repeat-summary.txt; then
echo "ci_test_failed=true" > "$FAILURE_FLAG_FILE"
echo "ci_test_failed=true" > "$FAILURE_FLAG_FILE"
else
echo "ci_test_failed=false" > "$FAILURE_FLAG_FILE"
echo "ci_test_failed=false" > "$FAILURE_FLAG_FILE"
fi
cat "$FAILURE_FLAG_FILE"
cat "$FAILURE_FLAG_FILE"
- name: Trim number of cypress log files
if: failure()
run: |

View File

@ -124,7 +124,7 @@
"craco-alias": "^2.1.1",
"craco-babel-loader": "^1.0.4",
"cypress-log-to-output": "^1.1.2",
"cypress-repeat-pro": "^1.0.1",
"cypress-repeat-pro": "^1.0.9",
"d3-geo": "^3.1.0",
"date-fns": "^4.1.0",
"dayjs": "^1.10.6",
@ -388,4 +388,4 @@
"@types/react": "^17.0.2",
"postcss": "8.4.31"
}
}
}

View File

@ -13272,7 +13272,7 @@ __metadata:
cypress-network-idle: ^1.14.2
cypress-plugin-tab: ^1.0.5
cypress-real-events: ^1.8.1
cypress-repeat-pro: ^1.0.1
cypress-repeat-pro: ^1.0.9
cypress-tags: ^1.1.2
cypress-terminal-report: ^5.3.6
cypress-wait-until: ^1.7.2
@ -16571,19 +16571,20 @@ __metadata:
languageName: node
linkType: hard
"cypress-repeat-pro@npm:^1.0.1":
version: 1.0.1
resolution: "cypress-repeat-pro@npm:1.0.1"
"cypress-repeat-pro@npm:^1.0.9":
version: 1.0.9
resolution: "cypress-repeat-pro@npm:1.0.9"
dependencies:
"@cypress/grep": ^4.0.1
arg: 5.0.2
bluebird: 3.7.2
debug: 4.3.5
debug: ^4.4.0
dotenv: 8.2.0
peerDependencies:
cypress: ">=5.3.0"
bin:
cypress-repeat-pro: index.js
checksum: e62a21479b62a5d5624ce21bdd8204afd754082d851d5fc712ad76e39ca2cfe6d446c2a1434025be77fa9d76fa257609285879e9841efecc26be4d25454fb732
checksum: 34d5e7a450c73c23085a30424ba748973cb697a9bdb906772864a3f42f6982bd301eb4722d62e2b02b340dfebfd7d9b5369783d077e4b82825001e64e795143e
languageName: node
linkType: hard
@ -16790,15 +16791,15 @@ __metadata:
languageName: node
linkType: hard
"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4":
version: 4.3.7
resolution: "debug@npm:4.3.7"
"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4, debug@npm:^4.4.0":
version: 4.4.0
resolution: "debug@npm:4.4.0"
dependencies:
ms: ^2.1.3
peerDependenciesMeta:
supports-color:
optional: true
checksum: 822d74e209cd910ef0802d261b150314bbcf36c582ccdbb3e70f0894823c17e49a50d3e66d96b633524263975ca16b6a833f3e3b7e030c157169a5fabac63160
checksum: fb42df878dd0e22816fc56e1fdca9da73caa85212fbe40c868b1295a6878f9101ae684f4eeef516c13acfc700f5ea07f1136954f43d4cd2d477a811144136479
languageName: node
linkType: hard
@ -16814,18 +16815,6 @@ __metadata:
languageName: node
linkType: hard
"debug@npm:4.3.5":
version: 4.3.5
resolution: "debug@npm:4.3.5"
dependencies:
ms: 2.1.2
peerDependenciesMeta:
supports-color:
optional: true
checksum: 7c002b51e256257f936dda09eb37167df952758c57badf6bf44bdc40b89a4bcb8e5a0a2e4c7b53f97c69e2970dd5272d33a757378a12c8f8e64ea7bf99e8e86e
languageName: node
linkType: hard
"debug@npm:^3.1.0, debug@npm:^3.2.7":
version: 3.2.7
resolution: "debug@npm:3.2.7"