Skip to content

chore(deps): update start-server-and-test to 2.0.9 🌟 #1107

chore(deps): update start-server-and-test to 2.0.9 🌟

chore(deps): update start-server-and-test to 2.0.9 🌟 #1107

Workflow file for this run

# GitHub Actions
# https://docs.github.com/en/actions/using-workflows
# See also .github/workflows/using-action.yml in this repository
# for an example of using the Cypress GitHub JavaScript action
# https://github.com/cypress-io/github-action
#
name: Cypress parallel tests
on: [push, workflow_dispatch]
jobs:
install:
name: Install npm and Cypress
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# install a specific version of Node using
# https://github.com/actions/setup-node
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
# just so we learn about available environment variables GitHub provides
- name: Print CI env variables
run: |
npm i -g @bahmutov/print-env@2
print-env GITHUB BUILD ACTIONS || true
# Restore the previous npm modules and Cypress binary archives.
# Any updated archives will be saved automatically after the entire
# workflow successfully finishes.
# See https://github.com/actions/cache
# we use exact restore key to avoid npm module snowballing
# https://glebbahmutov.com/blog/do-not-let-npm-cache-snowball/
- name: Cache central npm modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
# we use the exact restore key to avoid Cypress binary snowballing
# https://glebbahmutov.com/blog/do-not-let-cypress-cache-snowball/
- name: Cache Cypress binary
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
cypress-${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
# Cache local node_modules to pass to testing jobs
- name: Cache local node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-${{ github.ref }}-
- name: install dependencies and verify Cypress
env:
# make sure every Cypress install prints minimal information
CI: 1
run: |
npm ci
npx cypress cache path
npx cypress cache list
npx cypress verify
npx cypress info
# Duplicate job definitions - GitHub YAML does not support
# anchor definitions yet, thus we cannot put same steps into a template object yet
test1:
name: Cypress test 1
runs-on: ubuntu-24.04
needs: install
steps:
- uses: actions/checkout@v4
# install a specific version of Node using
# https://github.com/actions/setup-node
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
# Restore just local node_modules and the Cypress binary archives.
- name: Cache Cypress binary
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
cypress-${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
- name: Cache local node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-${{ github.ref }}-
# check the restored Cypress binary
- name: Check binary
run: |
npx cypress cache path
npx cypress cache list
# Starts local server, then runs Cypress tests and records results on Cypress Cloud
- name: Cypress tests
run: |
npm start &
npx cypress run --record --parallel --group "Parallel 2x"
env:
# place your secret record key at
# https://github.com/cypress-io/cypress-example-kitchensink/settings/secrets
CYPRESS_RECORD_KEY: ${{ secrets.dashboardRecordKey }}
TERM: xterm
# Save screenshots as test artifacts
# https://github.com/actions/upload-artifact
- uses: actions/upload-artifact@v4
# there might be no screenshots created when:
# - there are no test failures
# so only upload screenshots if previous step has failed
if: failure()
with:
name: screenshots
path: cypress/screenshots
test2:
name: Cypress test 2
runs-on: ubuntu-24.04
needs: install
steps:
- uses: actions/checkout@v4
# install a specific version of Node using
# https://github.com/actions/setup-node
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
# Restore just local node_modules and the Cypress binary archives.
- name: Cache Cypress binary
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
cypress-${{ runner.os }}-cypress-${{ github.ref }}-
- name: Cache local node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ github.ref }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
# check the restored Cypress binary
- name: Check binary
run: |
npx cypress cache path
npx cypress cache list
# Starts local server, then runs Cypress tests and records results on Cypress Cloud
- name: Cypress tests
run: |
npm start &
npx cypress run --record --parallel --group "Parallel 2x"
env:
# place your secret record key at
# https://github.com/cypress-io/cypress-example-kitchensink/settings/secrets
CYPRESS_RECORD_KEY: ${{ secrets.dashboardRecordKey }}
TERM: xterm
# Save screenshots as test artifacts
# https://github.com/actions/upload-artifact
- uses: actions/upload-artifact@v4
# there might be no screenshots created when:
# - there are no test failures
# so only upload screenshots if previous step has failed
if: failure()
with:
name: screenshots
path: cypress/screenshots