Skip to content

Commit f801409

Browse files
committed
chore: improve circleci pipeline run time
1 parent e6410b5 commit f801409

File tree

2 files changed

+51
-45
lines changed

2 files changed

+51
-45
lines changed

.circleci/config.yml

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,19 @@ jobs:
121121
mode: auto
122122
open-source-additional-arguments: --exclude=test
123123
iac-scan: disabled
124-
install:
124+
install_lint_build:
125125
<<: *defaults
126126
steps:
127127
- install_deps
128-
lint:
129-
<<: *defaults
130-
steps:
131-
- checkout
132128
- attach_workspace:
133129
at: ~/snyk-docker-plugin
134-
- run: npm run lint
130+
- run:
131+
name: Lint
132+
command: npm run lint
133+
- run:
134+
name: Build
135+
command: npm run build
136+
135137
test:
136138
<<: *defaults
137139
steps:
@@ -146,15 +148,32 @@ jobs:
146148
test_jest_windows_with_docker:
147149
<<: *windows_big
148150
steps:
151+
- run:
152+
name: Start Docker pull
153+
command: |
154+
# The plugin.spec.ts test is slow due to pulling a 2+GB image,
155+
# so we pull the image in the background to save time
156+
docker pull python@sha256:1f92d35b567363820d0f2f37c7ccf2c1543e2d852cea01edb027039e6aef25e6
157+
background: true
149158
- checkout
150159
- install_node_npm:
151160
node_version: << parameters.node_version >>
161+
152162
- setup_npm_user
153163
- run: npm ci
154164
- run: docker version
155165
- run:
156-
command: npm run test-jest-windows
166+
name: Install JUnit coverage reporter
167+
command: npm install --no-save jest-junit
168+
- run:
169+
name: Run Windows tests
170+
command: npm run test-jest-windows --reporters=default --reporters=jest-junit
157171
no_output_timeout: 20m
172+
environment:
173+
JEST_JUNIT_OUTPUT_DIR: './reports/junit'
174+
JEST_JUNIT_ADD_FILE_ATTRIBUTE: 'true'
175+
- store_test_results:
176+
path: reports
158177
test_jest_windows_no_docker:
159178
<<: *windows_big
160179
steps:
@@ -166,19 +185,22 @@ jobs:
166185
# make docker appear to be broken.
167186
- run: "function docker() { return 1; }"
168187
- run:
169-
command: npm run test-jest-windows
188+
name: Install JUnit coverage reporter
189+
command: npm install --no-save jest-junit
190+
- run:
191+
name: Run Windows tests
192+
command: npm run test-jest-windows --reporters=default --reporters=jest-junit
170193
no_output_timeout: 20m
171-
build:
172-
<<: *defaults
173-
steps:
174-
- checkout_and_merge
175-
- setup_npm_user
176-
- run: npm ci
177-
- run: npm run build
194+
environment:
195+
JEST_JUNIT_OUTPUT_DIR: './reports/junit'
196+
JEST_JUNIT_ADD_FILE_ATTRIBUTE: 'true'
197+
- store_test_results:
198+
path: reports
178199
build_cli:
179200
<<: *defaults
180201
resource_class: medium
181202
steps:
203+
- setup_remote_docker
182204
- checkout_and_merge
183205
- run:
184206
name: Setup NPM credentials
@@ -190,7 +212,6 @@ jobs:
190212
<<: *defaults
191213
resource_class: medium
192214
steps:
193-
- setup_remote_docker
194215
- checkout_and_merge
195216
- run:
196217
name: Build a Go binary with latest Go version
@@ -225,26 +246,11 @@ workflows:
225246
filters:
226247
branches:
227248
ignore: main
228-
- install:
229-
name: Install
230-
context:
231-
- nodejs-install
232-
- lint:
233-
name: Lint
249+
- install_lint_build:
250+
name: Install, Lint, and Build
234251
context:
235252
- nodejs-install
236253
- snyk-bot-slack
237-
requires:
238-
- Install
239-
post-steps:
240-
- *slack-fail-notify
241-
- build:
242-
name: Build
243-
context:
244-
- nodejs-install
245-
- snyk-bot-slack
246-
requires:
247-
- Lint
248254
post-steps:
249255
- *slack-fail-notify
250256
- security-scans:
@@ -258,7 +264,7 @@ workflows:
258264
- nodejs-install
259265
- snyk-bot-slack
260266
requires:
261-
- Build
267+
- Install, Lint, and Build
262268
post-steps:
263269
- *slack-fail-notify
264270
- test_jest_windows_with_docker:
@@ -268,7 +274,7 @@ workflows:
268274
- snyk-bot-slack
269275
node_version: *windows_node_version
270276
requires:
271-
- Build
277+
- Install, Lint, and Build
272278
post-steps:
273279
- *slack-fail-notify
274280
- test_jest_windows_no_docker:
@@ -278,7 +284,7 @@ workflows:
278284
- snyk-bot-slack
279285
node_version: *windows_node_version
280286
requires:
281-
- Build
287+
- Install, Lint, and Build
282288
post-steps:
283289
- *slack-fail-notify
284290
- build_cli:
@@ -287,7 +293,7 @@ workflows:
287293
- nodejs-install
288294
- snyk-bot-slack
289295
requires:
290-
- Build
296+
- Install, Lint, and Build
291297
post-steps:
292298
- *slack-fail-notify
293299
- release:
@@ -300,8 +306,7 @@ workflows:
300306
only:
301307
- main
302308
requires:
303-
- Lint
304-
- Build
309+
- Install, Lint, and Build
305310
- Security Scans
306311
- Test
307312
- Test Jest Windows with Docker

package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)