Skip to content

Commit

Permalink
ci: use CYPRESS_BAIL
Browse files Browse the repository at this point in the history
  • Loading branch information
fgnass committed Dec 24, 2024
1 parent ec664c5 commit 03e68e6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node-version: [18.x, 20.x]
os: [ubuntu-latest] # [macos-latest, windows-latest, ubuntu-latest]
node-version: [20.x] # [18.x, 20.x]
fail-fast: true
if: ${{ needs.changes.outputs.cms == 'true' }}
steps:
Expand All @@ -46,12 +46,13 @@ jobs:
run: npm run build:demo
- name: run e2e tests
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
run: npm run test:e2e:run-ci -- --bail
run: npm run test:e2e:run-ci
env:
IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true || github.repository_owner != 'decaporg' }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
NODE_OPTIONS: --max-old-space-size=4096
TZ: Europe/Amsterdam
CYPRESS_BAIL: true
- uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x' && failure()
with:
Expand Down
37 changes: 16 additions & 21 deletions cypress/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import execa from 'execa';
import { globby } from 'globby';

async function runCypress() {
const args = ['run', '--browser', 'chrome', '--headless'];

if (process.env.CYPRESS_BAIL === 'true') {
args.push('--bail');
}

if (process.env.IS_FORK === 'true') {
const machineIndex = parseInt(process.env.MACHINE_INDEX);
const machineCount = parseInt(process.env.MACHINE_COUNT);
Expand All @@ -13,29 +19,18 @@ async function runCypress() {
? specs.slice(start)
: specs.slice(start, start + specsPerMachine);

await execa(
'cypress',
['run', '--browser', 'chrome', '--headless', '--bail', '--spec', machineSpecs.join(',')],
{ stdio: 'inherit', preferLocal: true },
);
args.push('--spec', machineSpecs.join(','));
await execa('cypress', args, { stdio: 'inherit', preferLocal: true });
} else {
await execa(
'cypress',
[
'run',
'--browser',
'chrome',
'--headless',
'--bail',
'--record',
'--parallel',
'--ci-build-id',
process.env.GITHUB_SHA,
'--group',
'GitHub CI',
],
{ stdio: 'inherit', preferLocal: true },
args.push(
'--record',
'--parallel',
'--ci-build-id',
process.env.GITHUB_SHA,
'--group',
'GitHub CI',
);
await execa('cypress', args, { stdio: 'inherit', preferLocal: true });
}
}

Expand Down

0 comments on commit 03e68e6

Please sign in to comment.