Add Aspire-hosted Playwright test harness #695
This file contains hidden or 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: NuGetGallery CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - dev | |
| - main | |
| schedule: | |
| - cron: '0 12 * * 1-5' # Weekdays at 8 AM Eastern (UTC 12:00) | |
| workflow_dispatch: | |
| env: | |
| BuildConfiguration: Release | |
| CommonAssemblyVersion: '5.0.0' | |
| GalleryAssemblyVersion: '5.0.0' | |
| JobsAssemblyVersion: '5.0.0' | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_NOLOGO: true | |
| jobs: | |
| common: | |
| name: NuGet.Server.Common build and test | |
| runs-on: windows-2025-vs2026 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Build | |
| shell: pwsh | |
| run: | | |
| $buildNumber = "${{ github.run_number }}" | |
| $branch = "${{ github.ref_name }}" -replace '[_/]', '-' | |
| .\build.ps1 ` | |
| -Configuration $env:BuildConfiguration ` | |
| -BuildNumber $buildNumber ` | |
| -SkipArtifacts -SkipGallery -SkipJobs ` | |
| -CommonAssemblyVersion $env:CommonAssemblyVersion ` | |
| -CommonPackageVersion "$env:CommonAssemblyVersion-$branch-$buildNumber" ` | |
| -GalleryAssemblyVersion $env:GalleryAssemblyVersion ` | |
| -GalleryPackageVersion "$env:GalleryAssemblyVersion-$branch-$buildNumber" ` | |
| -JobsAssemblyVersion $env:JobsAssemblyVersion ` | |
| -JobsPackageVersion "$env:JobsAssemblyVersion-$branch-$buildNumber" ` | |
| -Branch "${{ github.ref_name }}" ` | |
| -CommitSHA "${{ github.sha }}" | |
| - name: Run tests | |
| shell: pwsh | |
| run: | | |
| .\test.ps1 ` | |
| -Configuration $env:BuildConfiguration ` | |
| -BuildNumber ${{ github.run_number }} ` | |
| -SkipGallery -SkipJobs | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-common | |
| path: Results.Common.*.xml | |
| gallery: | |
| name: NuGetGallery build and test | |
| runs-on: windows-2025-vs2026 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Verify Bootstrap output is up to date | |
| shell: pwsh | |
| run: | | |
| .\tools\Build-Bootstrap.ps1 | |
| $diff = git diff --name-only | |
| if ($diff) { | |
| Write-Error "Bootstrap output is out of date. Run .\tools\Build-Bootstrap.ps1 and commit the changes." | |
| git diff --stat | |
| exit 1 | |
| } | |
| Write-Host "Bootstrap output is up to date." | |
| - name: Build | |
| shell: pwsh | |
| run: | | |
| $buildNumber = "${{ github.run_number }}" | |
| $branch = "${{ github.ref_name }}" -replace '[_/]', '-' | |
| .\build.ps1 ` | |
| -Configuration $env:BuildConfiguration ` | |
| -BuildNumber $buildNumber ` | |
| -SkipArtifacts -SkipCommon -SkipJobs ` | |
| -CommonAssemblyVersion $env:CommonAssemblyVersion ` | |
| -CommonPackageVersion "$env:CommonAssemblyVersion-$branch-$buildNumber" ` | |
| -GalleryAssemblyVersion $env:GalleryAssemblyVersion ` | |
| -GalleryPackageVersion "$env:GalleryAssemblyVersion-$branch-$buildNumber" ` | |
| -JobsAssemblyVersion $env:JobsAssemblyVersion ` | |
| -JobsPackageVersion "$env:JobsAssemblyVersion-$branch-$buildNumber" ` | |
| -Branch "${{ github.ref_name }}" ` | |
| -CommitSHA "${{ github.sha }}" | |
| - name: Run tests | |
| shell: pwsh | |
| run: | | |
| .\test.ps1 ` | |
| -Configuration $env:BuildConfiguration ` | |
| -BuildNumber ${{ github.run_number }} ` | |
| -SkipCommon -SkipJobs | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-gallery | |
| path: Results.Gallery.*.xml | |
| jobs: | |
| name: NuGet.Jobs build and test | |
| runs-on: windows-2025-vs2026 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Build | |
| shell: pwsh | |
| run: | | |
| $buildNumber = "${{ github.run_number }}" | |
| $branch = "${{ github.ref_name }}" -replace '[_/]', '-' | |
| .\build.ps1 ` | |
| -Configuration $env:BuildConfiguration ` | |
| -BuildNumber $buildNumber ` | |
| -SkipArtifacts -SkipCommon -SkipGallery ` | |
| -CommonAssemblyVersion $env:CommonAssemblyVersion ` | |
| -CommonPackageVersion "$env:CommonAssemblyVersion-$branch-$buildNumber" ` | |
| -GalleryAssemblyVersion $env:GalleryAssemblyVersion ` | |
| -GalleryPackageVersion "$env:GalleryAssemblyVersion-$branch-$buildNumber" ` | |
| -JobsAssemblyVersion $env:JobsAssemblyVersion ` | |
| -JobsPackageVersion "$env:JobsAssemblyVersion-$branch-$buildNumber" ` | |
| -Branch "${{ github.ref_name }}" ` | |
| -CommitSHA "${{ github.sha }}" | |
| - name: Run tests | |
| shell: pwsh | |
| run: | | |
| .\test.ps1 ` | |
| -Configuration $env:BuildConfiguration ` | |
| -BuildNumber ${{ github.run_number }} ` | |
| -SkipCommon -SkipGallery | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-jobs | |
| path: Results.Jobs.*.xml | |
| statslogparser: | |
| name: StatsLogParser build and test | |
| runs-on: windows-2025-vs2026 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Install Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install tools and run tests | |
| shell: cmd | |
| working-directory: python/StatsLogParser | |
| run: | | |
| python -m pip install --user pipx | |
| set PATH=%USERPROFILE%\.local\bin;%PATH% | |
| pipx install poetry | |
| poetry install | |
| poetry build | |
| poetry run pytest tests/ --cov loginterpretation --cov-report html --junitxml=../../Results.StatsLogParser.xml | |
| - name: Upload StatsLogParser artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: StatsLogParser | |
| path: python/StatsLogParser/dist | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-statslogparser | |
| path: Results.StatsLogParser.xml | |
| aspire: | |
| name: Aspire Functional Tests | |
| needs: playwright | |
| if: ${{ always() }} | |
| runs-on: windows-2025-vs2026 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Require Aspire Playwright Tests | |
| shell: pwsh | |
| env: | |
| PLAYWRIGHT_RESULT: ${{ needs.playwright.result }} | |
| run: | | |
| if ($env:PLAYWRIGHT_RESULT -ne 'success') { | |
| throw "Aspire Playwright Tests must pass. Result: $env:PLAYWRIGHT_RESULT" | |
| } | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Build AppHost | |
| shell: pwsh | |
| # WARNING: UnsafeAdminApiAuthBypassForTesting enables self-signed test tokens for functional tests. | |
| # This property must NEVER be used in release or deployment builds. | |
| run: dotnet build src\NuGetGallery.AppHost\NuGetGallery.AppHost.csproj -c $env:BuildConfiguration /p:UnsafeAdminApiAuthBypassForTesting=true | |
| - name: Setup Dev Environment | |
| shell: pwsh | |
| run: .\tools\Setup-DevEnvironment.ps1 | |
| - name: Run Aspire Functional Tests | |
| shell: pwsh | |
| env: | |
| ConfigurationFilePath: ${{ github.workspace }}\tests\NuGetGallery.FunctionalTests\settings.CI.json | |
| run: .\tests\Scripts\RunAspireFunctionalTests.ps1 -Configuration $env:BuildConfiguration -TrustDevCert -UnsafeAdminApiAuthBypassForTesting | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-aspire | |
| path: tests/TestResults/*.trx | |
| playwright: | |
| name: Aspire Playwright Tests | |
| runs-on: windows-2025-vs2026 | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Build AppHost | |
| shell: pwsh | |
| run: dotnet build src\NuGetGallery.AppHost\NuGetGallery.AppHost.csproj -c $env:BuildConfiguration | |
| - name: Setup Dev Environment | |
| shell: pwsh | |
| run: .\tools\Setup-DevEnvironment.ps1 | |
| - name: Run Aspire Playwright Tests | |
| shell: pwsh | |
| run: .\tests\Scripts\RunGalleryPlaywrightTests.ps1 -Configuration $env:BuildConfiguration | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-playwright | |
| path: tests/TestResults/PlaywrightTests.trx | |
| artifacts: | |
| name: Build artifacts | |
| runs-on: windows-2025-vs2026 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Build | |
| shell: powershell | |
| run: | | |
| $buildNumber = "${{ github.run_number }}" | |
| $branch = "${{ github.ref_name }}" -replace '[_/]', '-' | |
| .\build.ps1 ` | |
| -Configuration $env:BuildConfiguration ` | |
| -BuildNumber $buildNumber ` | |
| -CommonAssemblyVersion $env:CommonAssemblyVersion ` | |
| -CommonPackageVersion "$env:CommonAssemblyVersion-$branch-$buildNumber" ` | |
| -GalleryAssemblyVersion $env:GalleryAssemblyVersion ` | |
| -GalleryPackageVersion "$env:GalleryAssemblyVersion-$branch-$buildNumber" ` | |
| -JobsAssemblyVersion $env:JobsAssemblyVersion ` | |
| -JobsPackageVersion "$env:JobsAssemblyVersion-$branch-$buildNumber" ` | |
| -Branch "${{ github.ref_name }}" ` | |
| -CommitSHA "${{ github.sha }}" |