Skip to content

Commit 988e922

Browse files
Merge branch 'main' into feature/http-client-js-playground
2 parents af1caa4 + 5ae541a commit 988e922

44 files changed

Lines changed: 1314 additions & 741 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,33 @@ TypeSpec is a language for defining cloud service APIs and shapes. This monorepo
125125

126126
## Pull Request instructions
127127

128-
- When the work is done, run `pnpm chronus add` to add a changelog entry. Select the correct type of change (fix, feat, docs, etc.) and provide a clear description based on the initial issue description. Only add an area tag when the package has multiple areas and the change targets a secondary area; use bracket format like `[converter]` or `[formatter]` (for example, a secondary openapi3 converter change should start with `[converter]`). Avoid generic area prefixes like `core -` and do not add any area tag for single-area packages. For new features, include a short code block in the changelog entry that showcases the new functionality; skip code blocks for simple bug fixes.
128+
### Changelog entries
129+
130+
When the work is done, run `pnpm chronus add` to add a changelog entry. The valid change kinds are defined in [`.chronus/config.yaml`](../.chronus/config.yaml). Do **NOT** use `feat`, `docs`, `patch`, `minor`, or `major` — these are not valid change kinds.
131+
132+
**If a PR affects multiple packages with different types of changes, create a separate changelog entry for each.** For example, if the PR adds a feature to `@typespec/http` and fixes a bug in `@typespec/openapi3`, run `pnpm chronus add` twice to create two separate changelog entries — one with `feature` for `@typespec/http` and one with `fix` for `@typespec/openapi3`. Do NOT bundle different change types into a single entry.
133+
134+
### Changelog message guidelines
135+
136+
- Provide a clear description based on the initial issue description.
137+
- Only add an area tag when the package has multiple areas and the change targets a secondary area; use bracket format like `[converter]` or `[formatter]` (for example, a secondary openapi3 converter change should start with `[converter]`). Avoid generic area prefixes like `core -` and do not add any area tag for single-area packages.
138+
- For new features, include a short code block in the changelog entry that showcases the new functionality; skip code blocks for simple bug fixes.
139+
140+
### TDD approach
141+
129142
- Always start by defining additional unit tests/updating existing unit tests to fulfill the requirements first. Then make changes to the code accordingly. If you are following the TDD (Test Driven Development) approach, make sure to run the tests and see them fail before implementing the code changes.
130143

144+
## Branch Naming Conventions
145+
146+
### Out-of-sync / hotfix releases
147+
148+
Out-of-sync releases and hotfix releases follow the same flow using a `publish/` branch:
149+
150+
- **Pattern:** `publish/<package>-release-<MM-DD>` (e.g., `publish/python-release-03-26`)
151+
- These branches skip certain CI checks (consistency, external-integration) and auto-publish on merge
152+
- For **out-of-sync releases**, the PR targets `main`
153+
- For **hotfix releases**, the PR targets the corresponding `release/*` branch (e.g., `release/v0.60`) instead of `main`
154+
131155
## Available Task Instructions
132156

133157
- [Testserver Generation](./prompts/testserver-generation.md): Instructions for generating TypeSpec HTTP spec test servers

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ updates:
2525
- "packages/http-client-csharp"
2626
- "packages/http-client-java"
2727
- "packages/http-client-python"
28+
labels: [] # conflict with our labels in labels.ts
2829
groups:
2930
alloy:
3031
patterns:
@@ -126,6 +127,7 @@ updates:
126127
interval: "weekly"
127128
exclude-paths:
128129
- ".github/workflows/*.lock.{yaml,yml}"
130+
labels: [] # conflict with our labels in labels.ts
129131
groups:
130132
actions:
131133
patterns:

.github/skills/emitter-prep-for-pr/SKILL.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,30 @@ Write changeset messages that are:
264264

265265
### Multiple packages
266266

267-
If changes affect multiple packages, list all of them:
267+
If changes affect multiple packages **with the same change kind**, list all of them in a single changeset:
268268

269269
```yaml
270270
packages:
271271
- "@typespec/http-client-python"
272272
- "@typespec/http-client-csharp"
273273
```
274274
275+
**If packages have different change kinds, create separate changeset files for each.** For example, if the PR adds a feature to `@typespec/http-client-python` and fixes a bug in `@typespec/http-client-csharp`, create two files:
276+
277+
```yaml
278+
# File 1: feature for python
279+
changeKind: feature
280+
packages:
281+
- "@typespec/http-client-python"
282+
```
283+
284+
```yaml
285+
# File 2: fix for csharp
286+
changeKind: fix
287+
packages:
288+
- "@typespec/http-client-csharp"
289+
```
290+
275291
### Skipping changeset
276292

277293
Some changes don't need a changeset:

.github/workflows/core-ci.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: Core CI
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
# Exclude isolated emitter packages and files already checked by dedicated CI workflows
11+
paths-ignore:
12+
- ".prettierignore"
13+
- ".prettierrc.json"
14+
- "cspell.yaml"
15+
- "eslint.config.json"
16+
- ".chronus/**"
17+
- "eng/emitters/**"
18+
- "packages/http-client-csharp/**"
19+
- "packages/http-client-java/**"
20+
- "packages/http-client-python/**"
21+
pull_request:
22+
branches:
23+
- main
24+
- "release/*"
25+
paths-ignore:
26+
- ".prettierignore"
27+
- ".prettierrc.json"
28+
- "cspell.yaml"
29+
- "eslint.config.json"
30+
- ".chronus/**"
31+
- "eng/emitters/**"
32+
- "packages/http-client-csharp/**"
33+
- "packages/http-client-java/**"
34+
- "packages/http-client-python/**"
35+
merge_group:
36+
37+
concurrency:
38+
group: ${{ github.workflow }}-${{ github.ref }}
39+
cancel-in-progress: true
40+
41+
jobs:
42+
build:
43+
name: Build (${{ matrix.os }}, Node ${{ matrix.node-version }})
44+
runs-on: ${{ matrix.os }}
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
os: [ubuntu-latest, windows-latest]
49+
node-version: ["20.x", "22.x", "24.x"]
50+
51+
env:
52+
TYPESPEC_VS_CI_BUILD: true
53+
TYPESPEC_SKIP_WEBSITE_BUILD: true
54+
55+
steps:
56+
- name: Enable git long paths (Windows)
57+
if: runner.os == 'Windows'
58+
run: git config --global core.longpaths true
59+
60+
- uses: actions/checkout@v4
61+
62+
- uses: ./.github/actions/setup
63+
with:
64+
node-version: ${{ matrix.node-version }}
65+
66+
- uses: actions/setup-dotnet@v5
67+
with:
68+
dotnet-version: 8.0.x
69+
70+
- name: Install dependencies
71+
run: pnpm install
72+
73+
- name: Restore .NET dependencies
74+
run: dotnet restore
75+
working-directory: packages/typespec-vs
76+
77+
- name: Build
78+
run: pnpm run build
79+
80+
- name: Test
81+
run: pnpm vitest run --coverage --reporter=default --reporter=github-actions
82+
83+
- name: Upload coverage artifacts
84+
uses: actions/upload-artifact@v4
85+
if: always()
86+
with:
87+
name: coverage-${{ matrix.os }}-node${{ matrix.node-version }}
88+
path: packages/*/coverage/
89+
retention-days: 5
90+
91+
- name: Check for changed files
92+
run: node eng/common/scripts/check-for-changed-files.js
93+
94+
website:
95+
name: Website
96+
runs-on: ubuntu-latest
97+
98+
steps:
99+
- uses: actions/checkout@v4
100+
101+
- uses: ./.github/actions/setup
102+
103+
- name: Install dependencies
104+
run: pnpm install
105+
106+
- name: Install Playwright browsers
107+
run: npx playwright install --with-deps
108+
109+
- name: Build website
110+
run: pnpm --filter "@typespec/website..." run build
111+
112+
- name: Check for changed files
113+
run: node eng/common/scripts/check-for-changed-files.js
114+
115+
e2e:
116+
name: E2E Tests
117+
runs-on: ubuntu-latest
118+
119+
env:
120+
TYPESPEC_VS_CI_BUILD: false
121+
TYPESPEC_SKIP_WEBSITE_BUILD: true
122+
DISPLAY: ":99"
123+
124+
steps:
125+
- uses: actions/checkout@v4
126+
127+
- uses: ./.github/actions/setup
128+
129+
- name: Install dependencies
130+
run: pnpm install
131+
132+
- name: Install Playwright browsers
133+
run: |
134+
sudo dpkg --configure -a
135+
npx playwright install --with-deps
136+
137+
- name: Start Xvfb
138+
run: |
139+
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
140+
echo "Started xvfb"
141+
142+
- name: Build
143+
run: pnpm run build
144+
145+
- name: E2E Tests
146+
run: pnpm run test:e2e
147+
148+
- name: Upload UI test results
149+
uses: actions/upload-artifact@v4
150+
if: always()
151+
with:
152+
name: uitestresults-e2e
153+
path: packages/playground-website/test-results/
154+
retention-days: 5
155+
156+
- name: Upload screenshots
157+
uses: actions/upload-artifact@v4
158+
if: always()
159+
with:
160+
name: screenshots
161+
path: packages/typespec-vscode/temp/images-linux/
162+
retention-days: 5
163+
164+
- name: Upload trace results
165+
uses: actions/upload-artifact@v4
166+
if: always()
167+
with:
168+
name: trace-results
169+
path: packages/typespec-vscode/test-results/
170+
retention-days: 5
171+
172+
- name: Check for changed files
173+
run: node eng/common/scripts/check-for-changed-files.js
174+
175+
docker:
176+
name: Docker Build
177+
runs-on: ubuntu-latest
178+
179+
steps:
180+
- uses: actions/checkout@v4
181+
182+
- name: Build Docker image
183+
run: docker build -f ./docker/Dockerfile .

.github/workflows/merge-release-in-main.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ jobs:
2525

2626
- name: Generate branch name
2727
id: branchname
28+
env:
29+
REF_NAME: ${{ github.ref_name }}
2830
run: |
29-
echo "branchname=backmerge/${{ github.ref_name }}-$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
31+
echo "branchname=backmerge/${REF_NAME}-$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
3032
- name: Create branch
33+
env:
34+
BRANCH: ${{ steps.branchname.outputs.branchname }}
3135
run: |
32-
branch="${{ steps.branchname.outputs.branchname }}"
33-
git checkout -b $branch
34-
git push --set-upstream origin $branch
36+
git checkout -b "$BRANCH"
37+
git push --set-upstream origin "$BRANCH"
3538
3639
- name: create pull request
3740
id: open-pr

CONTRIBUTING.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Those commands can be run on the workspace or in a specific package(`cd ./packag
5151
| `pnpm format` | Format |
5252
| `pnpm format:check` | Validate files are formatted |
5353
| `pnpm gen-extern-signature` | Regenerate TypeScript signature for decorators(except compiler) |
54-
| `pnpm change add` | Add a change description |
54+
| `pnpm change add` | Add a change description (see valid kinds in [`.chronus/config.yaml`](.chronus/config.yaml)) |
5555
| `pnpm lint` | Run linters |
5656
| `pnpm lint:fix` | Fix autofixable issues |
5757
| `pnpm regen-samples` | Regen the samples(when the samples test fail) |
@@ -66,6 +66,15 @@ TYPESPEC_VERBOSE_TEST_OUTPUT=true.
6666

6767
**For the compiler you will need to run it manually or run the whole workspace build. This is because for the tool to run it needs the compiler to build first.**
6868

69+
### Writing tests
70+
71+
Tests use [vitest](https://vitest.dev/) with the `createTester` API from `@typespec/compiler/testing`. **Do not** use the legacy `createTestHost`/`createTestRunner` APIs — they are deprecated. See the [testing documentation](https://typespec.io/docs/extending-typespec/testing) for the full guide and migration instructions.
72+
73+
**Test structure rules:**
74+
75+
- Do **not** wrap tests in a top-level `describe`. The test file name already provides context. Use `it()` directly at the top level. Only use `describe()` for sub-groups within a file.
76+
- Use `it` (not `test`) for test functions, as enforced by ESLint (`vitest/consistent-test-it`).
77+
6978
## Using VS Code
7079

7180
### Recommended extensions

packages/compiler/test/e2e/cli/cli.e2e.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ interface ExecCliOptions {
1616

1717
async function execCli(args: string[], { cwd }: ExecCliOptions) {
1818
const node = process.platform === "win32" ? "node.exe" : "node";
19-
return execAsync(node, [resolvePath(pkgRoot, "entrypoints/cli.js"), ...args], { cwd });
19+
return execAsync(node, [resolvePath(pkgRoot, "entrypoints/cli.js"), ...args], {
20+
cwd,
21+
env: { ...process.env, NO_COLOR: "1" },
22+
});
2023
}
2124
async function execCliSuccess(args: string[], { cwd }: ExecCliOptions) {
2225
const result = await execCli(args, { cwd });

0 commit comments

Comments
 (0)