Skip to content

Commit beb94a3

Browse files
committed
chore(cypress): optimize CI configuration and reduce retries for flaky tests
1 parent c06350c commit beb94a3

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

.github/workflows/nodejs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
if: ${{ needs.changes.outputs.cms == 'true' }}
6161
runs-on: ubuntu-latest
6262
strategy:
63-
fail-fast: true
63+
fail-fast: false # Let Cypress Cloud auto-cancellation handle failures
6464
matrix:
6565
machine: [1, 2, 3, 4]
6666
steps:
@@ -99,6 +99,8 @@ jobs:
9999
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
100100
NODE_OPTIONS: --max-old-space-size=4096
101101
TZ: Europe/Amsterdam
102+
GITHUB_EVENT_NAME: ${{ github.event_name }}
103+
GITHUB_BASE_REF: ${{ github.base_ref }}
102104
- uses: actions/upload-artifact@v4
103105
if: failure()
104106
with:

cypress.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { defineConfig } from 'cypress';
33
export default defineConfig({
44
projectId: '1c35bs',
55
retries: {
6-
runMode: 4,
6+
runMode: 2, // Reduced from 4 - Cypress Cloud helps identify flaky tests
77
openMode: 0,
88
},
99
e2e: {

cypress/run.mjs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,32 @@ async function runCypress() {
2828
} else {
2929
const ciBuildId =
3030
process.env.CI_BUILD_ID || process.env.GITHUB_RUN_ID || process.env.GITHUB_SHA;
31-
31+
32+
// Determine group name based on context
33+
const isPR = process.env.GITHUB_EVENT_NAME === 'pull_request';
34+
const groupName = isPR ? 'PR Checks' : 'GitHub CI';
35+
36+
// Add tags for better organization in Cypress Cloud
37+
const tags = [];
38+
if (isPR) tags.push('pr');
39+
if (process.env.GITHUB_BASE_REF) tags.push(`base:${process.env.GITHUB_BASE_REF}`);
40+
3241
args.push(
3342
'--record',
3443
'--parallel',
3544
'--ci-build-id',
3645
ciBuildId,
3746
'--group',
38-
'GitHub CI',
39-
'--spec',
40-
specs.join(','),
47+
groupName,
4148
);
49+
50+
// Add tags if present
51+
if (tags.length > 0) {
52+
args.push('--tag', tags.join(','));
53+
}
54+
55+
// Enable auto-cancellation to save CI time on failures
56+
args.push('--auto-cancel-after-failures', '3');
4257
}
4358

4459
console.log('Running Cypress with args:', args.join(' '));

0 commit comments

Comments
 (0)