@@ -203,6 +203,37 @@ jobs:
203203 - .npm-cache
204204
205205 - run : docker version
206+
207+ # Restore Docker images from cache
208+ - restore_cache :
209+ keys :
210+ - v1-docker-images-{{ checksum "test/windows/plugin.spec.ts" }}
211+ - v1-docker-images- # Fallback to any docker cache
212+
213+ - run :
214+ name : Load cached Docker images if available
215+ command : |
216+ if [ -d "/c/docker-cache" ] && [ "$(ls -A /c/docker-cache/*.tar 2>/dev/null)" ]; then
217+ for image in /c/docker-cache/*.tar; do
218+ echo "Loading $(basename $image)..."
219+ docker load -i "$image"
220+ done
221+ else
222+ echo "No cached Docker images found"
223+ fi
224+
225+ # Pre-pull the Python image to cache it
226+ - run :
227+ name : Pre-pull Python test image
228+ command : |
229+ PYTHON_IMAGE="python@sha256:1f92d35b567363820d0f2f37c7ccf2c1543e2d852cea01edb027039e6aef25e6"
230+ echo "Checking if Python image exists locally..."
231+ if ! docker images -q "$PYTHON_IMAGE" 2>/dev/null | grep -q .; then
232+ echo "Pulling Python image for cache..."
233+ docker pull "$PYTHON_IMAGE"
234+ else
235+ echo "Python image already exists locally"
236+ fi
206237 - run :
207238 name : Install JUnit coverage reporter
208239 command : npm install --no-save jest-junit
@@ -216,6 +247,24 @@ jobs:
216247 JEST_JUNIT_ADD_FILE_ATTRIBUTE : ' true' # We need this to make --split-by=timings work
217248 - store_test_results :
218249 path : reports
250+
251+ # Save Docker images to cache
252+ - run :
253+ name : Save Docker images to cache
254+ when : always
255+ command : |
256+ mkdir -p /c/docker-cache
257+ # Save the Python test image
258+ PYTHON_IMAGE="python@sha256:1f92d35b567363820d0f2f37c7ccf2c1543e2d852cea01edb027039e6aef25e6"
259+ if docker images -q "$PYTHON_IMAGE" 2>/dev/null | grep -q .; then
260+ echo "Saving Python image to cache..."
261+ docker save "$PYTHON_IMAGE" -o "/c/docker-cache/python-3.9.0.tar"
262+ fi
263+
264+ - save_cache :
265+ key : v1-docker-images-{{ checksum "test/windows/plugin.spec.ts" }}
266+ paths :
267+ - C:\docker-cache
219268 test_jest_windows_no_docker :
220269 << : *windows_big
221270 parallelism : 2 # Run tests across 2 containers
0 commit comments