@@ -16,7 +16,6 @@ permissions:
16
16
contents : write
17
17
issues : write
18
18
pull-requests : write
19
- # checks: write
20
19
21
20
jobs :
22
21
build-test :
@@ -44,11 +43,10 @@ jobs:
44
43
dotnet workload update
45
44
dotnet workload install aspire
46
45
47
- - name : Install SwashBuckle Cli
46
+ - name : Install Spectral Cli
48
47
shell : bash
49
48
run : |
50
- dotnet new tool-manifest
51
- dotnet tool install SwashBuckle.AspNetCore.Cli
49
+ curl -L https://raw.github.com/stoplightio/spectral/master/scripts/install.sh | sh
52
50
53
51
- name : Restore NuGet packages
54
52
shell : bash
@@ -61,16 +59,28 @@ jobs:
61
59
dotnet build
62
60
63
61
- name : Create openapi.json
64
- shell : bash
62
+ shell : pwsh
65
63
run : |
66
- API_VERSION=$(grep -oP 'public const string Version = "\K[^"]+' ./src/AzureOpenAIProxy.ApiApp/Constants.cs)
67
- dotnet swagger tofile --output ./openapi.json ./src/AzureOpenAIProxy.ApiApp/bin/Debug/net8.0/AzureOpenAIProxy.ApiApp.dll $API_VERSION
64
+ $fileContent = Get-Content './src/AzureOpenAIProxy.ApiApp/Constants.cs'
65
+ $API_VERSION = [regex]::Match($fileContent, 'public const string Version = "([^"]+)"').Groups[1].Value
66
+
67
+ $PROCESS = Start-Process -FilePath "dotnet" -ArgumentList "run --project src/AzureOpenAIProxy.AppHost" -PassThru
68
+
69
+ Start-Sleep -Seconds 30
70
+
71
+ Invoke-WebRequest -Uri "https://localhost:7001/swagger/$API_VERSION/swagger.json" -OutFile "openapi.json"
72
+
73
+ $PROCESS.Kill()
68
74
69
75
- name : Lint OpenAPI doc
70
- uses : stoplightio/spectral-action@latest
71
- with :
72
- file_glob : ' ./openapi.json'
73
- repo_token : ${{ secrets.GH_PAT_GRAINED }}
76
+ shell : pwsh
77
+ run : |
78
+ $LINT_RESULT = spectral lint -f json -F warn -D openapi.json
79
+
80
+ if( $LINT_RESULT.Count -ge 1) {
81
+ $LINT_RESULT
82
+ exit 1
83
+ }
74
84
75
85
- name : Install playwright
76
86
shell : pwsh
79
89
$installer = "$($playwright[0].Directory.FullName)/playwright.ps1"
80
90
& "$installer" install
81
91
82
-
83
92
- name : Run unit tests
84
93
shell : bash
85
94
run : |
0 commit comments