-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
config.yml
146 lines (136 loc) · 4.4 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
version: 2
# The following stanza defines a map named defaults with a variable that may be
# inserted using the YAML merge (<<: *) key later in the file to save some
# typing. See http://yaml.org/type/merge.html for details.
defaults: &defaults
environment:
CI_SCRIPTS: 'npx --quiet --package @reactioncommerce/ci-scripts@1.6.2'
DOCKER_REPOSITORY: "reactioncommerce/reaction"
DOCKER_NAMESPACE: "reactioncommerce"
DOCKER_NAME: "reaction"
docker:
- image: circleci/node:14.11.0-stretch
jobs:
install-dependencies:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- reaction-v5-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- reaction-v5-node-modules-{{ .Branch }}
- run:
name: Install NPM dependencies
command: npm ci
- save_cache:
key: reaction-v5-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
paths:
- node_modules
- save_cache:
key: reaction-v5-node-modules-{{ .Branch }}
paths:
- node_modules
dockerfile-lint:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Lint Dockerfiles
command: ${CI_SCRIPTS} lint-dockerfiles
eslint:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- reaction-v5-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- reaction-v5-node-modules-{{ .Branch }}
- run:
name: Lint JavaScript
command: npm run lint
graphql-lint:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- reaction-v5-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- reaction-v5-node-modules-{{ .Branch }}
- run:
name: Lint GraphQL schemas
command: npm run lint:gql
test-integration-query:
<<: *defaults
docker:
- image: circleci/node:14.11.0-stretch
# Integration tests need MongoDB server running and accessible on port 27017
- image: circleci/mongo:4.2.0
command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger
ports:
- "27017:27017"
steps:
- checkout
- restore_cache:
keys:
- reaction-v5-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- reaction-v5-node-modules-{{ .Branch }}
- run:
name: Run Integration Query Tests
command: MONGO_URL=mongodb://localhost:27017/test npm run test:integration:query
test-integration-mutation:
<<: *defaults
docker:
- image: circleci/node:14.11.0-stretch
# Integration tests need MongoDB server running and accessible on port 27017
- image: circleci/mongo:4.2.0
command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger
ports:
- "27017:27017"
steps:
- checkout
- restore_cache:
keys:
- reaction-v5-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- reaction-v5-node-modules-{{ .Branch }}
- run:
name: Run Integration Mutation Tests
command: MONGO_URL=mongodb://localhost:27017/test npm run test:integration:mutation
docker-build-push:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Build and push production Docker image
command: ${CI_SCRIPTS} docker-build-tag-push . ${DOCKER_REPOSITORY}
workflows:
version: 2
build_and_test:
jobs:
- install-dependencies
- dockerfile-lint:
requires:
- install-dependencies
- eslint:
requires:
- install-dependencies
- graphql-lint:
requires:
- install-dependencies
- test-integration-query:
requires:
- install-dependencies
- test-integration-mutation:
requires:
- install-dependencies
- docker-build-push:
context: reaction-publish-docker
requires:
- dockerfile-lint
- eslint
- graphql-lint
- test-integration-query
- test-integration-mutation