forked from ngxs/store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
205 lines (185 loc) Β· 5.29 KB
/
config.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
version: 2
# Configuration
job_defaults_var: &job_defaults
working_directory: ~/workspace/app
docker:
- image: circleci/node:8-browsers
# Yarn cache key
cache_var: &cache_key yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
# Install yarn packages
yarn_install_var: &yarn_install
run:
name: Yarn Install Packages
# We install deps based on the frozen yarn file, so we know it's always the same
command: yarn install --frozen-lockfile --non-interactive
# Save yarn cache
save_cache_var: &save_cache
save_cache:
name: Save Yarn Package Cache
key: *cache_key
paths:
- ~/.cache/yarn
- node_modules
# Restore yarn cache
restore_cache_var: &restore_cache
restore_cache:
name: Restore Yarn Package Cache
keys:
- *cache_key
- yarn-packages-master
- yarn-packages-
# Persist the whole working space so we can share it between jobs
persist_workspace_var: &persist_workspace
persist_to_workspace:
# Must be an absolute path, or relative path from working_directory. This is a directory on the container which is
# taken to be the root directory of the workspace.
root: ~/workspace
# Must be relative path from root
paths:
- app
# Attach working space
attach_workspace_var: &attach_workspace
attach_workspace:
# Must be absolute path or relative path from working_directory
at: ~/workspace
#
# Jobs
#
jobs:
build:
<<: *job_defaults
steps:
# npm link will fail if we don't override the global install path to a path where we have right permissions
- run:
name: Set NPM global path
command: echo 'prefix = ~/.npm' > ~/.npmrc
- checkout
- *restore_cache
- *yarn_install
- *save_cache
- run:
name: Compile NGXS
command: yarn build
- run:
name: Create Pack
command: yarn pack --filename ngxs-core.tgz
- *persist_workspace
- store_artifacts:
path: ngxs-core.tgz
destination: dist/ngxs-core.tgz
- store_artifacts:
path: docs
destination: docs
lint:
<<: *job_defaults
steps:
- *attach_workspace
- run:
name: Lint
command: yarn lint
unit_tests:
<<: *job_defaults
environment:
# variables used by karma to export a circleci test insights
JUNIT_REPORT_PATH: coverage/junit/unit_tests
steps:
- *attach_workspace
- run:
name: Unit Tests
command: yarn test:ci
- store_test_results:
path: coverage/junit
- store_artifacts:
path: coverage/junit
destination: junit
- persist_to_workspace:
root: ~/workspace
paths:
- app/coverage
integration_tests:
<<: *job_defaults
steps:
- *attach_workspace
- run:
name: Integration Tests
command: yarn test:ci:integration
# - *persist_coverage // we don't run code coverage for integration tests
upload_coverage:
<<: *job_defaults
environment:
- CC_TEST_REPORTER_ID: 3f4c9a9d57ded045e0f9ab5d23e5bbcbf709bb85637bea555f1233e72134b818
steps:
- *attach_workspace
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter
- run: chmod +x /tmp/cc-test-reporter
- deploy:
name: Upload coverage results to Code Climate
command: /tmp/cc-test-reporter after-build --coverage-input-type lcov --exit-code 0
# Publish latest build to npm under the @next tag
publish_dev_build_to_npm:
<<: *job_defaults
steps:
- *attach_workspace
- run:
name: Set NPM publish token
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- deploy:
name: Publish development builds to all @ngxs packages
command: yarn publish:dev
# Publish tagged build to npm under the @latest tag
publish_tagged_build_to_npm:
<<: *job_defaults
steps:
- *attach_workspace
- run:
name: Set NPM publish token
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- deploy:
name: Publish tagged builds to all @ngxs packages
command: yarn publish:tagged
#
# Workflow
#
workflows:
version: 2
build-workflow:
jobs:
# Run build for all branches and tags
- build:
filters:
tags:
only: /.*/
- lint:
requires:
- build
- unit_tests:
requires:
- build
- integration_tests:
requires:
- build
- upload_coverage:
requires:
- unit_tests
- integration_tests
# Publish @dev builds if no tag is specified
- publish_dev_build_to_npm:
filters:
branches:
only:
- master
tags:
ignore: /.*/
requires:
- unit_tests
- integration_tests
# Publish package.version @latest when a v.* git tag is present
- publish_tagged_build_to_npm:
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
requires:
- unit_tests
- integration_tests