-
Notifications
You must be signed in to change notification settings - Fork 0
Added github workflows. #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
81a9c72
Added github workflows.
mkrueger 99a048c
Initial plan
Copilot 2408472
Fix informational_version double-+ when tag already has build metadata
Copilot 919a109
Added uninstallation instructions in README.
mkrueger 1d72917
Added "preview" suffix.
mkrueger 0f4b096
Added packages for branches in workflow
mkrueger 3dae379
Update .pipelines/CosmosDB-Shell-Official.yml
mkrueger 653d3bf
Update .github/workflows/package-branches.yml
mkrueger 4da789b
Update .github/workflows/package-branches.yml
mkrueger 599194e
Add branch package workflow and fix RID packaging
mkrueger 1ba73f0
Initial plan
Copilot d588f59
Fix packagesToPush escaping and add any-RID guard to package-unsigned…
Copilot fe0a525
Fix workflow file.
mkrueger 494f24a
Split package artifacts by platform in workflows
mkrueger ce8b13a
Renamed package file.
mkrueger bf171ea
Package now runs on all branches.
mkrueger 44dde5a
Fixed version update in build.
mkrueger a8cc754
Consolidate CI build/test and packaging into one workflow job
mkrueger f02d27c
Fix pipeline.
mkrueger 128f116
Bump required .NET to 10.
mkrueger 4e74a6e
Align workflow docs and package version metadata
mkrueger c50e7de
ci: address workflow review comments
mkrueger c7f3aef
feat: add Component Governance - Component Detection task to pipeline
sevoku 0adb738
fix: preserve base tool package in artifacts
mkrueger d4f87b3
ci: publish base tool package to internal feed
mkrueger 63d19bf
Fix unit test error.
mkrueger 67f25ab
test: align version assertion with display version
mkrueger de0fff8
ci: harden tool package publishing
mkrueger 18a4bb1
Fix workflow.
mkrueger 85dc461
ci: fix pack step to restore all RIDs before packaging
mkrueger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <configuration> | ||
| <packageSources> | ||
| <clear /> | ||
| <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> | ||
| </packageSources> | ||
| </configuration> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,287 @@ | ||
| name: Validate And Package | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - "**" | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ci-${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| BUILD_CONFIGURATION: Release | ||
|
|
||
| jobs: | ||
| build-test-package: | ||
| if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/') || github.event_name == 'workflow_dispatch' | ||
| runs-on: windows-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup .NET SDK | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: global.json | ||
| cache: true | ||
| cache-dependency-path: | | ||
| global.json | ||
| Directory.Packages.props | ||
| **/*.csproj | ||
|
|
||
| - name: Restore | ||
| run: dotnet restore CosmosDBShell.sln --configfile .github/nuget.github.config | ||
|
|
||
| - name: Build solution | ||
| run: dotnet build CosmosDBShell.sln --configuration $env:BUILD_CONFIGURATION --no-restore | ||
| shell: pwsh | ||
|
|
||
| - name: Test solution | ||
| run: >- | ||
| dotnet test CosmosDBShell.sln | ||
| --configuration $env:BUILD_CONFIGURATION | ||
| --no-build | ||
| --no-restore | ||
| --logger "trx;LogFileName=test-results.trx" | ||
| --results-directory TestResults | ||
| --collect "Code coverage" | ||
| shell: pwsh | ||
|
|
||
| - name: Run fuzzer smoke test | ||
| working-directory: CosmosDBShell.Fuzzer | ||
| run: dotnet run --configuration $env:BUILD_CONFIGURATION --no-build --no-restore -- --all | ||
| shell: pwsh | ||
|
|
||
| - name: Fail if fuzzer crash findings exist | ||
| shell: pwsh | ||
| run: | | ||
| $crashes = Get-ChildItem -Path CosmosDBShell.Fuzzer/findings -Filter 'crash_*.txt' -ErrorAction SilentlyContinue | ||
| if ($crashes -and $crashes.Count -gt 0) { | ||
| Write-Error "Fuzzer recorded $($crashes.Count) crash(es). See the 'fuzz-findings' artifact for details." | ||
| exit 1 | ||
| } | ||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: test-results | ||
| path: TestResults | ||
| if-no-files-found: ignore | ||
|
|
||
| - name: Upload fuzzer findings | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: fuzz-findings | ||
| path: CosmosDBShell.Fuzzer/findings | ||
| if-no-files-found: ignore | ||
|
|
||
| - name: Compute version properties | ||
| if: github.event_name != 'pull_request' | ||
| id: version | ||
| shell: pwsh | ||
| run: | | ||
| $runNumber = [int]"${{ github.run_number }}" | ||
| $assemblyVersion = "1.0.$runNumber" | ||
| $branchName = "${{ github.ref_name }}" | ||
| $branchLabel = $branchName.ToLowerInvariant() | ||
| $branchLabel = $branchLabel -replace '[^0-9a-z-]', '-' | ||
| $branchLabel = $branchLabel -replace '-+', '-' | ||
| $branchLabel = $branchLabel.Trim('-') | ||
|
|
||
| if ([string]::IsNullOrWhiteSpace($branchLabel)) { | ||
| $branchLabel = 'branch' | ||
| } | ||
|
|
||
| if ($branchLabel.Length -gt 40) { | ||
| $branchLabel = $branchLabel.Substring(0, 40).Trim('-') | ||
| } | ||
|
|
||
| $packageVersion = "$assemblyVersion-preview.$branchLabel" | ||
| $fileVersion = "1.0.$runNumber.0" | ||
| $infoVersion = "$packageVersion+${{ github.sha }}" | ||
|
|
||
| "assembly_version=$assemblyVersion" >> $env:GITHUB_OUTPUT | ||
| "package_version=$packageVersion" >> $env:GITHUB_OUTPUT | ||
| "file_version=$fileVersion" >> $env:GITHUB_OUTPUT | ||
| "informational_version=$infoVersion" >> $env:GITHUB_OUTPUT | ||
| "branch_label=$branchLabel" >> $env:GITHUB_OUTPUT | ||
| "artifact_suffix=$branchLabel-${{ github.run_number }}" >> $env:GITHUB_OUTPUT | ||
|
|
||
|
mkrueger marked this conversation as resolved.
|
||
| - name: Publish runtime artifacts | ||
| if: github.event_name != 'pull_request' | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $rids = @('win-x64', 'linux-x64', 'linux-arm64', 'osx-x64', 'osx-arm64') | ||
| foreach ($rid in $rids) { | ||
| dotnet restore CosmosDBShell/CosmosDBShell.csproj ` | ||
| --configfile .github/nuget.github.config ` | ||
| -r $rid | ||
|
|
||
| if ($LASTEXITCODE -ne 0) { | ||
| throw "RID restore failed for $rid with exit code $LASTEXITCODE." | ||
| } | ||
|
|
||
| dotnet publish CosmosDBShell/CosmosDBShell.csproj ` | ||
| --configuration $env:BUILD_CONFIGURATION ` | ||
| --no-restore ` | ||
| -r $rid ` | ||
| --output "out/$rid" ` | ||
| /p:Version=${{ steps.version.outputs.assembly_version }} ` | ||
| /p:FileVersion=${{ steps.version.outputs.file_version }} ` | ||
| /p:InformationalVersion=${{ steps.version.outputs.informational_version }} | ||
|
mkrueger marked this conversation as resolved.
mkrueger marked this conversation as resolved.
|
||
|
|
||
|
mkrueger marked this conversation as resolved.
|
||
| if ($LASTEXITCODE -ne 0) { | ||
| throw "RID publish failed for $rid with exit code $LASTEXITCODE." | ||
| } | ||
| } | ||
|
|
||
| - name: Pack NuGet artifacts | ||
| if: github.event_name != 'pull_request' | ||
| shell: pwsh | ||
| run: | | ||
| New-Item -ItemType Directory -Path out/nupkg -Force | Out-Null | ||
| dotnet pack CosmosDBShell/CosmosDBShell.csproj ` | ||
| --configuration $env:BUILD_CONFIGURATION ` | ||
| --no-build ` | ||
| --no-restore ` | ||
| --output out/nupkg ` | ||
| /p:PackageVersion=${{ steps.version.outputs.package_version }} ` | ||
| /p:Version=${{ steps.version.outputs.assembly_version }} ` | ||
| /p:FileVersion=${{ steps.version.outputs.file_version }} ` | ||
| /p:InformationalVersion=${{ steps.version.outputs.informational_version }} ` | ||
| /p:ContinuousIntegrationBuild=true | ||
|
|
||
| - name: Validate NuGet package set | ||
| if: github.event_name != 'pull_request' | ||
| shell: pwsh | ||
| run: | | ||
| $pkgDir = Join-Path $pwd 'out/nupkg' | ||
| $ridPatterns = @( | ||
| 'CosmosDBShell.win-x64.*.nupkg', | ||
| 'CosmosDBShell.linux-x64.*.nupkg', | ||
| 'CosmosDBShell.linux-arm64.*.nupkg', | ||
| 'CosmosDBShell.osx-x64.*.nupkg', | ||
| 'CosmosDBShell.osx-arm64.*.nupkg' | ||
| ) | ||
|
|
||
| foreach ($pattern in $ridPatterns) { | ||
| $matches = Get-ChildItem -Path (Join-Path $pkgDir $pattern) -ErrorAction SilentlyContinue | ||
| if (-not $matches -or $matches.Count -eq 0) { | ||
| Write-Error "Expected package was not generated: $pattern" | ||
| exit 1 | ||
| } | ||
| } | ||
|
|
||
| $allPackages = Get-ChildItem -Path (Join-Path $pkgDir 'CosmosDBShell.*.nupkg') -ErrorAction SilentlyContinue | ||
| $pointerPackages = $allPackages | Where-Object { | ||
| $_.Name -notmatch '^CosmosDBShell\.(win-x64|linux-x64|linux-arm64|osx-x64|osx-arm64)\..+\.nupkg$' | ||
| } | ||
|
|
||
| if (-not $pointerPackages -or $pointerPackages.Count -ne 1) { | ||
| $names = @($pointerPackages | ForEach-Object { $_.Name }) | ||
| Write-Error "Expected exactly one pointer package (non-RID). Found: $($names -join ', ')" | ||
|
mkrueger marked this conversation as resolved.
|
||
| exit 1 | ||
| } | ||
|
|
||
| $anyMatches = Get-ChildItem -Path (Join-Path $pkgDir 'CosmosDBShell.any.*.nupkg') -ErrorAction SilentlyContinue | ||
| if ($anyMatches -and $anyMatches.Count -gt 0) { | ||
| $names = $anyMatches | ForEach-Object { $_.Name } | Sort-Object | ||
| Write-Error "Unexpected any-RID package(s) found: $($names -join ', ')" | ||
| exit 1 | ||
| } | ||
|
|
||
| - name: List packaged NuGet files | ||
| if: github.event_name != 'pull_request' | ||
| shell: pwsh | ||
| run: | | ||
| Get-ChildItem -Path out/nupkg -Filter *.nupkg -File | Sort-Object Name | ForEach-Object { | ||
| Write-Host " - $($_.Name) [$($_.Length) bytes]" | ||
| } | ||
|
|
||
| - name: Write package install summary | ||
| if: github.event_name != 'pull_request' | ||
| shell: pwsh | ||
| run: | | ||
| $summary = $env:GITHUB_STEP_SUMMARY | ||
| $version = '${{ steps.version.outputs.package_version }}' | ||
| $artifactSuffix = '${{ steps.version.outputs.artifact_suffix }}' | ||
| $branchName = '${{ github.ref_name }}' | ||
| $lines = @( | ||
| '## NuGet packages', | ||
| '', | ||
| ('- Branch: `' + $branchName + '`'), | ||
| ('- Preview version: `' + $version + '`'), | ||
| '', | ||
| 'Artifacts:', | ||
| ('- `CosmosDBShell-pointer-' + $artifactSuffix + '`'), | ||
| ('- `CosmosDBShell-win-x64-' + $artifactSuffix + '`'), | ||
| ('- `CosmosDBShell-linux-x64-' + $artifactSuffix + '`'), | ||
| ('- `CosmosDBShell-linux-arm64-' + $artifactSuffix + '`'), | ||
| ('- `CosmosDBShell-osx-x64-' + $artifactSuffix + '`'), | ||
| ('- `CosmosDBShell-osx-arm64-' + $artifactSuffix + '`'), | ||
| '', | ||
| 'Download the pointer package artifact and the artifact for your runtime, extract both `.nupkg` files to the same local folder, then install the base package:', | ||
| '', | ||
| '```powershell', | ||
| 'dotnet tool install --global CosmosDBShell --add-source C:\path\to\nupkgs --version ' + $version, | ||
| '```' | ||
| ) | ||
|
sevoku marked this conversation as resolved.
|
||
| $lines -join "`n" | Out-File -FilePath $summary -Encoding utf8 -Append | ||
|
|
||
| - name: Upload pointer package | ||
| if: github.event_name != 'pull_request' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: CosmosDBShell-pointer-${{ steps.version.outputs.artifact_suffix }} | ||
| path: out/nupkg/CosmosDBShell.${{ steps.version.outputs.package_version }}.nupkg | ||
| if-no-files-found: error | ||
|
|
||
| - name: Upload win-x64 package | ||
| if: github.event_name != 'pull_request' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: CosmosDBShell-win-x64-${{ steps.version.outputs.artifact_suffix }} | ||
| path: out/nupkg/CosmosDBShell.win-x64.${{ steps.version.outputs.package_version }}.nupkg | ||
| if-no-files-found: error | ||
|
|
||
| - name: Upload linux-x64 package | ||
| if: github.event_name != 'pull_request' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: CosmosDBShell-linux-x64-${{ steps.version.outputs.artifact_suffix }} | ||
| path: out/nupkg/CosmosDBShell.linux-x64.${{ steps.version.outputs.package_version }}.nupkg | ||
| if-no-files-found: error | ||
|
|
||
| - name: Upload linux-arm64 package | ||
| if: github.event_name != 'pull_request' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: CosmosDBShell-linux-arm64-${{ steps.version.outputs.artifact_suffix }} | ||
| path: out/nupkg/CosmosDBShell.linux-arm64.${{ steps.version.outputs.package_version }}.nupkg | ||
| if-no-files-found: error | ||
|
|
||
| - name: Upload osx-x64 package | ||
| if: github.event_name != 'pull_request' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: CosmosDBShell-osx-x64-${{ steps.version.outputs.artifact_suffix }} | ||
| path: out/nupkg/CosmosDBShell.osx-x64.${{ steps.version.outputs.package_version }}.nupkg | ||
| if-no-files-found: error | ||
|
|
||
| - name: Upload osx-arm64 package | ||
| if: github.event_name != 'pull_request' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: CosmosDBShell-osx-arm64-${{ steps.version.outputs.artifact_suffix }} | ||
| path: out/nupkg/CosmosDBShell.osx-arm64.${{ steps.version.outputs.package_version }}.nupkg | ||
| if-no-files-found: error | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.