-
Notifications
You must be signed in to change notification settings - Fork 631
262 lines (241 loc) · 9.32 KB
/
Copy pathcli-e2e.yml
File metadata and controls
262 lines (241 loc) · 9.32 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
name: CLI End to End
on:
push:
branches: [main]
paths:
- ".github/workflows/cli-e2e.yml"
- "packages/openui-cli/**"
- "templates/**"
- "tsconfig.json"
pull_request:
branches: [main]
paths:
- ".github/workflows/cli-e2e.yml"
- "packages/openui-cli/**"
- "templates/**"
- "tsconfig.json"
permissions:
contents: read
jobs:
package-cli:
name: Package CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install workspace dependencies
run: pnpm install --frozen-lockfile
- name: Build CLI
run: pnpm --filter @openuidev/cli build
- name: Pack CLI
working-directory: packages/openui-cli
run: |
mkdir -p "${RUNNER_TEMP}/cli-package"
npm pack --ignore-scripts --pack-destination "${RUNNER_TEMP}/cli-package"
- uses: actions/upload-artifact@v7
with:
name: openui-cli-package
path: ${{ runner.temp }}/cli-package/*.tgz
if-no-files-found: error
retention-days: 1
cli-e2e:
name: ${{ matrix.template }} (${{ matrix.package-manager }}@${{ matrix.package-manager-version }}, ${{ matrix.os }}, Node ${{ matrix.node-version }})
needs: package-cli
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
template:
- openui-cloud
- openui-self-hosted
configuration:
# Keep one npm and pnpm canary for the legacy Node.js line.
- ubuntu-node20-npm10
- ubuntu-node20-pnpm9
# Exercise established and current package-manager majors on Linux.
- ubuntu-node22-npm10
- ubuntu-node22-npm11
- ubuntu-node22-pnpm10
- ubuntu-node22-pnpm11
- ubuntu-node24-npm11
- ubuntu-node24-pnpm10
- ubuntu-node24-pnpm11
# Keep the non-Linux jobs focused on the current package-manager majors.
- macos-node24-npm11
- macos-node24-pnpm11
- windows-node24-npm11
- windows-node24-pnpm11
include:
- configuration: ubuntu-node20-npm10
os: ubuntu-latest
node-version: 20
package-manager: npm
package-manager-version: "10"
- configuration: ubuntu-node20-pnpm9
os: ubuntu-latest
node-version: 20
package-manager: pnpm
package-manager-version: "9"
- configuration: ubuntu-node22-npm10
os: ubuntu-latest
node-version: 22
package-manager: npm
package-manager-version: "10"
- configuration: ubuntu-node22-npm11
os: ubuntu-latest
node-version: 22
package-manager: npm
package-manager-version: "11"
- configuration: ubuntu-node22-pnpm10
os: ubuntu-latest
node-version: 22
package-manager: pnpm
package-manager-version: "10"
- configuration: ubuntu-node22-pnpm11
os: ubuntu-latest
node-version: 22
package-manager: pnpm
package-manager-version: "11"
- configuration: ubuntu-node24-npm11
os: ubuntu-latest
node-version: 24
package-manager: npm
package-manager-version: "11"
- configuration: ubuntu-node24-pnpm10
os: ubuntu-latest
node-version: 24
package-manager: pnpm
package-manager-version: "10"
- configuration: ubuntu-node24-pnpm11
os: ubuntu-latest
node-version: 24
package-manager: pnpm
package-manager-version: "11"
- configuration: macos-node24-npm11
os: macos-latest
node-version: 24
package-manager: npm
package-manager-version: "11"
- configuration: macos-node24-pnpm11
os: macos-latest
node-version: 24
package-manager: pnpm
package-manager-version: "11"
- configuration: windows-node24-npm11
os: windows-latest
node-version: 24
package-manager: npm
package-manager-version: "11"
- configuration: windows-node24-pnpm11
os: windows-latest
node-version: 24
package-manager: pnpm
package-manager-version: "11"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Set up npm ${{ matrix.package-manager-version }}
if: matrix.package-manager == 'npm'
run: npm install --global npm@${{ matrix.package-manager-version }}
- uses: pnpm/action-setup@v6
if: matrix.package-manager == 'pnpm'
with:
version: ${{ matrix.package-manager-version }}
# The matrix version must win here; reading the repo root's
# packageManager field (pnpm@10.33.0) alongside an explicit version
# is a hard error in action-setup v6, so point it at a manifest
# without that field.
package_json_file: packages/openui-cli/package.json
- name: Verify package manager version
shell: bash
# Outside the repo checkout: inside it, pnpm >=10 self-switches to the
# root packageManager version (pnpm@10.33.0) and would report that
# instead of the matrix-installed version. The e2e steps below all run
# under runner.temp too, so this verifies what they will actually use.
working-directory: ${{ runner.temp }}
env:
PACKAGE_MANAGER: ${{ matrix.package-manager }}
EXPECTED_MAJOR: ${{ matrix.package-manager-version }}
run: |
actual_version="$("${PACKAGE_MANAGER}" --version)"
if [[ "${actual_version}" != "${EXPECTED_MAJOR}".* ]]; then
echo "Expected ${PACKAGE_MANAGER} ${EXPECTED_MAJOR}.x, got ${actual_version}" >&2
exit 1
fi
- uses: actions/download-artifact@v8
with:
name: openui-cli-package
path: ${{ runner.temp }}/cli-package
- name: Locate CLI package and prepare workspace
id: cli-package
shell: bash
env:
CLI_PACKAGE_DIR: ${{ runner.temp }}/cli-package
CLI_E2E_DIR: ${{ runner.temp }}/cli-e2e
run: |
node --input-type=module -e "
import fs from 'node:fs';
import path from 'node:path';
const tarballs = fs.readdirSync(process.env.CLI_PACKAGE_DIR).filter((file) => file.endsWith('.tgz'));
if (tarballs.length !== 1) throw new Error('Expected exactly one CLI tarball');
const tarball = path.join(process.env.CLI_PACKAGE_DIR, tarballs[0]);
fs.mkdirSync(process.env.CLI_E2E_DIR, { recursive: true });
fs.appendFileSync(process.env.GITHUB_OUTPUT, 'path=' + tarball + '\n');
"
- name: Run CLI with npm
if: matrix.package-manager == 'npm'
working-directory: ${{ runner.temp }}/cli-e2e
run: >-
npm exec --yes --package="${{ steps.cli-package.outputs.path }}" --
openui --no-telemetry create
--name generated-app
--template ${{ matrix.template }}
--api-key sk-test
--no-interactive
--no-skill
- name: Run CLI with pnpm
if: matrix.package-manager == 'pnpm'
working-directory: ${{ runner.temp }}/cli-e2e
run: >-
pnpm dlx "${{ steps.cli-package.outputs.path }}"
--no-telemetry create
--name generated-app
--template ${{ matrix.template }}
--api-key sk-test
--no-interactive
--no-skill
# npm- and pnpm-installed node_modules can both satisfy either run command.
# Check manager metadata and lockfile retention to verify CLI selection.
- name: Verify selected package manager
working-directory: ${{ runner.temp }}/cli-e2e/generated-app
shell: bash
env:
PACKAGE_MANAGER: ${{ matrix.package-manager }}
run: |
node --input-type=module -e "
import fs from 'node:fs';
import path from 'node:path';
const marker = process.env.PACKAGE_MANAGER === 'pnpm'
? path.join('node_modules', '.modules.yaml')
: path.join('node_modules', '.package-lock.json');
if (!fs.existsSync(marker)) throw new Error('Missing ' + process.env.PACKAGE_MANAGER + ' install marker: ' + marker);
const hasNpmLockfile = fs.existsSync('package-lock.json');
if (process.env.PACKAGE_MANAGER === 'npm' && !hasNpmLockfile) {
throw new Error('npm-generated project is missing package-lock.json');
}
if (process.env.PACKAGE_MANAGER !== 'npm' && hasNpmLockfile) {
throw new Error(process.env.PACKAGE_MANAGER + '-generated project retained package-lock.json');
}
"
- name: Build generated app
working-directory: ${{ runner.temp }}/cli-e2e/generated-app
run: ${{ matrix.package-manager }} run build
env:
OPENAI_API_KEY: sk-test
THESYS_API_KEY: sk-test
DEMO_USER_ID: test-user