Skip to content

Commit 0a6f077

Browse files
committed
chore: add incremental builds in CI
1 parent 1b9c790 commit 0a6f077

9 files changed

Lines changed: 53 additions & 28 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: TypeScript Build
2+
description: Restore tsc --build cache and run pnpm run build
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Restore TypeScript Build cache
8+
uses: actions/cache@v4
9+
with:
10+
path: |
11+
packages/**/dist
12+
packages/**/*.tsbuildinfo
13+
key: tsc-build-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig.base.json', 'packages/**/tsconfig.json', 'packages/**/tsconfig.build.json', 'packages/mongodb-mcp-server/tsconfig.esm.json', 'packages/mongodb-mcp-server/tsconfig.cjs.json') }}
14+
restore-keys: |
15+
tsc-build-${{ runner.os }}-
16+
- name: Build
17+
shell: bash
18+
run: pnpm run build
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: TypeScript Build
2+
description: Restore tsc --build cache and run pnpm run build
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Restore TypeScript Build cache
8+
uses: actions/cache@v4
9+
with:
10+
path: |
11+
packages/**/dist
12+
packages/**/*.tsbuildinfo
13+
key: tsc-build-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'tsconfig.base.json', 'packages/**/tsconfig.json', 'packages/**/tsconfig.build.json', 'packages/mongodb-mcp-server/tsconfig.esm.json', 'packages/mongodb-mcp-server/tsconfig.cjs.json') }}
14+
restore-keys: |
15+
tsc-build-${{ runner.os }}-
16+
- name: Build
17+
shell: bash
18+
run: pnpm run build

.github/workflows/accuracy-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ jobs:
4444
cache: "pnpm"
4545
- name: Install dependencies
4646
run: pnpm install --frozen-lockfile
47-
- name: Build
48-
run: pnpm run build
47+
- uses: ./.github/actions/typescript-build
4948
- name: Run accuracy tests
5049
run: pnpm run test:accuracy
5150
- name: Upload accuracy test summary

.github/workflows/check.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ jobs:
3030
key: eslint-${{ runner.os }}-${{ hashFiles('eslint.config.js', 'eslint-rules/**', 'pnpm-lock.yaml') }}
3131
restore-keys: |
3232
eslint-${{ runner.os }}-
33-
- name: Build
34-
run: pnpm run build
33+
- uses: ./.github/actions/typescript-build
3534
- name: Run style check
3635
run: pnpm run check
3736

@@ -49,8 +48,7 @@ jobs:
4948
cache: "pnpm"
5049
- name: Install dependencies
5150
run: pnpm install --frozen-lockfile
52-
- name: Build
53-
run: pnpm run build
51+
- uses: ./.github/actions/typescript-build
5452
- run: pnpm run generate
5553

5654
check-dep:
@@ -66,10 +64,9 @@ jobs:
6664
with:
6765
node-version-file: package.json
6866
cache: "pnpm"
69-
- name: Install dependencies and build
70-
run: |
71-
pnpm install --frozen-lockfile
72-
pnpm run build
67+
- name: Install dependencies
68+
run: pnpm install --frozen-lockfile
69+
- uses: ./.github/actions/typescript-build
7370
- name: Remove dev dependencies
7471
run: |
7572
rm -rf node_modules

.github/workflows/code-health-fork.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ jobs:
4141
cache: "pnpm"
4242
- name: Install dependencies
4343
run: pnpm install --frozen-lockfile
44-
- name: Build
45-
run: pnpm run build
44+
- uses: ./.github/actions/typescript-build
4645
# TODO: Re-enable on Windows once the silent worker fork crash / mongod cleanup
4746
# leak is resolved. See MCP-495.
4847
- name: Run tests
@@ -65,8 +64,7 @@ jobs:
6564
cache: "pnpm"
6665
- name: Install dependencies
6766
run: pnpm install --frozen-lockfile
68-
- name: Build
69-
run: pnpm run build
67+
- uses: ./.github/actions/typescript-build
7068
- name: Pre-pull Atlas Local images
7169
run: |
7270
docker pull mongodb/mongodb-atlas-local:preview &

.github/workflows/code-health-long-running.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ jobs:
2424
cache: "pnpm"
2525
- name: Install dependencies
2626
run: pnpm install --frozen-lockfile
27-
- name: Build
28-
run: pnpm run build
27+
- uses: ./.github/actions/typescript-build
2928
- name: Run tests
3029
env:
3130
MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }}

.github/workflows/code-health.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ jobs:
4242
cache: "pnpm"
4343
- name: Install dependencies
4444
run: pnpm install --frozen-lockfile
45-
- name: Build
46-
run: pnpm run build
45+
- uses: ./.github/actions/typescript-build
4746
# TODO: Re-enable on Windows once the silent worker fork crash / mongod cleanup
4847
# leak is resolved. See MCP-495.
4948
- name: Run tests
@@ -77,8 +76,7 @@ jobs:
7776
cache: "pnpm"
7877
- name: Install dependencies
7978
run: pnpm install --frozen-lockfile
80-
- name: Build
81-
run: pnpm run build
79+
- uses: ./.github/actions/typescript-build
8280
- name: Run tests
8381
env:
8482
MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }}
@@ -113,6 +111,7 @@ jobs:
113111
docker pull mongodb/mongodb-atlas-local:preview &
114112
docker pull mongodb/mongodb-atlas-local:latest &
115113
wait
114+
- uses: ./.github/actions/typescript-build
116115
- name: Run tests
117116
run: pnpm test packages/integration-tests/src/tools/atlas-local/
118117
- name: Upload test results
@@ -138,8 +137,7 @@ jobs:
138137
cache: "pnpm"
139138
- name: Install dependencies
140139
run: pnpm install --frozen-lockfile
141-
- name: Build
142-
run: pnpm run build
140+
- uses: ./.github/actions/typescript-build
143141
- name: Install Playwright Chromium
144142
run: pnpm --filter @mongodb-js/mcp-browser-tests run install:browser
145143
- name: Run browser tests

.github/workflows/mcpb.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ jobs:
2727
cache: "pnpm"
2828
- name: Install dependencies
2929
run: pnpm install --frozen-lockfile
30-
- name: Build
31-
run: pnpm run build
30+
- uses: ./.github/actions/typescript-build
3231
- name: Validate manifest
3332
run: pnpm run validate:mcpb
3433
- name: Build .mcpb

.github/workflows/publish.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ jobs:
9090
registry-url: "https://registry.npmjs.org"
9191
cache: "pnpm"
9292

93-
- name: Build
94-
run: |
95-
pnpm install --frozen-lockfile
96-
pnpm run build
93+
- name: Install dependencies
94+
run: pnpm install --frozen-lockfile
95+
- uses: ./.github/actions/typescript-build
9796
- name: Build .mcpb
9897
run: pnpm run build:mcpb
9998
- name: Publish to NPM

0 commit comments

Comments
 (0)