Remove test component #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Azure Dev - Build Only | |
on: | |
push: | |
branches: | |
- 'feature/*' | |
paths-ignore: | |
- '.github/**' | |
# pull_request_target: | |
pull_request: | |
branches: | |
- main | |
permissions: | |
id-token: write | |
contents: read | |
issues: write | |
pull-requests: write | |
jobs: | |
build-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: Install local certs | |
shell: pwsh | |
run: | | |
dotnet tool update -g linux-dev-certs | |
dotnet linux-dev-certs install | |
- name: Install Aspire workload | |
shell: pwsh | |
run: | | |
dotnet workload update | |
dotnet workload install aspire | |
- name: Install Spectral Cli | |
shell: bash | |
run: | | |
curl -L https://raw.github.com/stoplightio/spectral/master/scripts/install.sh | sh | |
- name: Restore NuGet packages | |
shell: bash | |
run: | | |
dotnet restore | |
- name: Build solution | |
shell: bash | |
run: | | |
dotnet build | |
- name: Install playwright | |
shell: pwsh | |
run: | | |
$playwright = Get-ChildItem -File Microsoft.Playwright.dll -Path . -Recurse | |
$installer = "$($playwright[0].Directory.FullName)/playwright.ps1" | |
& "$installer" install | |
- name: Run unit tests | |
shell: bash | |
run: | | |
dotnet test ./test/AzureOpenAIProxy.AppHost.Tests --no-build --logger "trx" --collect:"XPlat Code Coverage" | |
dotnet test ./test/AzureOpenAIProxy.ApiApp.Tests --no-build --logger "trx" --collect:"XPlat Code Coverage" | |
- name: Run integration tests | |
shell: bash | |
run: | | |
dotnet run --project ./src/AzureOpenAIProxy.AppHost & | |
sleep 30 | |
dotnet test ./test/AzureOpenAIProxy.PlaygroundApp.Tests --no-build --logger "trx" --collect:"XPlat Code Coverage" | |
- name: Create openapi.json | |
shell: pwsh | |
run: | | |
$API_VERSION = $(Get-Content ./src/AzureOpenAIProxy.ApiApp/appsettings.json | ConvertFrom-Json).OpenApi.DocVersion | |
Invoke-WebRequest -Uri "https://localhost:7001/swagger/$API_VERSION/swagger.json" -OutFile "openapi.json" | |
- name: Lint OpenAPI doc | |
shell: pwsh | |
run: | | |
$LINT_RESULT = spectral lint -f json -F warn -D -q openapi.json | ConvertFrom-Json | |
if( $LINT_RESULT.Count -gt 0) { | |
$LINT_RESULT | ForEach-Object { | |
Write-Host ("code: " + $_.code) | |
Write-Host ("message: " + $_.message) | |
Write-Host ("path: " + $($_.path -join ".")) | |
Write-Host "`n" | |
} | |
exit 1 | |
} | |
- name: Publish test results | |
if: ${{ !cancelled() }} | |
id: test-report | |
uses: bibipkins/dotnet-test-reporter@main | |
with: | |
github-token: ${{ secrets.GH_PAT_GRAINED }} | |
results-path: ./**/TestResults/**/*.trx | |
# coverage-path: ./**/TestResults/**/*.xml | |
# coverage-type: cobertura | |
# coverage-threshold: 0 | |
# coverage-threshold: 80 | |
allow-failed-tests: true | |
post-new-comment: true | |
comment-title: "Test Results" | |
# - name: Comment to issue | |
# if: ${{ !cancelled() && (github.event_name == 'pull_request_target' || github.event_name == 'pull_request') }} | |
# uses: actions-cool/issues-helper@v3 | |
# with: | |
# actions: "create-comment" | |
# token: ${{ secrets.GH_PAT_GRAINED }} | |
# issue-number: ${{ github.event.pull_request.number }} | |
# body: | | |
# ## Test Results | |
# ### Tests | |
# | :clipboard: Total | :heavy_check_mark: Passed | :x: Failed | :warning: Skipped | | |
# |-------------------|---------------------------|------------|-------------------| | |
# | ${{ steps.test-report.outputs.tests-total }} | ${{ steps.test-report.outputs.tests-passed }} | ${{ steps.test-report.outputs.tests-failed }} | ${{ steps.test-report.outputs.tests-skipped }} | |