-
Notifications
You must be signed in to change notification settings - Fork 2.2k
89 lines (83 loc) · 3.13 KB
/
using-action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Note: make sure to use the same version of cypress-io/github-action
# in all jobs, otherwise the last version wins I believe
name: Using Cypress GH Action
on: [push, workflow_dispatch]
jobs:
single-run:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress run
uses: cypress-io/github-action@v6
timeout-minutes: 10
with:
build: npm run build
start: npm start
parallel-runs:
name: Parallel 4x
runs-on: ubuntu-24.04
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Cypress Cloud dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# Run 4 copies of the current job in parallel.
# The name of the array (containers) and
# the actual items in the array (1, 2, 3, 4) do not matter.
# Based on the array, GitHub Actions will create
# 4 independently running parallel jobs
# (see https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs).
# Cypress Cloud load-balances the Cypress tests across the GitHub Actions jobs.
containers: [1, 2, 3, 4]
steps:
- name: Checkout
uses: actions/checkout@v4
# because of "record" and "parallel" parameters
# these containers will load balance all found tests among themselves
- name: run tests
uses: cypress-io/github-action@v6
timeout-minutes: 5
with:
record: true
parallel: true
group: GH Action parallel
start: npm start
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.dashboardRecordKey }}
parallel-runs-across-platforms:
name: every OS
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Cypress Cloud dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# run 2 copies of the current job in parallel
# and they will load balance all specs
os: ['ubuntu-24.04', 'windows-latest', 'macos-latest']
containers: [1, 2]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
# because of "record" and "parallel" parameters
# these containers will load balance all found tests among themselves
- name: run tests
uses: cypress-io/github-action@v6
timeout-minutes: 10
with:
record: true
parallel: true
group: Parallel 2x on ${{ matrix.os }}
# on Mac and Linux we can use "npm start"
start: npm start
# but for this particular project on Windows we need a different start command
start-windows: npm run start
env:
# pass the Cypress Cloud (dashboard) record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.dashboardRecordKey }}