diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 4548a8e66..ee410f158 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -6,11 +6,13 @@ name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) trigger: branches: include: - - master + - main + - support/v1 pr: branches: include: - - master + - main + - support/v1 variables: buildPlatform: 'Any CPU' @@ -145,7 +147,7 @@ extends: - task: PowerShell@2 displayName: 'Validate project version has been incremented' - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded()) + condition: and(or(contains(variables['build.sourceBranch'], 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/support/v1')), succeeded()) inputs: targetType: 'filePath' filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1 @@ -186,10 +188,17 @@ extends: PendingAnalysisWaitTimeoutMinutes: '5' - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded()) + condition: and(or(contains(variables['build.sourceBranch'], 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/support/v1')), succeeded()) dependsOn: build jobs: - deployment: deploy + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' environment: nuget-org strategy: runOnce: @@ -197,16 +206,54 @@ extends: pool: vmImage: ubuntu-latest steps: - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - task: 1ES.PublishNuget@1 displayName: 'NuGet push' inputs: - packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.OData.*.nupkg' + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.OData.*.nupkg' nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' packageParentPath: '$(Pipeline.Workspace)' + + - deployment: create_github_release + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: kiota-github-releases + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - pwsh: | + $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.OData", "" -replace ".nupkg", "" + #Set Variable $artifactName and $artifactVersion + Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + echo "$artifactVersion" + displayName: 'Fetch Artifact Name' + - task: GitHubRelease@1 + displayName: 'GitHub release' + condition: succeededOrFailed() + inputs: + gitHubConnection: 'Github-MaggieKimani1' + action: create + tagSource: userSpecifiedTag + tag: 'v$(artifactVersion)' + title: 'v$(artifactVersion)' + releaseNotesSource: inline + assets: '$(Pipeline.Workspace)\**\*.nupkg' + changeLogType: issueBased + changeLogLabels: '[ + { "label" : "feature-work", "feature", "displayName" : "New Features", "state" : "closed" }, + { "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" }, + { "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" }, + { "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"}, + { "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" } + ]' diff --git a/.github/policies/OpenAPI.NET.OData-branch-protection.yml b/.github/policies/OpenAPI.NET.OData-branch-protection.yml index 42f6d7cf0..7a91aec7e 100644 --- a/.github/policies/OpenAPI.NET.OData-branch-protection.yml +++ b/.github/policies/OpenAPI.NET.OData-branch-protection.yml @@ -9,9 +9,45 @@ resource: repository configuration: branchProtectionRules: - - branchNamePattern: master + - branchNamePattern: main # This branch pattern applies to the following branches as of 06/09/2024 20:45:44: - # master + # main + + # 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: + - license/cla + - Continuous Integration + - CodeQL + # Require branches to be up to date before merging. This should be false since the repo contains autogenerated files. boolean + requiresStrictStatusChecks: false + # 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: support/v1 + # This branch pattern applies to the following branches as of 06/09/2024 20:45:44: + # support/v1 # Specifies whether this branch can be deleted. boolean allowsDeletions: false diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cd365f878..56409ee78 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [ master ] + branches: [ main, support/v1 ] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [ main, support/v1 ] schedule: - cron: '32 2 * * 6' workflow_dispatch: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 19e9543fe..567536c5f 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - support/v1 paths-ignore: ['.vscode/**'] pull_request: types: [opened, synchronize, reopened] diff --git a/.gitignore b/.gitignore index 940794e60..4caae17f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore # User-specific files *.suo diff --git a/.vscode/settings.json b/.vscode/settings.json index 9cc75cead..9893070db 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,6 @@ "MD025": { "front_matter_title": "" } - } + }, + "azure-pipelines.1ESPipelineTemplatesSchemaFile": true } \ No newline at end of file diff --git a/README.md b/README.md index 575d609e0..b02123072 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,15 @@ The **Microsoft.OpenAPI.OData.Reader** library helps represent an OData service The conversion is based on the mapping doc from [OASIS OData OpenAPI v1.0](https://www.oasis-open.org/committees/document.php?document_id=61852&wg_abbrev=odata) and uses the following : -1. [Capabilities vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Capabilities.V1.xml) -2. [Authorization vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Authorization.V1.xml) -3. [Core vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Core.V1.xml) +1. [Capabilities vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Capabilities.V1.xml) +2. [Authorization vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Authorization.V1.xml) +3. [Core vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Core.V1.xml) 4. Navigation property path 5. Edm operation and operation import path ## Overview -The image below is generic overview of how this library can convert the EDM model to an [OpenAPI.NET document](https://github.com/Microsoft/OpenAPI.NET/blob/master/src/Microsoft.OpenApi/Models/OpenApiDocument.cs) object. +The image below is generic overview of how this library can convert the EDM model to an [OpenAPI.NET document](https://github.com/Microsoft/OpenAPI.NET/blob/main/src/Microsoft.OpenApi/Models/OpenApiDocument.cs) object. ![Convert OData CSDL to OpenAPI](docs/images/odata-2-openapi.png "Map /// OData CSDL --> OpenAPI.NET") diff --git a/src/OoasUtil/README.md b/src/OoasUtil/README.md index 2eaa7a6d4..95435d412 100644 --- a/src/OoasUtil/README.md +++ b/src/OoasUtil/README.md @@ -70,7 +70,7 @@ Indicate to output file name. `OoasUtil.exe -j -k -drs -drq -p -u -s 3 -i http://services.odata.org/TrippinRESTierService -o trip.json` -The content of `trip.json` is similar at https://github.com/xuzhg/OData.OpenAPI/blob/master/Microsoft.OData.OpenAPI/Microsoft.OData.OpenAPI.Tests/Resources/TripService.OpenApi.json +The content of `trip.json` is similar at https://github.com/xuzhg/OData.OpenAPI/blob/main/Microsoft.OData.OpenAPI/Microsoft.OData.OpenAPI.Tests/Resources/TripService.OpenApi.json # Alternative Tool - Hidi diff --git a/tool/PoliCheck/RunPoliCheck.ps1 b/tool/PoliCheck/RunPoliCheck.ps1 index 92bb179d1..3eb663fbd 100644 --- a/tool/PoliCheck/RunPoliCheck.ps1 +++ b/tool/PoliCheck/RunPoliCheck.ps1 @@ -10,7 +10,7 @@ param( #Example: # RunPoliCheck.ps1 -BuildSourceDir "C:\BuildAgent\_work\32\s" # -folderName "src" -# -branchName "odata.net-master" +# -branchName "odata.net-main" # -resultRoot "C:\Users\ODatabld\Documents\PoliCheck\LatestRunResult" # -PoliCheckPath "C:\Program Files (x86)\Microsoft\PoliCheck\" #