Skip to content

Commit

Permalink
ci(github): shard specs in workflow cypress.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Nov 29, 2024
1 parent b8cf1a6 commit 0a2e1df
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
name: cypress
on: [push, pull_request]

concurrency:
group: ${{ github.workflow_ref }}-${{ github.event_name }}
cancel-in-progress: true

jobs:
cypress:
runs-on: ubuntu-latest
strategy:
matrix:
shard: [0, 1, 2]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .nvmrc
- name: Split specs
id: specs
run: |
SPECS=specs
find cypress/e2e -type f -name '*.feature' > $SPECS
SPECS_COUNT=$(wc -l < $SPECS)
LINES=$(( ($SPECS_COUNT + 1) / ${{ strategy.job-total }} ))
split -d -l $LINES $SPECS spec
echo "SPECS=$(cat spec0${{ matrix.shard }})" >> $GITHUB_OUTPUT
- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: chrome
spec: |
${{ steps.specs.outputs.SPECS }}
- name: Record failed screenshots
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 0a2e1df

Please sign in to comment.