Skip to content

Commit 0f053e2

Browse files
authored
Merge branch 'main' into feature/225-system-message-params-tab
2 parents ed80e15 + 485cbe9 commit 0f053e2

34 files changed

+1873
-764
lines changed

.github/workflows/azure-dev-build-only.yml

+61-16
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ jobs:
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: |
@@ -53,17 +58,57 @@ jobs:
5358
run: |
5459
dotnet build
5560
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
5769
shell: bash
5870
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+
}
60105
61106
- name: Publish test results
62107
if: ${{ !cancelled() }}
63108
id: test-report
64109
uses: bibipkins/dotnet-test-reporter@main
65110
with:
66-
github-token: ${{ secrets.GH_PAT }}
111+
github-token: ${{ secrets.GH_PAT_GRAINED }}
67112
results-path: ./**/TestResults/**/*.trx
68113
# coverage-path: ./**/TestResults/**/*.xml
69114
# coverage-type: cobertura
@@ -73,18 +118,18 @@ jobs:
73118
post-new-comment: true
74119
comment-title: "Test Results"
75120

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
85130

86-
### Tests
131+
# ### Tests
87132

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 }} |

.github/workflows/azure-dev.yml

+49-4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ jobs:
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
@@ -65,17 +70,57 @@ jobs:
6570
- name: Build solution
6671
shell: bash
6772
run: |
68-
dotnet build
73+
dotnet build -c Release
74+
75+
- name: Install playwright
76+
shell: pwsh
77+
run: |
78+
$playwright = Get-ChildItem -File Microsoft.Playwright.dll -Path . -Recurse
79+
$installer = "$($playwright[0].Directory.FullName)/playwright.ps1"
80+
& "$installer" install
81+
82+
- name: Run unit tests
83+
shell: bash
84+
run: |
85+
dotnet test ./test/AzureOpenAIProxy.AppHost.Tests -c Release --no-build --logger "trx" --collect:"XPlat Code Coverage"
86+
dotnet test ./test/AzureOpenAIProxy.ApiApp.Tests -c Release --no-build --logger "trx" --collect:"XPlat Code Coverage"
6987
70-
- name: Test solution
88+
- name: Run integration tests
7189
shell: bash
7290
run: |
73-
dotnet test --logger "trx" --collect:"XPlat Code Coverage"
91+
dotnet run --project ./src/AzureOpenAIProxy.AppHost &
92+
93+
sleep 30
94+
95+
dotnet test ./test/AzureOpenAIProxy.PlaygroundApp.Tests -c Release --no-build --logger "trx" --collect:"XPlat Code Coverage"
96+
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+
}
74119
75120
- name: Publish test results
76121
uses: bibipkins/dotnet-test-reporter@main
77122
with:
78-
github-token: ${{ secrets.GITHUB_TOKEN }}
123+
github-token: ${{ secrets.GH_PAT_GRAINED }}
79124
results-path: ./**/TestResults/**/*.trx
80125
# coverage-path: ./**/TestResults/**/*.xml
81126
# coverage-type: cobertura

0 commit comments

Comments
 (0)