-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #597 from microsoft/vnext
Merge 1.3.0-preview changes into master branch for release
- Loading branch information
Showing
89 changed files
with
4,903 additions
and
276 deletions.
There are no files selected for viewing
This file contains 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,126 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- master | ||
pr: none | ||
|
||
pool: | ||
name: Azure Pipelines | ||
vmImage: windows-latest | ||
demands: | ||
- msbuild | ||
- vstest | ||
|
||
steps: | ||
- task: NuGetCommand@2 | ||
displayName: 'NuGet restore' | ||
|
||
- task: MSBuild@1 | ||
displayName: 'Build solution **/*.sln' | ||
inputs: | ||
configuration: Release | ||
|
||
- task: VSTest@2 | ||
displayName: 'XUnit Tests' | ||
inputs: | ||
testAssemblyVer2: | | ||
**\*.Tests.dll | ||
vsTestVersion: 16.0 | ||
codeCoverageEnabled: true | ||
|
||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 | ||
displayName: 'ESRP CodeSigning' | ||
inputs: | ||
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)' | ||
FolderPath: src | ||
signConfigType: inlineSignParams | ||
inlineOperation: | | ||
[ | ||
{ | ||
"keyCode": "CP-230012", | ||
"operationSetCode": "SigntoolSign", | ||
"parameters": [ | ||
{ | ||
"parameterName": "OpusName", | ||
"parameterValue": "Microsoft" | ||
}, | ||
{ | ||
"parameterName": "OpusInfo", | ||
"parameterValue": "http://www.microsoft.com" | ||
}, | ||
{ | ||
"parameterName": "FileDigest", | ||
"parameterValue": "/fd \"SHA256\"" | ||
}, | ||
{ | ||
"parameterName": "PageHash", | ||
"parameterValue": "/NPH" | ||
}, | ||
{ | ||
"parameterName": "TimeStamp", | ||
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" | ||
} | ||
], | ||
"toolName": "sign", | ||
"toolVersion": "1.0" | ||
}, | ||
{ | ||
"keyCode": "CP-230012", | ||
"operationSetCode": "SigntoolVerify", | ||
"parameters": [ ], | ||
"toolName": "sign", | ||
"toolVersion": "1.0" | ||
} | ||
] | ||
SessionTimeout: 20 | ||
|
||
- task: MSBuild@1 | ||
displayName: 'Pack OpenAPI' | ||
inputs: | ||
solution: src/Microsoft.OpenApi/Microsoft.OpenApi.csproj | ||
configuration: Release | ||
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg' | ||
|
||
- task: MSBuild@1 | ||
displayName: 'Pack OpenAPI Readers' | ||
inputs: | ||
solution: src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj | ||
configuration: Release | ||
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg' | ||
|
||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 | ||
displayName: 'ESRP CodeSigning Nuget Packages' | ||
inputs: | ||
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)' | ||
FolderPath: '$(Build.ArtifactStagingDirectory)' | ||
Pattern: '*.nupkg' | ||
signConfigType: inlineSignParams | ||
inlineOperation: | | ||
[ | ||
{ | ||
"keyCode": "CP-401405", | ||
"operationSetCode": "NuGetSign", | ||
"parameters": [ ], | ||
"toolName": "sign", | ||
"toolVersion": "1.0" | ||
}, | ||
{ | ||
"keyCode": "CP-401405", | ||
"operationSetCode": "NuGetVerify", | ||
"parameters": [ ], | ||
"toolName": "sign", | ||
"toolVersion": "1.0" | ||
} | ||
] | ||
SessionTimeout: 20 | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: 'Publish Artifact: Nugets' | ||
inputs: | ||
ArtifactName: Nugets |
This file contains 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,17 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
# default location of `.github/workflows` | ||
directory: "/" | ||
open-pull-requests-limit: 10 | ||
schedule: | ||
interval: "weekly" | ||
|
||
- package-ecosystem: "nuget" | ||
# location of package manifests | ||
directory: "/" | ||
open-pull-requests-limit: 10 | ||
schedule: | ||
interval: "daily" | ||
|
||
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation) |
This file contains 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,143 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
ci: | ||
name: Continuous Integration | ||
runs-on: ubuntu-latest | ||
outputs: | ||
latest_version: ${{ steps.tag_generator.outputs.new_version }} | ||
is_default_branch: ${{ steps.conditionals_handler.outputs.is_default_branch }} | ||
env: | ||
ARTIFACTS_FOLDER: ${{ github.workspace }}/Artifacts | ||
GITHUB_RUN_NUMBER: ${{ github.run_number }} | ||
steps: | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 5.0.x | ||
|
||
- name: Data gatherer | ||
id: data_gatherer | ||
shell: pwsh | ||
run: | | ||
# Get default branch | ||
$repo = 'microsoft/OpenAPI.NET' | ||
$defaultBranch = Invoke-RestMethod -Method GET -Uri https://api.github.com/repos/$repo | Select-Object -ExpandProperty default_branch | ||
Write-Output "::set-output name=default_branch::$(echo $defaultBranch)" | ||
- name: Conditionals handler | ||
id: conditionals_handler | ||
shell: pwsh | ||
run: | | ||
$defaultBranch = "${{ steps.data_gatherer.outputs.default_branch }}" | ||
$githubRef = "${{ github.ref }}" | ||
$isDefaultBranch = 'false' | ||
if ( $githubRef -like "*$defaultBranch*" ) { | ||
$isDefaultBranch = 'true' | ||
} | ||
Write-Output "::set-output name=is_default_branch::$(echo $isDefaultBranch)" | ||
- name: Checkout repository | ||
id: checkout_repo | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
|
||
- if: steps.conditionals_handler.outputs.is_default_branch == 'true' | ||
name: Bump GH tag | ||
id: tag_generator | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
default_bump: false | ||
release_branches: ${{ steps.data_gatherer.outputs.default_branch }} | ||
|
||
- name: Build projects | ||
id: build_projects | ||
shell: pwsh | ||
run: | | ||
$projectsArray = @( | ||
'.\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj', | ||
'.\src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj', | ||
'.\src\Microsoft.OpenApi.Tool\Microsoft.OpenApi.Tool.csproj' | ||
) | ||
$gitNewVersion = if ("${{ steps.tag_generator.outputs.new_version }}") {"${{ steps.tag_generator.outputs.new_version }}"} else {$null} | ||
$projectCurrentVersion = ([xml](Get-Content .\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj)).Project.PropertyGroup.Version | ||
$projectNewVersion = $gitNewVersion ?? $projectCurrentVersion | ||
$projectsArray | ForEach-Object { | ||
dotnet build $PSItem ` | ||
-c Release # ` | ||
# -o $env:ARTIFACTS_FOLDER ` | ||
# /p:Version=$projectNewVersion | ||
} | ||
# Move NuGet packages to separate folder for pipeline convenience | ||
# New-Item Artifacts/NuGet -ItemType Directory | ||
# Get-ChildItem Artifacts/*.nupkg | Move-Item -Destination "Artifacts/NuGet" | ||
- name: Run unit tests | ||
id: run_unit_tests | ||
shell: pwsh | ||
run: | | ||
$testProjectsArray = @( | ||
'.\test\Microsoft.OpenApi.Tests\Microsoft.OpenApi.Tests.csproj', | ||
'.\test\Microsoft.OpenApi.Readers.Tests\Microsoft.OpenApi.Readers.Tests.csproj', | ||
'.\test\Microsoft.OpenApi.SmokeTests\Microsoft.OpenApi.SmokeTests.csproj' | ||
) | ||
$testProjectsArray | ForEach-Object { | ||
dotnet test $PSItem ` | ||
-c Release | ||
} | ||
# - if: steps.tag_generator.outputs.new_version != '' | ||
# name: Upload NuGet packages as artifacts | ||
# id: ul_packages_artifact | ||
# uses: actions/upload-artifact@v1 | ||
# with: | ||
# name: NuGet packages | ||
# path: Artifacts/NuGet/ | ||
|
||
cd: | ||
if: needs.ci.outputs.is_default_branch == 'true' && needs.ci.outputs.latest_version != '' | ||
name: Continuous Deployment | ||
needs: ci | ||
runs-on: ubuntu-latest | ||
steps: | ||
# - name: Download and extract NuGet packages | ||
# id: dl_packages_artifact | ||
# uses: actions/download-artifact@v2 | ||
# with: | ||
# name: NuGet packages | ||
# path: NuGet/ | ||
|
||
# - name: Push NuGet packages to NuGet.org | ||
# id: push_nuget_packages | ||
# continue-on-error: true | ||
# shell: pwsh | ||
# run: | | ||
# Get-ChildItem NuGet/*.nupkg | ForEach-Object { | ||
# nuget push $PSItem ` | ||
# -ApiKey $env:NUGET_API_KEY ` | ||
# -Source https://api.nuget.org/v3/index.json | ||
# } | ||
# env: | ||
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | ||
|
||
- name: Create and publish release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: OpenApi v${{ needs.ci.outputs.latest_version }} | ||
tag_name: v${{ needs.ci.outputs.latest_version }} | ||
# files: | | ||
# NuGet/Microsoft.OpenApi.${{ needs.ci.outputs.latest_version }}.nupkg | ||
# NuGet/Microsoft.OpenApi.Readers.${{ needs.ci.outputs.latest_version }}.nupkg | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation) |
This file contains 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,47 @@ | ||
name: CodeQL Analysis | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 8 * * *' | ||
|
||
jobs: | ||
analyze: | ||
name: CodeQL Analysis | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
id: checkout_repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 5.0.x | ||
|
||
- name: Initialize CodeQL | ||
id: init_codeql | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
queries: security-and-quality | ||
|
||
- name: Build projects | ||
id: build_projects | ||
shell: pwsh | ||
run: | | ||
$projectsArray = @( | ||
'.\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj', | ||
'.\src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj', | ||
'.\src\Microsoft.OpenApi.Tool\Microsoft.OpenApi.Tool.csproj' | ||
) | ||
$projectsArray | ForEach-Object { | ||
dotnet build $PSItem -c Release | ||
} | ||
- name: Perform CodeQL Analysis | ||
id: analyze_codeql | ||
uses: github/codeql-action/analyze@v1 | ||
|
||
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation) |
This file contains 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,27 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
// Use IntelliSense to find out which attributes exist for C# debugging | ||
// Use hover for the description of the existing attributes | ||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md | ||
"name": ".NET Core Launch (console)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
// If you have changed target frameworks, make sure to update the program path. | ||
"program": "${workspaceFolder}/src/Microsoft.OpenApi.Tool/bin/Debug/netcoreapp3.1/Microsoft.OpenApi.Tool.dll", | ||
"args": [], | ||
"cwd": "${workspaceFolder}/src/Microsoft.OpenApi.Tool", | ||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console | ||
"console": "internalConsole", | ||
"stopAtEntry": false | ||
}, | ||
{ | ||
"name": ".NET Core Attach", | ||
"type": "coreclr", | ||
"request": "attach", | ||
"processId": "${command:pickProcess}" | ||
} | ||
] | ||
} |
This file contains 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 @@ | ||
{ | ||
"workbench.colorCustomizations": { | ||
"activityBar.background": "#03323C", | ||
"titleBar.activeBackground": "#054754", | ||
"titleBar.activeForeground": "#F0FCFE" | ||
} | ||
} |
This file contains 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
Oops, something went wrong.