-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode-build.yml
83 lines (78 loc) · 2.3 KB
/
node-build.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
version: 2.1
description: Common node build commands
commands:
eslint:
description: "Run eslint"
steps:
- run:
name: Run Lint
command: |
`npm bin`/eslint --ext .js,.jsx,.tsx,.ts \
--format junit -o test-results/eslint-results.xml .
jest:
description: "Run jest tests"
parameters:
task-name:
description: Name of task
type: string
default: Run Tests
working-directory:
description: Directory to run jest in.
type: string
default: ~/project
max-workers:
type: integer
description: Number of jest workers to run.
default: 8
steps:
- run:
name: Setup Environment Variables
command: |
echo 'export JEST_JUNIT_OUTPUT_DIR="'"$(pwd)"'/test-results"' >> $BASH_ENV
echo 'export JEST_JUNIT_OUTPUT_NAME="jest-results.xml"' >> $BASH_ENV
- run:
name: << parameters.task-name >>
working_directory: << parameters.working-directory >>
command: |
`npm bin`/jest --ci --reporters=default \
--reporters=jest-junit \
--maxWorkers=<< parameters.max-workers >>
store-results:
description: "Store test results"
steps:
- store_test_results:
path: ./test-results
- store_artifacts:
path: ./test-results
destination: test-results
release:
description: "Release to npm if on appropriate branch"
parameters:
release-branch:
type: string
description: Name of branch to release on
default: master
steps:
- run:
name: Release if on master
command: |
if [ "$CIRCLE_BRANCH" = "<< parameters.release-branch >>" ]; then
`npm bin`/semantic-release || true
fi
typecheck:
description: "Check typescript types"
parameters:
task-name:
description: Name of task
type: string
default: Run Typecheck
working-directory:
description: Directory to run typecheck in.
type: string
default: ~/project
steps:
- run:
name: << parameters.task-name >>
working_directory: << parameters.working-directory >>
command: |
`npm bin`/tsc