-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Copy path.semaphore.yml
49 lines (44 loc) · 2.02 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
# copied from https://docs.semaphoreci.com/article/50-pipeline-yaml
# NodeJS and JavaScript docs
# https://docs.semaphoreci.com/article/82-language-javascript-and-nodejs
version: v1.0
name: Cypress example Kitchensink
agent:
machine:
type: e1-standard-2
containers:
# use Cypress-provided Docker image
# https://github.com/cypress-io/cypress-docker-images
- name: main
image: 'cypress/browsers:node12.0.0-chrome75'
blocks:
# installs NPM dependencies, builds the web application and
# runs Cypress tests on a single machine
- name: E2E tests
task:
# 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
jobs:
- name: npm ci and cache
commands:
- checkout
# from "How to Cache Cypress binary on Semaphore" documentation page
# https://semaphoreci.com/docs/caching-between-builds.html#caching-cypress-binary
- mkdir -p $SEMAPHORE_CACHE_DIR/Cypress
- mkdir -p ~/.cache || true
- ln -s $SEMAPHORE_CACHE_DIR/Cypress ~/.cache/Cypress
# 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)
- npm ci
# verify the Cypress test binary so its check status is cached
- npm run cy:verify
- cache store npm-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json)-$(checksum .semaphore/semaphore.yml) ~/.npm
# prints SEMAPHORE_* environment variables
- npm run print-env -- SEMAPHORE
# finally, build the web application and run end-to-end tests
- npm run build
- npm run test:ci:record