From 714676e67832738c81447f0bbb8eaad997e4e6f0 Mon Sep 17 00:00:00 2001 From: "Kenneth Omondi (from Dev Box)" Date: Tue, 23 Jul 2024 15:00:17 +0300 Subject: [PATCH 1/5] ci(scripts): Remove unused powershell scripts. --- scripts/IncrementMinorVersion.ps1 | 63 ------------------ scripts/generateTypeSummary.ps1 | 106 ------------------------------ 2 files changed, 169 deletions(-) delete mode 100644 scripts/IncrementMinorVersion.ps1 delete mode 100644 scripts/generateTypeSummary.ps1 diff --git a/scripts/IncrementMinorVersion.ps1 b/scripts/IncrementMinorVersion.ps1 deleted file mode 100644 index 737922912ac..00000000000 --- a/scripts/IncrementMinorVersion.ps1 +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. - -<# -.Synopsis - Increment the minor version string in the csproj if the major, - minor, or patch version hasn't been manually updated. -.Description - Assumptions: - Targets Microsoft.Graph.csproj - This script assumes it is run from the repo root. - VersionPrefix is set in the first property group in the csproj. - Major or patch update versions are manually set by dev. - Minor version is typically auto-incremented. - -#> - -$fullFileName = Join-Path $PWD.ToString() "src" "Microsoft.Graph" "Microsoft.Graph.csproj" - -# Read .csproj file as UTF-8 -$xmlDoc = New-Object -TypeName XML -$utf8Encoding = (New-Object System.Text.UTF8Encoding($false)) -$streamReader = New-Object System.IO.StreamReader($fullFileName, $utf8Encoding, $false) -$xmlDoc.Load($streamReader) -$streamReader.Close() - -# Assumption: VersionPrefix is set in the first property group. -$versionPrefixString = $xmlDoc.Project.PropertyGroup[0].VersionPrefix - -# System.Version, get the version prefix. -$currentProjectVersion = [version]"$versionPrefixString" - -# Get the current version in SDK. -$majorVersion = $currentProjectVersion.Major.ToString() -$minorVersion = $currentProjectVersion.Minor.ToString() -$patchVersion = $currentProjectVersion.Build.ToString() - -# Get the current version of the latest public NuGet package. -$url = "https://api.nuget.org/v3/registration5-gz-semver2/microsoft.graph/index.json" -$nugetIndex = Invoke-RestMethod -Uri $url -Method Get -$currentPublishedVersion = $nugetIndex.items[$nugetIndex.items.Count-1].upper -$publishedMajorVersion = $currentPublishedVersion.Split(".")[0] -$publishedMinorVersion = $currentPublishedVersion.Split(".")[1] -$publishedPatchVersion = $currentPublishedVersion.Split(".")[2] - -# Do not update the minor version if the version has been manually updated. -if ($majorVersion -ne $publishedMajorVersion -or ` - $minorVersion -ne $publishedMinorVersion -or ` - $patchVersion -ne $publishedPatchVersion) { - Write-Host "The version has been manually incremented. We will not auto-increment minor version." - Exit 0; -} - -# Increment minor version and set patchVersion to zero. -$minorVersion = ($currentProjectVersion.Minor + 1).ToString() -$patchVersion = "0" - -$updatedVersionPrefixString = "{0}.{1}.{2}" -f $majorVersion, $minorVersion, $patchVersion -$xmlDoc.Project.PropertyGroup[0].VersionPrefix = $updatedVersionPrefixString - -$xmlDoc.Save($fullFileName) - -Write-Host "Version incremented from $versionPrefixString to $updatedVersionPrefixString" diff --git a/scripts/generateTypeSummary.ps1 b/scripts/generateTypeSummary.ps1 deleted file mode 100644 index 1f32b389eb4..00000000000 --- a/scripts/generateTypeSummary.ps1 +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. - -<# -.SYNOPSIS - Creates a type summary from DLL - -.DESCRIPTION - Takes a Microsoft.Graph DLL and prints types as a flat text file - - Selects types that fall under Microsoft.Graph namespace - - Drops version information from full generic type names - - Types are sorted as enums, interfaces and classes - - Each type of types are sorted among themselves by name - - Properties and methods are also sorted by their name - - For deterministic results, overloaded methods are also sorted by their argument list - -.PARAMETER dllPath - Full path to Microsoft.Graph.dll - -.PARAMETER outputPath - Full Path to type summary file - -.EXAMPLE - PS C:\> .\generateTypeSummary.ps1 -dllPath C:\test\Microsoft.Graph.dll -outputPath C:\test\typeSummary.txt -#> - -Param( - [string]$dllPath, - [string]$outputPath -) - -$twoSpaces = " " -$fourSpaces = " " - -$assembly = [System.Reflection.Assembly]::LoadFrom($dllPath) -$types = $assembly.GetTypes() | - Where-Object { $_.FullName.StartsWith("Microsoft.Graph") } | - Sort-Object { $_.FullName } - -function normalize([string]$str) -{ - # removes package version information for cleaner diffs - # e.g. , Microsoft.Graph, Version=3.12.0.0, Culture=neutral, PublicKeyToken=null - return $str -replace ", [\w\.]+, Version=\d+\.\d+\.\d+\.\d+, Culture=neutral, PublicKeyToken=(null|[a-f0-9]+)","" -} - -$writer = [System.IO.File]::CreateText($outputPath) - -try -{ - # enum types - foreach ($type in $types | Where-Object { $_.IsEnum }) - { - $writer.WriteLine("enum " + $type.FullName) - - foreach ($enumName in $type.GetEnumNames()) - { - $writer.WriteLine($twoSpaces + $enumName) - } - } - - # interface and class types - foreach ($type in $types | - Where-Object { !$_.FullName.Contains("+") -and ($_.IsClass -or $_.IsInterface) } | - Sort-Object { $_.IsInterface,$_.Name }) - { - # type declaration line with optional base type - $declaration = "class " - if ($type.IsInterface) - { - $declaration = "interface " - } - - $declaration += $type.FullName - if ($type.BaseType -and $type.BaseType.FullName -ne "System.Object") - { - $declaration += " : " + (normalize $type.BaseType.FullName) - } - - $writer.WriteLine($declaration) - - # properties - foreach ($property in $type.GetProperties() | Where-Object { $_.DeclaringType -eq $type } | Sort-Object { $_.Name }) - { - $writer.WriteLine($twoSpaces + "property " + $property.Name + $getterSetter + " : " + (normalize $property.PropertyType.FullName)) - } - - # methods - foreach ($method in $type.GetMethods() | - Where-Object { $_.DeclaringType -eq $type -and !$_.Name.StartsWith("set_") -and !$_.Name.StartsWith("get_")} | - Sort-Object { $_.Name,($_.GetParameters().Name -join " ") }) # get a deterministic order among methods - { - $writer.WriteLine($twoSpaces + "method " + $method.Name) - $writer.WriteLine($fourSpaces + "return type " + (normalize $method.ReturnType.FullName)) - - foreach($param in $method.GetParameters()) - { - $writer.WriteLine($fourSpaces + "param " + $param.Name + " : " + (normalize $param.ParameterType.FullName)) - } - } - } -} -finally -{ - $writer.Close() -} \ No newline at end of file From d79693cc7835a8e648f7c342b0d610b949ee9642 Mon Sep 17 00:00:00 2001 From: "Kenneth Omondi (from Dev Box)" Date: Tue, 23 Jul 2024 15:01:39 +0300 Subject: [PATCH 2/5] docs(COntributing): Remove all the references to dev branch. --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cfc6e273fcd..448c1eeb485 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,10 +6,10 @@ Thanks for considering making a contribution! Read over our guidelines and we wi There are a few different recommended paths to get contributions into the released version of this library. ## File issues -The best way to get started with a contribution is to start a dialog with us. Sometimes features will be under development or out of scope for this library and it's best to check before starting work on contribution, especially for large work items. +The best way to get started with a contribution is to start a dialog with us. Sometimes features will be under development or out of scope for this library, and it's best to check before starting work on contribution, especially for large work items. ## Pull requests -All pull requests should be submitted against the **dev** branch or a specific feature branch. The master branch is intended to represent the code released in the most-recent Nuget package. +All pull requests should be submitted against the **master** branch or a specific feature branch. The master branch is intended to represent the code released in the most-recent Nuget package. ## Commit message format @@ -42,7 +42,7 @@ The recommended commit types used are: Adding a footer with the prefix **BREAKING CHANGE:** will cause an increment of the _major_ version. -When a new package is about to be released, changes in dev will be merged into master. The package will be generated from master. +When a new package is about to be release, the release PR will be merged into master. The package will be generated from master. Some things to note about this project: From 5272819b82ea2933039ad127d68a25702ef5b999 Mon Sep 17 00:00:00 2001 From: "Kenneth Omondi (from Dev Box)" Date: Tue, 23 Jul 2024 15:02:52 +0300 Subject: [PATCH 3/5] ci(cleanup): Remove references of dev from the branch protection policy. --- .../msgraph-sdk-dotnet-branch-protection.yml | 38 +------------------ 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/.github/policies/msgraph-sdk-dotnet-branch-protection.yml b/.github/policies/msgraph-sdk-dotnet-branch-protection.yml index 1a96da5b2de..648d83f3471 100644 --- a/.github/policies/msgraph-sdk-dotnet-branch-protection.yml +++ b/.github/policies/msgraph-sdk-dotnet-branch-protection.yml @@ -37,45 +37,9 @@ configuration: requiredStatusChecks: - build - license/cla - # Require branches to be up to date before merging. Requires requiredStatusChecks. boolean + # Require branches to be up-to-date before merging. Requires requiredStatusChecks. boolean requiresStrictStatusChecks: true # Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush. restrictsPushes: false # Restrict who can dismiss pull request reviews. boolean restrictsReviewDismissals: false - - - branchNamePattern: dev - # This branch pattern applies to the following branches as of 06/12/2023 10:31:13: - # dev - - # Specifies whether this branch can be deleted. boolean - allowsDeletions: false - # Specifies whether forced pushes are allowed on this branch. boolean - allowsForcePushes: false - # Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean - dismissStaleReviews: true - # Specifies whether admins can overwrite branch protection. boolean - isAdminEnforced: false - # Indicates whether "Require a pull request before merging" is enabled. boolean - requiresPullRequestBeforeMerging: true - # Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required - requiredApprovingReviewsCount: 1 - # Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean - requireCodeOwnersReview: true - # Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines. - requiresCommitSignatures: false - # Are conversations required to be resolved before merging? boolean - requiresConversationResolution: true - # Are merge commits prohibited from being pushed to this branch. boolean - requiresLinearHistory: false - # Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status - requiredStatusChecks: - - build - - license/cla - # Require branches to be up to date before merging. Requires requiredStatusChecks. boolean - requiresStrictStatusChecks: true - # Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush. - restrictsPushes: false - # Restrict who can dismiss pull request reviews. boolean - restrictsReviewDismissals: false - From 1be55f624ce65b3b5a1493ff1d93c33c633e1188 Mon Sep 17 00:00:00 2001 From: "Kenneth Omondi (from Dev Box)" Date: Tue, 23 Jul 2024 15:03:40 +0300 Subject: [PATCH 4/5] Change the release type to simple since `dotnet` is invalid --- release-please-config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-please-config.json b/release-please-config.json index bc02be45c31..174a5ddfff5 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -6,7 +6,7 @@ ".github", ".vscode" ], - "release-type": "dotnet", + "release-type": "simple", "include-component-in-tag": false, "include-v-in-tag": true, "packages": { @@ -15,7 +15,7 @@ "changelog-path": "CHANGELOG.md", "extra-files": [ "README.md", - "src/Microsoft.Graph.csproj" + "src/Microsoft.Graph/Microsoft.Graph.csproj" ] } }, From f0edb101707018554e029362b7524082e6bbb9b7 Mon Sep 17 00:00:00 2001 From: "Kenneth Omondi (from Dev Box)" Date: Tue, 23 Jul 2024 15:16:39 +0300 Subject: [PATCH 5/5] ci(release): Edit release pipeline to only add artifacts to GH-release --- .azure-pipelines/ci-build.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index a4eb9b83460..e555210767f 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -261,17 +261,15 @@ extends: nuGetFeedType: external publishFeedCredentials: 'microsoftgraph NuGet connection' - task: GitHubRelease@1 - displayName: 'GitHub release (create)' + displayName: 'GitHub release (Upload Artifacts)' inputs: gitHubConnection: 'Kiota_Release' target: $(Build.SourceVersion) + action: edit tagSource: userSpecifiedTag tag: 'v$(VERSION_STRING)' - title: '$(VERSION_STRING)' - releaseNotesSource: inline + title: 'v$(VERSION_STRING)' assets: | !**/** $(Pipeline.Workspace)/Microsoft.Graph.*.*nupkg - changeLogType: issueBased - isPreRelease: '$(IS_PRE_RELEASE)' - addChangeLog: true \ No newline at end of file + addChangeLog: false \ No newline at end of file