From 84824ea952f7e4af2df00b7cd1b1886ddebca7c1 Mon Sep 17 00:00:00 2001 From: Rhys Howell Date: Fri, 14 Aug 2026 14:00:22 -0400 Subject: [PATCH 1/3] chore(ci, mongodb-runner): keep mongodb versions cached on windows for a week to speed up CI COMPASS-10932 --- .github/workflows/check-test.yaml | 26 +++++++++++++++++++++ packages/mongodb-runner/src/mongocluster.ts | 6 ++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-test.yaml b/.github/workflows/check-test.yaml index 0ffc363fa..93e78a359 100644 --- a/.github/workflows/check-test.yaml +++ b/.github/workflows/check-test.yaml @@ -103,6 +103,32 @@ jobs: run: npm run check-ci -- --stream shell: bash + # Downloading and extracting MongoDB server binaries is slow on Windows, + # so we cache them between runs. + # + # Cache directories are named after the requested version range ('8.x', + # '*'), not the version it resolved to, so a cache entry pins tests to + # whichever release was current when it was written. Including the ISO + # week in the key rotates that weekly, keeping us at most a week behind. + # Bump `v1` to force a refresh. + - name: Compute cache week + if: ${{ runner.os == 'Windows' }} + id: cache-week + run: echo "week=$(date -u +%G-%V)" >> $GITHUB_OUTPUT + shell: bash + + - name: Cache MongoDB binaries + if: ${{ runner.os == 'Windows' }} + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ${{ runner.temp }}/mongodb-binaries + key: v1-mongodb-binaries-${{ runner.os }}-group${{ matrix.group }}-${{ steps.cache-week.outputs.week }} + + - name: Set MongoDB binaries download dir + if: ${{ runner.os == 'Windows' }} + run: echo "MONGODB_RUNNER_DOWNLOAD_DIR=${RUNNER_TEMP}/mongodb-binaries" >> $GITHUB_ENV + shell: bash + - name: Run Tests run: | scopes=$(node .github/scripts/compute-test-group.mjs "${{ matrix.group }}" "${TOTAL_GROUPS}") diff --git a/packages/mongodb-runner/src/mongocluster.ts b/packages/mongodb-runner/src/mongocluster.ts index 6f8d24a8b..0715ccdb0 100644 --- a/packages/mongodb-runner/src/mongocluster.ts +++ b/packages/mongodb-runner/src/mongocluster.ts @@ -80,6 +80,8 @@ export interface RSMemberOptions { export interface CommonOptions { /** * Directory where server binaries will be downloaded and stored. + * Defaults to the `MONGODB_RUNNER_DOWNLOAD_DIR` environment variable if set, + * otherwise to `tmpDir`. */ downloadDir?: string; /** @@ -380,7 +382,9 @@ export class MongoCluster extends EventEmitter { cluster.defaultConnectionOptions = { ...options.internalClientOptions }; if (!options.binDir) { options.binDir = await this.downloadMongoDb( - options.downloadDir ?? options.tmpDir, + options.downloadDir ?? + process.env.MONGODB_RUNNER_DOWNLOAD_DIR ?? + options.tmpDir, options.version, options.downloadOptions, ); From 38beec624383c6720b77d01acdf3e8338d44b0af Mon Sep 17 00:00:00 2001 From: Rhys Date: Fri, 14 Aug 2026 14:16:25 -0400 Subject: [PATCH 2/3] fixup: share between groups Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/check-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-test.yaml b/.github/workflows/check-test.yaml index 93e78a359..483aedef4 100644 --- a/.github/workflows/check-test.yaml +++ b/.github/workflows/check-test.yaml @@ -122,7 +122,7 @@ jobs: uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: ${{ runner.temp }}/mongodb-binaries - key: v1-mongodb-binaries-${{ runner.os }}-group${{ matrix.group }}-${{ steps.cache-week.outputs.week }} + key: v1-mongodb-binaries-${{ runner.os }}-${{ steps.cache-week.outputs.week }} - name: Set MongoDB binaries download dir if: ${{ runner.os == 'Windows' }} From 9e58c3784b186361329c121cca67ff6304f4dc5d Mon Sep 17 00:00:00 2001 From: Rhys Date: Fri, 14 Aug 2026 14:16:53 -0400 Subject: [PATCH 3/3] fixup: quote github output Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/check-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-test.yaml b/.github/workflows/check-test.yaml index 483aedef4..8de9d3ce1 100644 --- a/.github/workflows/check-test.yaml +++ b/.github/workflows/check-test.yaml @@ -114,7 +114,7 @@ jobs: - name: Compute cache week if: ${{ runner.os == 'Windows' }} id: cache-week - run: echo "week=$(date -u +%G-%V)" >> $GITHUB_OUTPUT + run: echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT" shell: bash - name: Cache MongoDB binaries