Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
81a9c72
Added github workflows.
mkrueger Mar 18, 2026
99a048c
Initial plan
Copilot Mar 20, 2026
2408472
Fix informational_version double-+ when tag already has build metadata
Copilot Mar 20, 2026
919a109
Added uninstallation instructions in README.
mkrueger Mar 20, 2026
1d72917
Added "preview" suffix.
mkrueger Mar 23, 2026
0f4b096
Added packages for branches in workflow
mkrueger Mar 23, 2026
3dae379
Update .pipelines/CosmosDB-Shell-Official.yml
mkrueger Mar 23, 2026
653d3bf
Update .github/workflows/package-branches.yml
mkrueger Mar 23, 2026
4da789b
Update .github/workflows/package-branches.yml
mkrueger Mar 23, 2026
599194e
Add branch package workflow and fix RID packaging
mkrueger Mar 23, 2026
1ba73f0
Initial plan
Copilot Mar 23, 2026
d588f59
Fix packagesToPush escaping and add any-RID guard to package-unsigned…
Copilot Mar 23, 2026
fe0a525
Fix workflow file.
mkrueger Mar 23, 2026
494f24a
Split package artifacts by platform in workflows
mkrueger Mar 23, 2026
ce8b13a
Renamed package file.
mkrueger Mar 23, 2026
bf171ea
Package now runs on all branches.
mkrueger Mar 23, 2026
44dde5a
Fixed version update in build.
mkrueger Mar 23, 2026
a8cc754
Consolidate CI build/test and packaging into one workflow job
mkrueger Mar 24, 2026
f02d27c
Fix pipeline.
mkrueger Mar 25, 2026
128f116
Bump required .NET to 10.
mkrueger Mar 27, 2026
4e74a6e
Align workflow docs and package version metadata
mkrueger Mar 27, 2026
c50e7de
ci: address workflow review comments
mkrueger Apr 16, 2026
c7f3aef
feat: add Component Governance - Component Detection task to pipeline
sevoku Apr 16, 2026
0adb738
fix: preserve base tool package in artifacts
mkrueger Apr 16, 2026
d4f87b3
ci: publish base tool package to internal feed
mkrueger Apr 16, 2026
63d19bf
Fix unit test error.
mkrueger Apr 16, 2026
67f25ab
test: align version assertion with display version
mkrueger Apr 16, 2026
de0fff8
ci: harden tool package publishing
mkrueger Apr 16, 2026
18a4bb1
Fix workflow.
mkrueger Apr 16, 2026
85dc461
ci: fix pack step to restore all RIDs before packaging
mkrueger Apr 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/nuget.github.config
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>
287 changes: 287 additions & 0 deletions .github/workflows/validate-and-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
name: Validate And Package

on:
pull_request:
push:
branches:
- "**"
Comment thread
mkrueger marked this conversation as resolved.
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

Comment thread
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 }}
Comment thread
mkrueger marked this conversation as resolved.
Comment thread
mkrueger marked this conversation as resolved.

Comment thread
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 ', ')"
Comment thread
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,
'```'
)
Comment thread
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
Loading
Loading