diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index cab1b67f1..7787b9d07 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -26,12 +26,14 @@ env: jobs: init: - runs-on: ubuntu-latest-low + runs-on: ubuntu-latest outputs: nodeVersion: ${{ steps.versions.outputs.nodeVersion }} npmVersion: ${{ steps.versions.outputs.npmVersion }} env: + # We'll install cypress in the cypress job + CYPRESS_INSTALL_BINARY: 0 PUPPETEER_SKIP_DOWNLOAD: true steps: @@ -88,14 +90,17 @@ jobs: fail-fast: false matrix: # Run multiple copies of the current job in parallel - # Please increase the number or runners as your tests suite grows - containers: ['component', '1', '2', '3'] + # Please increase the number or runners as your tests suite grows (0 based index for e2e tests) + containers: [0, 1, 2, 3, 4, 5, 6, 7] + # Hack as strategy.job-total includes the component and GitHub does not allow math expressions + # Always align this number with the total of e2e runners (max. index + 1) + total-containers: [8] name: runner ${{ matrix.containers }} steps: - name: Restore context - uses: buildjet/cache/save@v4 + uses: buildjet/cache/restore@v4 with: fail-on-cache-miss: true key: cypress-context-${{ github.run_id }} @@ -109,17 +114,18 @@ jobs: - name: Set up npm ${{ needs.init.outputs.npmVersion }} run: npm i -g 'npm@${{ needs.init.outputs.npmVersion }}' + - name: Install cypress + run: ./node_modules/cypress/bin/cypress install + - name: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }} cypress tests uses: cypress-io/github-action@0da3c06ed8217b912deea9d8ee69630baed1737e # v6.7.6 with: - record: ${{ secrets.CYPRESS_RECORD_KEY && true }} - parallel: ${{ secrets.CYPRESS_RECORD_KEY && true }} + # We already installed the dependencies in the init job + install: false # cypress run type component: ${{ matrix.containers == 'component' }} - group: ${{ secrets.CYPRESS_RECORD_KEY && env.CYPRESS_GROUP }} - # cypress env - ci-build-id: ${{ secrets.CYPRESS_RECORD_KEY && env.CYPRESS_BUILD_ID }} - tag: ${{ secrets.CYPRESS_RECORD_KEY && github.event_name }} + # Do not add Cypress record key config as this conflicts with cypress-split + # Cypress again tries to force users to buy their dashboard... env: # Needs to be prefixed with CYPRESS_ CYPRESS_BRANCH: ${{ env.BRANCH }} @@ -128,9 +134,8 @@ jobs: # Needed for some specific code workarounds TESTING: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - CYPRESS_BUILD_ID: ${{ github.sha }}-${{ github.run_number }} - CYPRESS_GROUP: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }} + SPLIT: ${{ matrix.total-containers }} + SPLIT_INDEX: ${{ matrix.containers == 'component' && 0 || matrix.containers }} - name: Upload snapshots uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0