43
43
dotnet workload update
44
44
dotnet workload install aspire
45
45
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
+
46
51
- name : Restore NuGet packages
47
52
shell : bash
48
53
run : |
@@ -53,17 +58,57 @@ jobs:
53
58
run : |
54
59
dotnet build
55
60
56
- - name : Test solution
61
+ - name : Install playwright
62
+ shell : pwsh
63
+ run : |
64
+ $playwright = Get-ChildItem -File Microsoft.Playwright.dll -Path . -Recurse
65
+ $installer = "$($playwright[0].Directory.FullName)/playwright.ps1"
66
+ & "$installer" install
67
+
68
+ - name : Run unit tests
57
69
shell : bash
58
70
run : |
59
- dotnet test --logger "trx" --collect:"XPlat Code Coverage"
71
+ dotnet test ./test/AzureOpenAIProxy.AppHost.Tests --no-build --logger "trx" --collect:"XPlat Code Coverage"
72
+ dotnet test ./test/AzureOpenAIProxy.ApiApp.Tests --no-build --logger "trx" --collect:"XPlat Code Coverage"
73
+
74
+ - name : Run integration tests
75
+ shell : bash
76
+ run : |
77
+ dotnet run --project ./src/AzureOpenAIProxy.AppHost &
78
+
79
+ sleep 30
80
+
81
+ dotnet test ./test/AzureOpenAIProxy.PlaygroundApp.Tests --no-build --logger "trx" --collect:"XPlat Code Coverage"
82
+
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
+ }
60
105
61
106
- name : Publish test results
62
107
if : ${{ !cancelled() }}
63
108
id : test-report
64
109
uses : bibipkins/dotnet-test-reporter@main
65
110
with :
66
- github-token : ${{ secrets.GH_PAT }}
111
+ github-token : ${{ secrets.GH_PAT_GRAINED }}
67
112
results-path : ./**/TestResults/**/*.trx
68
113
# coverage-path: ./**/TestResults/**/*.xml
69
114
# coverage-type: cobertura
@@ -73,18 +118,18 @@ jobs:
73
118
post-new-comment : true
74
119
comment-title : " Test Results"
75
120
76
- - name : Comment to issue
77
- if : ${{ !cancelled() && (github.event_name == 'pull_request_target' || github.event_name == 'pull_request') }}
78
- uses : actions-cool/issues-helper@v3
79
- with :
80
- actions : " create-comment"
81
- token : ${{ secrets.GH_PAT }}
82
- issue-number : ${{ github.event.pull_request.number }}
83
- body : |
84
- ## Test Results
121
+ # - name: Comment to issue
122
+ # if: ${{ !cancelled() && (github.event_name == 'pull_request_target' || github.event_name == 'pull_request') }}
123
+ # uses: actions-cool/issues-helper@v3
124
+ # with:
125
+ # actions: "create-comment"
126
+ # token: ${{ secrets.GH_PAT_GRAINED }}
127
+ # issue-number: ${{ github.event.pull_request.number }}
128
+ # body: |
129
+ # ## Test Results
85
130
86
- ### Tests
131
+ # ### Tests
87
132
88
- | :clipboard: Total | :heavy_check_mark: Passed | :x: Failed | :warning: Skipped |
89
- |-------------------|---------------------------|------------|-------------------|
90
- | ${{ steps.test-report.outputs.tests-total }} | ${{ steps.test-report.outputs.tests-passed }} | ${{ steps.test-report.outputs.tests-failed }} | ${{ steps.test-report.outputs.tests-skipped }} |
133
+ # | :clipboard: Total | :heavy_check_mark: Passed | :x: Failed | :warning: Skipped |
134
+ # |-------------------|---------------------------|------------|-------------------|
135
+ # | ${{ steps.test-report.outputs.tests-total }} | ${{ steps.test-report.outputs.tests-passed }} | ${{ steps.test-report.outputs.tests-failed }} | ${{ steps.test-report.outputs.tests-skipped }} |
0 commit comments