File tree Expand file tree Collapse file tree 2 files changed +54
-6
lines changed Expand file tree Collapse file tree 2 files changed +54
-6
lines changed Original file line number Diff line number Diff line change 4343 dotnet workload update
4444 dotnet workload install aspire
4545
46+ - name : Install Spectral Cli
47+ shell : bash
48+ run : |
49+ curl -L https://raw.github.com/stoplightio/spectral/master/scripts/install.sh | sh
50+
4651 - name : Restore NuGet packages
4752 shell : bash
4853 run : |
@@ -71,13 +76,32 @@ jobs:
7176 run : |
7277 dotnet run --project ./src/AzureOpenAIProxy.AppHost &
7378
74- DOTNET_PID=$!
75-
7679 sleep 30
7780
7881 dotnet test ./test/AzureOpenAIProxy.PlaygroundApp.Tests --no-build --logger "trx" --collect:"XPlat Code Coverage"
7982
80- kill $DOTNET_PID
83+ - name : Create openapi.json
84+ shell : pwsh
85+ run : |
86+ $fileContent = Get-Content './src/AzureOpenAIProxy.ApiApp/Constants.cs'
87+ $API_VERSION = [regex]::Match($fileContent, 'public const string Version = "([^"]+)"').Groups[1].Value
88+
89+ Invoke-WebRequest -Uri "https://localhost:7001/swagger/$API_VERSION/swagger.json" -OutFile "openapi.json"
90+
91+ - name : Lint OpenAPI doc
92+ shell : pwsh
93+ run : |
94+ $LINT_RESULT = spectral lint -f json -F warn -D -q openapi.json | ConvertFrom-Json
95+
96+ if( $LINT_RESULT.Count -gt 0) {
97+ $LINT_RESULT | ForEach-Object {
98+ Write-Host ("code: " + $_.code)
99+ Write-Host ("message: " + $_.message)
100+ Write-Host ("path: " + $($_.path -join "."))
101+ Write-Host "`n"
102+ }
103+ exit 1
104+ }
81105
82106 - name : Publish test results
83107 if : ${{ !cancelled() }}
Original file line number Diff line number Diff line change 5656 $appsettings.Azure.KeyVault.VaultUri = "${{ env.AZURE_KEYVAULT_URI }}"
5757 $appsettings.Azure.KeyVault.SecretName = "${{ env.AZURE_KEYVAULT_SECRET_NAME }}"
5858 $appsettings | ConvertTo-Json -Depth 100 | Set-Content -Path "./src/AzureOpenAIProxy.ApiApp/appsettings.json" -Encoding UTF8 -Force
59+
60+ - name : Install Spectral Cli
61+ shell : bash
62+ run : |
63+ curl -L https://raw.github.com/stoplightio/spectral/master/scripts/install.sh | sh
5964
6065 - name : Restore NuGet packages
6166 shell : bash
@@ -85,13 +90,32 @@ jobs:
8590 run : |
8691 dotnet run --project ./src/AzureOpenAIProxy.AppHost &
8792
88- DOTNET_PID=$!
89-
9093 sleep 30
9194
9295 dotnet test ./test/AzureOpenAIProxy.PlaygroundApp.Tests -c Release --no-build --logger "trx" --collect:"XPlat Code Coverage"
9396
94- kill $DOTNET_PID
97+ - name : Create openapi.json
98+ shell : pwsh
99+ run : |
100+ $fileContent = Get-Content './src/AzureOpenAIProxy.ApiApp/Constants.cs'
101+ $API_VERSION = [regex]::Match($fileContent, 'public const string Version = "([^"]+)"').Groups[1].Value
102+
103+ Invoke-WebRequest -Uri "https://localhost:7001/swagger/$API_VERSION/swagger.json" -OutFile "openapi.json"
104+
105+ - name : Lint OpenAPI doc
106+ shell : pwsh
107+ run : |
108+ $LINT_RESULT = spectral lint -f json -F warn -D -q openapi.json | ConvertFrom-Json
109+
110+ if( $LINT_RESULT.Count -gt 0) {
111+ $LINT_RESULT | ForEach-Object {
112+ Write-Host ("code: " + $_.code)
113+ Write-Host ("message: " + $_.message)
114+ Write-Host ("path: " + $($_.path -join "."))
115+ Write-Host "`n"
116+ }
117+ exit 1
118+ }
95119
96120 - name : Publish test results
97121 uses : bibipkins/dotnet-test-reporter@main
You can’t perform that action at this time.
0 commit comments