forked from cypress-io/cypress-react-unit-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
59 lines (57 loc) · 2.15 KB
/
circle.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
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
# install and cache dependencies in this job
# AND build the library once
# then the workspace will be passed to other jobs
- cypress/install:
name: Install
build: npm run transpile
post-steps:
- run:
name: Show info 📺
command: npx cypress info
- run:
name: Linting code 🧹
command: npm run lint
- cypress/run:
name: Test
parallelism: 4
requires:
- Install
# notice a trick to avoid re-installing dependencies
# in this job - a do-nothing "install-command" parameter
install-command: echo 'Nothing to install in this job'
# we are not going to use results from this job anywhere else
no-workspace: true
record: false
# following examples from
# https://circleci.com/docs/2.0/parallelism-faster-jobs/
command: |
TESTFILES=$(circleci tests glob "cypress/{component,integration}/**/*spec.{js,jsx,ts,tsx}" | circleci tests split --total=4)
echo "Test files for this machine are $TESTFILES"
npx cypress run --spec $TESTFILES
# this job attaches the workspace left by the install job
# so it is ready to run Cypress tests
# only we will run semantic release script instead
- cypress/run:
name: NPM release
# we need newer Node for semantic release
executor: cypress/base-12-6-0
requires:
- Install
- Test
install-command: echo 'Nothing to install in this job'
no-workspace: true
# instead of "cypress run" do NPM release 😁
# clear environment variables to trick semantic-release
# into thinking this is NOT a pull request.
# (under the hood the module env-ci is used to check if this is a PR)
command: |
CIRCLE_PR_NUMBER= \
CIRCLE_PULL_REQUEST= \
CI_PULL_REQUEST= \
npm run semantic-release