Skip to content

Commit 0dedd48

Browse files
committed
Standalone pnpm for chat-ui
Add per-package pnpm-lock.yaml and CI/release workflows with explicit pnpm version and cache-dependency-path.
1 parent e5ffa53 commit 0dedd48

File tree

4 files changed

+2367
-1
lines changed

4 files changed

+2367
-1
lines changed

.github/workflows/chat-ui.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: chat-ui
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "integrations/chat-ui/**"
9+
- ".github/workflows/chat-ui.yml"
10+
pull_request:
11+
types:
12+
- opened
13+
- synchronize
14+
- reopened
15+
- ready_for_review
16+
paths:
17+
- "integrations/chat-ui/**"
18+
- ".github/workflows/chat-ui.yml"
19+
workflow_dispatch:
20+
21+
defaults:
22+
run:
23+
working-directory: integrations/chat-ui
24+
25+
jobs:
26+
test:
27+
runs-on: ubuntu-latest
28+
name: "test (node: ${{ matrix.node-version }})"
29+
strategy:
30+
matrix:
31+
node-version: ["18", "20", "22"]
32+
timeout-minutes: 10
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Install pnpm
38+
uses: pnpm/action-setup@v4
39+
with:
40+
version: 10
41+
42+
- name: Setup Node.js
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: ${{ matrix.node-version }}
46+
cache: "pnpm"
47+
cache-dependency-path: integrations/chat-ui/pnpm-lock.yaml
48+
49+
- name: Install dependencies
50+
run: pnpm install --frozen-lockfile
51+
52+
- name: Run tests
53+
run: pnpm run test
54+
55+
typecheck:
56+
runs-on: ubuntu-latest
57+
name: typecheck
58+
timeout-minutes: 10
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
63+
- name: Install pnpm
64+
uses: pnpm/action-setup@v4
65+
with:
66+
version: 10
67+
68+
- name: Setup Node.js
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version: "20"
72+
cache: "pnpm"
73+
cache-dependency-path: integrations/chat-ui/pnpm-lock.yaml
74+
75+
- name: Install dependencies
76+
run: pnpm install --frozen-lockfile
77+
78+
- name: Run typecheck
79+
run: pnpm run typecheck
80+
81+
format:
82+
runs-on: ubuntu-latest
83+
name: format
84+
timeout-minutes: 10
85+
steps:
86+
- name: Checkout code
87+
uses: actions/checkout@v4
88+
89+
- name: Install pnpm
90+
uses: pnpm/action-setup@v4
91+
with:
92+
version: 10
93+
94+
- name: Setup Node.js
95+
uses: actions/setup-node@v4
96+
with:
97+
node-version: "20"
98+
cache: "pnpm"
99+
cache-dependency-path: integrations/chat-ui/pnpm-lock.yaml
100+
101+
- name: Install dependencies
102+
run: pnpm install --frozen-lockfile
103+
104+
- name: Check formatting
105+
run: pnpm run format:check
106+
107+
build:
108+
runs-on: ubuntu-latest
109+
name: build
110+
timeout-minutes: 10
111+
steps:
112+
- name: Checkout code
113+
uses: actions/checkout@v4
114+
115+
- name: Install pnpm
116+
uses: pnpm/action-setup@v4
117+
with:
118+
version: 10
119+
120+
- name: Setup Node.js
121+
uses: actions/setup-node@v4
122+
with:
123+
node-version: "20"
124+
cache: "pnpm"
125+
cache-dependency-path: integrations/chat-ui/pnpm-lock.yaml
126+
127+
- name: Install dependencies
128+
run: pnpm install --frozen-lockfile
129+
130+
- name: Build package
131+
run: pnpm run build
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Release @databricks/chat-ui
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
production:
7+
description: "Publish to npm? (If unchecked, will publish with --tag next)"
8+
required: true
9+
default: false
10+
type: boolean
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
id-token: write
18+
contents: write
19+
environment:
20+
name: ${{ inputs.production && 'npm' || 'npm-next' }}
21+
url: https://www.npmjs.com/package/@databricks/chat-ui
22+
defaults:
23+
run:
24+
working-directory: integrations/chat-ui
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install pnpm
29+
uses: pnpm/action-setup@v4
30+
with:
31+
version: 10
32+
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: "20"
36+
registry-url: "https://registry.npmjs.org"
37+
cache: "pnpm"
38+
cache-dependency-path: integrations/chat-ui/pnpm-lock.yaml
39+
40+
- name: Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Get package version
44+
id: get-version
45+
run: |
46+
PKG_VERSION=$(node -p "require('./package.json').version")
47+
echo "version=$PKG_VERSION" >> $GITHUB_OUTPUT
48+
49+
- name: Clean
50+
run: pnpm run clean
51+
52+
- name: Build
53+
run: pnpm run build
54+
55+
- name: Test
56+
run: pnpm run test
57+
58+
- name: Typecheck
59+
run: pnpm run typecheck
60+
61+
- name: Publish to npm
62+
if: inputs.production
63+
run: pnpm publish --access public --provenance --no-git-checks
64+
65+
- name: Publish to npm (next tag)
66+
if: ${{ !inputs.production }}
67+
run: pnpm publish --access public --tag next --provenance --no-git-checks
68+
69+
- name: Wait for registry propagation
70+
run: sleep 15
71+
72+
- name: Smoke test (production)
73+
if: inputs.production
74+
run: |
75+
PKG_VERSION=${{ steps.get-version.outputs.version }}
76+
mkdir -p /tmp/smoke-test
77+
cd /tmp/smoke-test
78+
npm install @databricks/chat-ui@$PKG_VERSION
79+
INSTALLED_VERSION=$(node -p "require('./node_modules/@databricks/chat-ui/package.json').version")
80+
echo "Expected: $PKG_VERSION"
81+
echo "Installed: $INSTALLED_VERSION"
82+
if [ "$PKG_VERSION" != "$INSTALLED_VERSION" ]; then
83+
echo "Version mismatch!"
84+
exit 1
85+
fi
86+
echo "Smoke test passed!"
87+
88+
- name: Smoke test (next tag)
89+
if: ${{ !inputs.production }}
90+
run: |
91+
mkdir -p /tmp/smoke-test
92+
cd /tmp/smoke-test
93+
npm install @databricks/chat-ui@next
94+
INSTALLED_VERSION=$(node -p "require('./node_modules/@databricks/chat-ui/package.json').version")
95+
echo "Installed @next version: $INSTALLED_VERSION"
96+
echo "Smoke test passed!"
97+
98+
- name: Generate package link
99+
run: |
100+
PKG_VERSION=${{ steps.get-version.outputs.version }}
101+
if [ "${{ inputs.production }}" == "true" ]; then
102+
LINK="https://www.npmjs.com/package/@databricks/chat-ui/v/$PKG_VERSION"
103+
echo "## :rocket: Package Released" >> $GITHUB_STEP_SUMMARY
104+
echo "" >> $GITHUB_STEP_SUMMARY
105+
echo "**@databricks/chat-ui v$PKG_VERSION** has been published to npm!" >> $GITHUB_STEP_SUMMARY
106+
echo "" >> $GITHUB_STEP_SUMMARY
107+
echo ":link: [$LINK]($LINK)" >> $GITHUB_STEP_SUMMARY
108+
else
109+
LINK="https://www.npmjs.com/package/@databricks/chat-ui?activeTab=versions"
110+
echo "## :test_tube: Package Released (next tag)" >> $GITHUB_STEP_SUMMARY
111+
echo "" >> $GITHUB_STEP_SUMMARY
112+
echo "**@databricks/chat-ui v$PKG_VERSION** has been published to npm with --tag next!" >> $GITHUB_STEP_SUMMARY
113+
echo "" >> $GITHUB_STEP_SUMMARY
114+
echo ":link: [$LINK]($LINK)" >> $GITHUB_STEP_SUMMARY
115+
fi

integrations/chat-ui/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,11 @@
8181
"ui",
8282
"components"
8383
],
84-
"license": "Databricks License"
84+
"license": "Databricks License",
85+
"pnpm": {
86+
"onlyBuiltDependencies": [
87+
"esbuild",
88+
"rolldown"
89+
]
90+
}
8591
}

0 commit comments

Comments
 (0)