Skip to content

Commit 2c437c9

Browse files
authored
Add preview to emitter ci template (Azure#46511)
- Use eng/common emitter archetype template - Move build steps from yml to Build-Emitter.ps1 - Move test steps from yml to Test-Emitter.ps1 - Remove Generate.psm1 in favor of functions in Generate-Code.ps1 - Move eng/packages/*/eng/scripts to /eng/scripts/typespec
1 parent a47c2f4 commit 2c437c9

File tree

17 files changed

+381
-193
lines changed

17 files changed

+381
-193
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ pingme.txt
164164
# TS/Node files
165165
dist/
166166
node_modules/
167+
eng/packages/**/*.tgz
167168

168169
# MSBuild binary log files
169170
msbuild.binlog
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
artifacts/
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"semi": true,
3-
"trailingComma": "none",
4-
"printWidth": 80,
5-
"endOfLine": "auto"
6-
}
2+
"semi": true,
3+
"trailingComma": "none",
4+
"printWidth": 80,
5+
"endOfLine": "auto"
6+
}

eng/packages/http-client-csharp/ci.yml

Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,53 @@ trigger: none
22
pr:
33
branches:
44
include:
5-
- main
6-
- feature/*
7-
- hotfix/*
8-
- release/*
5+
- main
6+
- feature/*
7+
- hotfix/*
8+
- release/*
99
paths:
1010
include:
11-
- eng/packages/http-client-csharp
11+
- eng/packages/http-client-csharp
12+
13+
parameters:
14+
- name: BuildPrereleaseVersion
15+
displayName: "Build prerelease version"
16+
type: boolean
17+
default: true
18+
- name: UseTypeSpecNext
19+
displayName: "Use TypeSpec Next"
20+
type: boolean
21+
default: false
22+
- name: ShouldPublish
23+
displayName: "Publish packages"
24+
type: boolean
25+
default: false
26+
- name: PublishPublic
27+
displayName: "Publish to npmjs.org"
28+
type: boolean
29+
default: false
30+
- name: ShouldRegenerate
31+
displayName: "Regenerate clients"
32+
type: boolean
33+
default: false
1234

1335
variables:
1436
- template: /eng/pipelines/templates/variables/image.yml
1537

1638
extends:
17-
template: /eng/pipelines/templates/stages/1es-redirect.yml
39+
template: /eng/common/pipelines/templates/archetype-typespec-emitter.yml
1840
parameters:
19-
stages:
20-
- stage: 'Build'
21-
pool:
22-
name: $(WINDOWSPOOL)
23-
image: $(WINDOWSVMIMAGE)
24-
os: windows
25-
jobs:
26-
- job: Build
27-
timeoutInMinutes: 120
28-
steps:
29-
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
30-
- task: UseDotNet@2
31-
displayName: 'Use .NET Core SDK'
32-
retryCountOnTaskFailure: 3
33-
inputs:
34-
useGlobalJson: true
35-
performMultiLevelLookup: true
36-
- task: NodeTool@0
37-
displayName: "Install Node 18.x"
38-
inputs:
39-
versionSpec: '18.x'
40-
- script: |
41-
npm ci
42-
displayName: "Install packages"
43-
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp
44-
- script: |
45-
npm ls -a
46-
displayName: "List packages"
47-
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp
48-
- script: |
49-
npm run prettier
50-
displayName: "Emitter format check"
51-
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp/emitter
52-
- script: |
53-
npm run lint
54-
displayName: "Emitter linter check"
55-
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp/emitter
56-
- script: |
57-
npm run build
58-
displayName: 'Build Azure csharp client emitter and generator'
59-
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp/
60-
- pwsh: ./eng/packages/http-client-csharp/eng/scripts/CodeGenerationCheck.ps1
61-
displayName: "Check if generated code is up-to-date"
62-
env:
63-
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
64-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
65-
DOTNET_MULTILEVEL_LOOKUP: 0
66-
- pwsh: dotnet test $(Build.SourcesDirectory)/eng/packages/http-client-csharp/generator
67-
displayName: "Run tests"
41+
BuildPrereleaseVersion: ${{ parameters.BuildPrereleaseVersion }}
42+
UseTypeSpecNext: ${{ parameters.UseTypeSpecNext }}
43+
${{ if eq(variables['System.TeamProject'], 'internal') }}:
44+
ShouldPublish: ${{ parameters.ShouldPublish }}
45+
PublishPublic: ${{ parameters.PublishPublic }}
46+
PublishDependsOnTest: ${{ parameters.PublishPublic }}
47+
48+
ShouldRegenerate: ${{ parameters.ShouldRegenerate }}
49+
RegenerationJobCount: 5
50+
MinimumPerJob: 10
51+
OnlyGenerateTypespec: true
52+
TestMatrix:
53+
All:
54+
TestArguments: -UnitTests -GenerationChecks -Filter .NET

eng/packages/http-client-csharp/emitter/tsconfig.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
"experimentalDecorators": true,
2323
"newLine": "LF"
2424
},
25-
"include": ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts", "**/*.ts", "**/*.tsx", "**/.storybook/**/*.ts", "**/.storybook/**/*.tsx"],
25+
"include": [
26+
"src/**/*.ts",
27+
"test/**/*.ts",
28+
"vitest.config.ts",
29+
"**/*.ts",
30+
"**/*.tsx",
31+
"**/.storybook/**/*.ts",
32+
"**/.storybook/**/*.tsx"
33+
],
2634
"exclude": ["**/node_modules/", "**/dist/", "**/build/", "**/coverage/"]
2735
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
export default defineConfig({
4+
test: {
5+
environment: "node",
6+
isolate: false,
7+
coverage: {
8+
reporter: ["cobertura", "json", "text"]
9+
},
10+
outputFile: {
11+
junit: "./test-results.xml"
12+
},
13+
exclude: ["node_modules", "dist/test"]
14+
},
15+
server: {
16+
watch: {
17+
ignored: []
18+
}
19+
}
20+
});

eng/packages/http-client-csharp/eng/scripts/Generate.ps1

Lines changed: 0 additions & 27 deletions
This file was deleted.

eng/packages/http-client-csharp/eng/scripts/Generation.psm1

Lines changed: 0 additions & 59 deletions
This file was deleted.

eng/packages/http-client-csharp/eslint.config.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import pluginJs from "@eslint/js";
33
import tseslint from "typescript-eslint";
44

55
export default [
6-
{
7-
languageOptions: { globals: globals.node }
8-
},
9-
pluginJs.configs.recommended,
10-
...tseslint.configs.recommended,
11-
{
12-
files: ["**/*.ts"],
13-
rules: {
14-
"@typescript-eslint/no-explicit-any": "off"
15-
}
16-
},
17-
{
18-
ignores: ["dist/"]
6+
{
7+
languageOptions: { globals: globals.node }
8+
},
9+
pluginJs.configs.recommended,
10+
...tseslint.configs.recommended,
11+
{
12+
files: ["**/*.ts"],
13+
rules: {
14+
"@typescript-eslint/no-explicit-any": "off"
1915
}
16+
},
17+
{
18+
ignores: ["dist/"]
19+
}
2020
];

eng/packages/http-client-csharp/package-lock.json

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)