Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
allenjzhang committed Jan 24, 2025
2 parents 7510ab9 + 6f80a22 commit 613925f
Show file tree
Hide file tree
Showing 15 changed files with 418 additions and 136 deletions.
38 changes: 38 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Install Dependencies
description: Setup for Dependencies

inputs:
node-version:
required: false
description: Node version for setup-node
default: 20.x
dotnet-version:
required: false
description: .NET version for setup-dotnet
default: 9.x
java-version:
required: false
description: Java version for setup-java
default: 17

runs:
using: composite

steps:
- name: Set node version to ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: npm

- name: Set .NET version to ${{ inputs.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Set Java version to ${{ inputs.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.java-version }}
distribution: microsoft
cache: maven
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["main"]
pull_request:
branches: ["main"]
merge_group:
workflow_dispatch: {}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
todo-app:
name: TodoApp
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: Build TodoApp Asp.Net
run: dotnet build
working-directory: ./todoApp/servers/aspnet

petstore:
name: PetStore
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: Build TodoApp Asp.Net
run: dotnet build
working-directory: ./petstore/servers/aspnet
52 changes: 52 additions & 0 deletions .github/workflows/emitter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Emitter

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["main"]
pull_request:
branches: ["main"]
merge_group:
workflow_dispatch: {}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
java:
name: Java Emitter
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: Generate Code
run: eng/scripts/java/Generate.ps1
shell: pwsh
working-directory: .

- name: Verify Code Change
run: git -c core.safecrlf=false diff --ignore-space-at-eol --exit-code -- ./petstore/clients/java ./todoApp/clients/java
working-directory: .
dotnet:
name: .NET Emitter
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: Generate Code
run: eng/scripts/dotnet/Generate.ps1
shell: pwsh
working-directory: .

- name: Verify Code Change
run: git -c core.safecrlf=false diff --ignore-space-at-eol --exit-code -- ./petstore/clients/dotnet ./todoApp/clients/dotnet
working-directory: .
33 changes: 33 additions & 0 deletions eng/scripts/dotnet/Generate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Set-Location (Resolve-Path (Join-Path $PSScriptRoot '..' '..' '..'))

# Make sure everything is up-to-date
npm ci

# Generate
Remove-Item ./petstore/clients/dotnet/src/Generated -Recurse -Force
Push-Location ./petstore/spec
npx --no-install tsp compile . --emit "@typespec/http-client-csharp"
Pop-Location

Remove-Item ./todoApp/clients/dotnet/src/Generated -Recurse -Force
Push-Location ./todoApp/spec
npx --no-install tsp compile . --emit "@typespec/http-client-csharp"
Pop-Location

# Build and install SDK
Push-Location ./petstore/clients/dotnet
dotnet build
Pop-Location

Push-Location ./todoApp/clients/dotnet
dotnet build
Pop-Location

# Build samples
Push-Location ./petstore/samples/dotnet
dotnet build
Pop-Location

Push-Location ./todoApp/samples/dotnet
dotnet build
Pop-Location
8 changes: 4 additions & 4 deletions eng/scripts/java/Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ Pop-Location

# Build and install SDK
Push-Location ./petstore/clients/java
mvn clean spotless:apply install -DskipTests
mvn --no-transfer-progress clean spotless:apply install -DskipTests
Pop-Location

Push-Location ./todoApp/clients/java
mvn clean spotless:apply install -DskipTests
mvn --no-transfer-progress clean spotless:apply install -DskipTests
Pop-Location

# Build samples
Push-Location ./petstore/samples/java
mvn clean spotless:apply package
mvn --no-transfer-progress clean spotless:apply package
Pop-Location

Push-Location ./todoApp/samples/java
mvn clean spotless:apply package
mvn --no-transfer-progress clean spotless:apply package
Pop-Location
38 changes: 19 additions & 19 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
"@azure-tools/typespec-autorest": "^0.50.0",
"@azure-tools/typespec-azure-core": "^0.50.0",
"@azure-tools/typespec-azure-resource-manager": "^0.50.0",
"@azure-tools/typespec-client-generator-core": "^0.50.0",
"@azure-tools/typespec-client-generator-core": "^0.50.2",
"@typespec/compiler": "^0.64.0",
"@typespec/http": "^0.64.0",
"@typespec/http-client-csharp": "^0.1.9-alpha.20250117.1",
"@typespec/http-client-csharp": "^0.1.9-alpha.20250123.2",
"@typespec/http-server-csharp": "0.58.0-alpha.7",
"@typespec/http-server-javascript": "^0.58.0-alpha.7",
"@typespec/http-client-java": "^0.1.9",
"@azure-tools/typespec-ts": "^0.38.1",
"@typespec/http-client-python": "^0.6.5",
"@typespec/http-client-python": "^0.6.8",
"@typespec/json-schema": "^0.64.0",
"@typespec/openapi": "^0.64.0",
"@typespec/openapi3": "^0.64.0",
"@typespec/rest": "^0.64.0",
"@typespec/rest": "^0.64.1",
"@typespec/streams": "^0.64.0",
"@typespec/versioning": "^0.64.0"
}
Expand Down
Loading

0 comments on commit 613925f

Please sign in to comment.