Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preview to emitter ci template #46511

Merged
merged 7 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ pingme.txt
# TS/Node files
dist/
node_modules/
eng/packages/**/*.tgz

# MSBuild binary log files
msbuild.binlog
Expand Down
2 changes: 2 additions & 0 deletions eng/packages/http-client-csharp/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
artifacts/
10 changes: 5 additions & 5 deletions eng/packages/http-client-csharp/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"semi": true,
"trailingComma": "none",
"printWidth": 80,
"endOfLine": "auto"
}
"semi": true,
"trailingComma": "none",
"printWidth": 80,
"endOfLine": "auto"
}
97 changes: 42 additions & 55 deletions eng/packages/http-client-csharp/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,53 @@ trigger: none
pr:
branches:
include:
- main
- feature/*
- hotfix/*
- release/*
- main
- feature/*
- hotfix/*
- release/*
paths:
include:
- eng/packages/http-client-csharp
- eng/packages/http-client-csharp

parameters:
- name: BuildPrereleaseVersion
hallipr marked this conversation as resolved.
Show resolved Hide resolved
displayName: "Build prerelease version"
type: boolean
default: true
- name: UseTypeSpecNext
displayName: "Use TypeSpec Next"
type: boolean
default: false
- name: ShouldPublish
displayName: "Publish packages"
type: boolean
default: false
- name: PublishPublic
displayName: "Publish to npmjs.org"
type: boolean
default: false
- name: ShouldRegenerate
displayName: "Regenerate clients"
type: boolean
default: false

variables:
- template: /eng/pipelines/templates/variables/image.yml

extends:
template: /eng/pipelines/templates/stages/1es-redirect.yml
template: /eng/common/pipelines/templates/archetype-typespec-emitter.yml
parameters:
stages:
- stage: 'Build'
pool:
name: $(WINDOWSPOOL)
image: $(WINDOWSVMIMAGE)
os: windows
jobs:
- job: Build
timeoutInMinutes: 120
steps:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
- task: UseDotNet@2
displayName: 'Use .NET Core SDK'
retryCountOnTaskFailure: 3
inputs:
useGlobalJson: true
performMultiLevelLookup: true
- task: NodeTool@0
displayName: "Install Node 18.x"
inputs:
versionSpec: '18.x'
- script: |
npm ci
displayName: "Install packages"
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp
- script: |
npm ls -a
displayName: "List packages"
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp
- script: |
npm run prettier
displayName: "Emitter format check"
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp/emitter
- script: |
npm run lint
displayName: "Emitter linter check"
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp/emitter
- script: |
npm run build
displayName: 'Build Azure csharp client emitter and generator'
workingDirectory: $(Build.SourcesDirectory)/eng/packages/http-client-csharp/
- pwsh: ./eng/packages/http-client-csharp/eng/scripts/CodeGenerationCheck.ps1
displayName: "Check if generated code is up-to-date"
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_MULTILEVEL_LOOKUP: 0
- pwsh: dotnet test $(Build.SourcesDirectory)/eng/packages/http-client-csharp/generator
live1206 marked this conversation as resolved.
Show resolved Hide resolved
displayName: "Run tests"
BuildPrereleaseVersion: ${{ parameters.BuildPrereleaseVersion }}
UseTypeSpecNext: ${{ parameters.UseTypeSpecNext }}
${{ if eq(variables['System.TeamProject'], 'internal') }}:
ShouldPublish: ${{ parameters.ShouldPublish }}
PublishPublic: ${{ parameters.PublishPublic }}
PublishDependsOnTest: ${{ parameters.PublishPublic }}

ShouldRegenerate: ${{ parameters.ShouldRegenerate }}
RegenerationJobCount: 5
MinimumPerJob: 10
OnlyGenerateTypespec: true
TestMatrix:
All:
TestArguments: -UnitTests -GenerationChecks -Filter .NET
10 changes: 9 additions & 1 deletion eng/packages/http-client-csharp/emitter/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
"experimentalDecorators": true,
"newLine": "LF"
},
"include": ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts", "**/*.ts", "**/*.tsx", "**/.storybook/**/*.ts", "**/.storybook/**/*.tsx"],
"include": [
"src/**/*.ts",
"test/**/*.ts",
"vitest.config.ts",
"**/*.ts",
"**/*.tsx",
"**/.storybook/**/*.ts",
"**/.storybook/**/*.tsx"
],
"exclude": ["**/node_modules/", "**/dist/", "**/build/", "**/coverage/"]
}
20 changes: 20 additions & 0 deletions eng/packages/http-client-csharp/emitter/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
environment: "node",
isolate: false,
coverage: {
reporter: ["cobertura", "json", "text"]
},
outputFile: {
junit: "./test-results.xml"
},
exclude: ["node_modules", "dist/test"]
},
server: {
watch: {
ignored: []
}
}
});
27 changes: 0 additions & 27 deletions eng/packages/http-client-csharp/eng/scripts/Generate.ps1

This file was deleted.

59 changes: 0 additions & 59 deletions eng/packages/http-client-csharp/eng/scripts/Generation.psm1

This file was deleted.

26 changes: 13 additions & 13 deletions eng/packages/http-client-csharp/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";

export default [
{
languageOptions: { globals: globals.node }
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "off"
}
},
{
ignores: ["dist/"]
{
languageOptions: { globals: globals.node }
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "off"
}
},
{
ignores: ["dist/"]
}
];
9 changes: 0 additions & 9 deletions eng/packages/http-client-csharp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions eng/packages/http-client-csharp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"scripts": {
"clean": "rimraf ./dist ./emitter/temp && dotnet clean ./generator",
"build:emitter": "tsc -p ./emitter/tsconfig.build.json",
"build:generator": "dotnet build ./generator",
"build": "npm run build:emitter && npm run build:generator && copyfiles -u 5 ./node_modules/@typespec/http-client-csharp/dist/generator/Microsoft.Generator.CSharp.runtimeconfig.json ./dist/generator",
"test:emitter": "vitest run -c ./emitter/vitest.config.ts",
"test:generator": "dotnet test ./generator",
"test": "npm run test:emitter && npm run test:generator",
"build:generator": "dotnet build ./generator && copyfiles -u 5 ./node_modules/@typespec/http-client-csharp/dist/generator/Microsoft.Generator.CSharp.runtimeconfig.json ./dist/generator",
"build": "npm run build:emitter && npm run build:generator",
"test:emitter": "vitest run -c ./emitter/vitest.config.ts --passWithNoTests",
"test:generator": "dotnet test ./generator --logger \"trx;LogFileName=debug.trx\"",
"test": "npm run test:generator && npm run test:emitter",
hallipr marked this conversation as resolved.
Show resolved Hide resolved
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"prettier:fix": "prettier --write --config .prettierrc.json ./**/*.ts",
Expand All @@ -25,24 +25,12 @@
"dependencies": {
"@typespec/http-client-csharp": "0.1.9-alpha.20241010.1"
},
"peerDependencies": {
"@azure-tools/typespec-azure-core": ">=0.46.0 <1.0.0 || ~0.47.0-0",
"@azure-tools/typespec-client-generator-core": ">=0.46.0 <1.0.0 || ~0.47.0-0",
"@typespec/compiler": ">=0.60.0 <1.0.0 || ~0.61.0-0",
"@typespec/http": ">=0.60.0 <1.0.0 || ~0.61.0-0",
"@typespec/openapi": ">=0.60.0 <1.0.0 || ~0.61.0-0",
"@typespec/rest": ">=0.60.0 <1.0.0 || ~0.61.0-0",
"@typespec/versioning": ">=0.60.0 <1.0.0 || ~0.61.0-0"
},
"devDependencies": {
"@azure-tools/typespec-azure-core": "0.46.0",
"@azure-tools/typespec-client-generator-core": "0.46.2",
"@azure-tools/typespec-azure-resource-manager": "0.46.1",
"@azure-tools/typespec-azure-rulesets": "0.46.0",
"@azure-tools/typespec-autorest": "0.46.0",
"@eslint/js": "^9.2.0",
"@types/node": "~22.7.5",
"@types/prettier": "^2.6.3",
"@typespec/compiler": "0.60.0",
"@typespec/http": "0.60.0",
"@typespec/json-schema": "0.60.0",
Expand All @@ -51,6 +39,8 @@
"@typespec/rest": "0.60.0",
"@typespec/versioning": "0.60.0",
"@typespec/xml": "0.60.0",
"@types/node": "~22.7.5",
"@types/prettier": "^2.6.3",
"@vitest/coverage-v8": "^1.4.0",
"@vitest/ui": "^1.4.0",
"c8": "^9.1.0",
Expand All @@ -59,7 +49,17 @@
"vitest": "^1.4.0",
"copyfiles": "^2.4.1",
"eslint": "^8.57.0",
"@eslint/js": "^9.2.0",
"prettier": "~3.0.3",
"typescript-eslint": "^7.8.0"
}
},
"azure-sdk/emitter-package-json-pinning": [
hallipr marked this conversation as resolved.
Show resolved Hide resolved
"@azure-tools/typespec-azure-core",
"@azure-tools/typespec-client-generator-core",
"@typespec/compiler",
"@typespec/http",
"@typespec/openapi",
"@typespec/rest",
"@typespec/versioning"
]
}
Loading