Repository navigation
147 lines (129 loc) · 5.39 KB
/
Copy pathmcp-build.yml
File metadata and controls
147 lines (129 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Build MCP Workflow
# Least privilege: this workflow only reads the repo and uploads/downloads artifacts.
permissions:
contents: read
on:
workflow_dispatch:
workflow_call:
inputs:
pr:
description: "PR number when building a pull-request merge commit"
required: false
type: number
skip-tests:
description: "Skip unit tests for image-only builds"
required: false
type: string
default: "false"
branch:
description: "Branch to build when pr is 0"
required: false
type: string
checkout-ref:
description: "Immutable commit SHA to checkout for an approved external PR"
required: false
type: string
default: ""
pull_request:
branches: [release, master]
paths:
- "app/client/packages/mcp/**"
# The MCP's widget-property ownership table is pinned against the client widgets' property panes and the
# widget factory (prop-owners-drift.test.ts). The authoritative gate for that test is client-unit-tests
# (yarn workspaces foreach, feeding ci/merge-gate); this filter only gives a pane change the fast standalone
# MCP check (~2 min) without waiting for the full quality-checks run. Not a required check: keep the path
# filter and the non-required status together, or a non-matching PR would wait on it forever.
- "app/client/src/widgets/**"
- "app/client/src/WidgetProvider/factory/helpers.ts"
# routeContract.test.ts reads the server's MCP allowlist rules and the CE controllers that serve the routes,
# and hardcodes the route constants from UrlCE.java and Entity.java.
# A PR that changes only those server files still runs the route check against the Node tools. For a
# server-only PR this is the only check that runs the test: client-unit-tests runs on app/client/** changes
# only, and this workflow is not a required check. Reviewers must read the mcp-build status by hand on such
# a PR. A fork PR gets this check only after /approve-ci.
- "app/server/appsmith-server/src/main/java/com/appsmith/server/filters/McpAllow*.java"
- "app/server/appsmith-server/src/main/java/com/appsmith/server/filters/ce/McpAllow*.java"
- "app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/*ControllerCE.java"
- "app/server/appsmith-server/src/main/java/com/appsmith/server/git/controllers/GitApplicationControllerCE.java"
- "app/server/appsmith-server/src/main/java/com/appsmith/server/constants/ce/UrlCE.java"
- "app/server/appsmith-server/src/main/java/com/appsmith/server/constants/Entity.java"
defaults:
run:
working-directory: app/client/packages/mcp
shell: bash
jobs:
build:
runs-on: ubuntu-latest
if: |
github.event.pull_request.head.repo.full_name == github.repository ||
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'repository_dispatch' ||
github.event_name == 'schedule' ||
github.event_name == 'release'
steps:
- name: Checkout the merged pull-request commit
if: inputs.checkout-ref == '' && inputs.pr != 0
uses: actions/checkout@v4
with:
fetch-tags: true
persist-credentials: false
ref: refs/pull/${{ inputs.pr }}/merge
- name: Checkout the specified branch
if: inputs.checkout-ref == '' && inputs.pr == 0 && inputs.branch != ''
uses: actions/checkout@v4
with:
fetch-tags: true
persist-credentials: false
ref: ${{ inputs.branch }}
- name: Checkout the head commit
if: inputs.checkout-ref == '' && inputs.pr == 0 && inputs.branch == ''
uses: actions/checkout@v4
with:
fetch-tags: true
persist-credentials: false
# The approved-external-PR flow pins every build to the merge commit that the maintainer approved. Without
# this step, a force-push after approval would be built here while server, client and rts build the
# approved commit.
- name: Checkout the approved immutable commit
if: inputs.checkout-ref != ''
uses: actions/checkout@v4
with:
fetch-tags: true
persist-credentials: false
ref: ${{ inputs.checkout-ref }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: app/client/package.json
# actions/setup-node@v4 does not restore Yarn 3 caches from a subdirectory.
- name: Restore Yarn cache
uses: actions/cache@v4
with:
path: app/client/.yarn/cache
key: v1-yarn3-${{ hashFiles('app/client/yarn.lock') }}
restore-keys: |
v1-yarn3-
- name: Install dependencies
run: |
corepack enable
yarn install --immutable
- name: Check types
run: yarn check-types
- name: Lint
run: yarn lint
- name: Check formatting
run: yarn prettier
- name: Run unit tests
if: inputs.skip-tests != 'true'
run: yarn test:unit
- name: Build
run: yarn build
- name: Tar the MCP bundle
run: tar -cvf mcp-dist.tar dist
- name: Upload MCP build bundle
uses: actions/upload-artifact@v4
with:
name: mcp-dist
path: app/client/packages/mcp/mcp-dist.tar
overwrite: true