forked from cypress-io/cypress-example-kitchensink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
semaphore.yml
103 lines (89 loc) · 3.66 KB
/
semaphore.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# copied from https://docs.semaphoreci.com/article/50-pipeline-yaml
# NodeJS and JavaScript docs
# https://docs.semaphoreci.com/article/82-language-javascript-and-nodejs
# Semaphore v2 API starts with version 1.0 :)
version: v1.0
name: Cypress example Kitchensink
agent:
# Dummy agent - the real agent is under the "task"
# but seems Semaphore requires top level one
machine:
type: e1-standard-2
blocks:
- name: Mac E2E tests
# disable Mac tests with built-in Electron
# until the following issue is resolved
# https://github.com/cypress-io/cypress-example-kitchensink/issues/269
# probably by upgrading Electron
# https://github.com/renderedtext/when#skip-block-exection
# still broken in Cypress v3.7.0
skip:
when: "true"
task:
agent:
machine:
type: a1-standard-4
prologue:
commands:
- checkout
- node --version
- npm --version
- npm ci
# verify the Cypress test binary so its check status is cached
- npm run cy:verify
- npx cypress cache path
- npx cypress cache list
# prints SEMAPHORE_* environment variables
- npm run print-env -- SEMAPHORE
jobs:
- name: Cypress E2E
commands:
# prints SEMAPHORE_* environment variables
- npm run print-env -- SEMAPHORE
- npm run e2e
- name: Linux E2E tests
task:
agent:
machine:
type: e1-standard-2
# see https://docs.semaphoreci.com/article/66-environment-variables-and-secrets
secrets:
# we have created new secrets object at https://cypress-io.semaphoreci.com/secrets/new
# for this organization. In this job we can now access CYPRESS_RECORD_KEY
- name: dashboard
env_vars:
# skip Puppeteer download, only needed for Netlify build
- name: PUPPETEER_SKIP_DOWNLOAD
value: "1"
# common commands that should be done before each E2E test command
prologue:
commands:
- nvm install 12
- npm install -g npm
- checkout
# restore previously cached files if any
# re-install dependencies if package.json or this semaphore YML file changes
- cache restore npm-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json)-$(checksum .semaphore/semaphore.yml)
- cache restore cypress-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json)-$(checksum .semaphore/semaphore.yml)
- npm ci
# verify the Cypress test binary so its check status is cached
- npm run cy:verify
# Cache NPM dependencies and Cypress binary
- cache store npm-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json)-$(checksum .semaphore/semaphore.yml) ~/.npm
- cache store cypress-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json)-$(checksum .semaphore/semaphore.yml) ~/.cache/Cypress
# prints SEMAPHORE_* environment variables
- npm run print-env -- SEMAPHORE
# finally, build the web application and run end-to-end tests
- npm run build
# start the web application server in the background
- npm run start:ci &
jobs:
# all "prologue" commands have finished by now
# and we can define a single job to execute in parallel on N machines
# Cypress recognizes Semaphore environment variables
# in order to link these separate steps into a single run.
# see Cypress https://on.cypress.io/parallelization
- name: Cypress E2E
parallelism: 3
commands:
- npx cypress run --record --parallel --group "Semaphore 3x"