[Staging] Unit 4 - Manage staged packages #702
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 | |
| runs-on: windows-2025-vs2026 | |
| timeout-minutes: 30 | |
| steps: | |
| - 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: | | |
| $repoRoot = "${{ github.workspace }}" | |
| $config = "$env:BuildConfiguration" | |
| # 1. Start Aspire Host | |
| Write-Host "=== Starting Aspire Host ===" | |
| $hostPid = & "$repoRoot\tools\Start-AspireHost.ps1" -Configuration $config -TrustDevCert -UnsafeAdminApiAuthBypassForTesting | |
| Write-Host "Aspire Host PID: $hostPid" | |
| try { | |
| # 2. Seed functional test data | |
| & "$repoRoot\tools\Seed-FunctionalTestData.ps1" -Configuration $config | |
| if ($LASTEXITCODE -ne 0) { throw "Seed failed with exit code $LASTEXITCODE" } | |
| # 3. Build functional tests | |
| & "$repoRoot\tests\Scripts\BuildGalleryFunctionalTests.ps1" -Configuration $config | |
| if ($LASTEXITCODE -ne 0) { throw "Build functional tests failed with exit code $LASTEXITCODE" } | |
| # 4. Run functional tests | |
| Write-Host "=== Running P0, P1, P2 and Admin API functional tests ===" | |
| $testDll = "$repoRoot\tests\NuGetGallery.FunctionalTests\bin\$config\net10.0\NuGetGallery.FunctionalTests.dll" | |
| $resultsDir = "$repoRoot\tests\TestResults" | |
| New-Item -ItemType Directory -Path $resultsDir -Force | Out-Null | |
| dotnet test $testDll ` | |
| --blame-hang-timeout 600s ` | |
| --filter "Category=P0Tests|Category=P1Tests|Category=P2Tests|Category=AdminApiTests" ` | |
| --logger "trx;LogFileName=FunctionalTests.trx" ` | |
| --results-directory $resultsDir | |
| $testExit = $LASTEXITCODE | |
| Write-Host "dotnet test exited with code $testExit" | |
| if (Test-Path $resultsDir) { | |
| Get-ChildItem -Recurse $resultsDir | ForEach-Object { Write-Host " Result file: $($_.FullName) ($($_.Length) bytes)" } | |
| } | |
| if ($testExit -ne 0) { throw "Functional tests failed with exit code $testExit" } | |
| } | |
| finally { | |
| # 5. Stop Aspire Host | |
| Write-Host "=== Stopping Aspire Host ===" | |
| & "$repoRoot\tools\Stop-AspireHost.ps1" -HostPid $hostPid | |
| } | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-aspire | |
| path: tests/TestResults/*.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 }}" |