Skip to content

Commit 4c14495

Browse files
committed
fix: try running steps in parallel
1 parent 56cc922 commit 4c14495

File tree

1 file changed

+44
-13
lines changed

1 file changed

+44
-13
lines changed

.circleci/config.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,8 @@ jobs:
196196
- v1-win-dependencies-{{ checksum "package.json" }}
197197
- v1-win-dependencies- # Fallback key for partial cache restoration
198198
- setup_npm_user
199-
- run: npm ci --loglevel verbose
200-
- save_cache:
201-
key: v1-win-dependencies-{{ checksum "package.json" }}
202-
paths:
203-
- node_modules
204-
- .npm-cache
205-
206-
- run: docker version
207199

208-
# Restore Docker images from cache
200+
# Restore Docker images from cache early
209201
- restore_cache:
210202
keys:
211203
- v1-docker-images-{{ checksum "test/windows/plugin.spec.ts" }}
@@ -214,11 +206,50 @@ jobs:
214206
- run:
215207
name: Load cached Docker images if available
216208
command: .circleci/cache-python-docker.sh load
217-
218-
# Pre-pull the Python image to cache it
209+
210+
# Run npm ci and docker pull in parallel
219211
- run:
220-
name: Pre-pull Python test image
221-
command: .circleci/cache-python-docker.sh pull
212+
name: Install dependencies and pull Docker images in parallel
213+
command: |
214+
# Start Docker operations in background
215+
echo "Starting Docker image pull in background..."
216+
(
217+
docker version
218+
.circleci/cache-python-docker.sh pull
219+
echo $? > /tmp/docker-pull-exit-code
220+
) &
221+
DOCKER_PID=$!
222+
223+
# Run npm ci in foreground
224+
echo "Installing npm dependencies..."
225+
npm ci --loglevel verbose
226+
NPM_EXIT_CODE=$?
227+
228+
# Wait for Docker operations to complete
229+
echo "Waiting for Docker image pull to complete..."
230+
wait $DOCKER_PID
231+
232+
# Check exit codes
233+
DOCKER_EXIT_CODE=$(cat /tmp/docker-pull-exit-code 2>/dev/null || echo "1")
234+
rm -f /tmp/docker-pull-exit-code
235+
236+
if [ $NPM_EXIT_CODE -ne 0 ]; then
237+
echo "npm ci failed with exit code $NPM_EXIT_CODE"
238+
exit $NPM_EXIT_CODE
239+
fi
240+
241+
if [ $DOCKER_EXIT_CODE -ne 0 ]; then
242+
echo "Docker pull failed with exit code $DOCKER_EXIT_CODE"
243+
exit $DOCKER_EXIT_CODE
244+
fi
245+
246+
echo "Both npm ci and Docker pull completed successfully!"
247+
248+
- save_cache:
249+
key: v1-win-dependencies-{{ checksum "package.json" }}
250+
paths:
251+
- node_modules
252+
- .npm-cache
222253
- run:
223254
name: Install JUnit coverage reporter
224255
command: npm install --no-save jest-junit

0 commit comments

Comments
 (0)