Skip to content

Commit 1374d77

Browse files
authored
Merge pull request #597 from microsoft/vnext
Merge 1.3.0-preview changes into master branch for release
2 parents 553061a + a008173 commit 1374d77

File tree

89 files changed

+4903
-276
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+4903
-276
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
5+
6+
trigger:
7+
branches:
8+
include:
9+
- master
10+
pr: none
11+
12+
pool:
13+
name: Azure Pipelines
14+
vmImage: windows-latest
15+
demands:
16+
- msbuild
17+
- vstest
18+
19+
steps:
20+
- task: NuGetCommand@2
21+
displayName: 'NuGet restore'
22+
23+
- task: MSBuild@1
24+
displayName: 'Build solution **/*.sln'
25+
inputs:
26+
configuration: Release
27+
28+
- task: VSTest@2
29+
displayName: 'XUnit Tests'
30+
inputs:
31+
testAssemblyVer2: |
32+
**\*.Tests.dll
33+
34+
vsTestVersion: 16.0
35+
codeCoverageEnabled: true
36+
37+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
38+
displayName: 'ESRP CodeSigning'
39+
inputs:
40+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
41+
FolderPath: src
42+
signConfigType: inlineSignParams
43+
inlineOperation: |
44+
[
45+
{
46+
"keyCode": "CP-230012",
47+
"operationSetCode": "SigntoolSign",
48+
"parameters": [
49+
{
50+
"parameterName": "OpusName",
51+
"parameterValue": "Microsoft"
52+
},
53+
{
54+
"parameterName": "OpusInfo",
55+
"parameterValue": "http://www.microsoft.com"
56+
},
57+
{
58+
"parameterName": "FileDigest",
59+
"parameterValue": "/fd \"SHA256\""
60+
},
61+
{
62+
"parameterName": "PageHash",
63+
"parameterValue": "/NPH"
64+
},
65+
{
66+
"parameterName": "TimeStamp",
67+
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
68+
}
69+
],
70+
"toolName": "sign",
71+
"toolVersion": "1.0"
72+
},
73+
{
74+
"keyCode": "CP-230012",
75+
"operationSetCode": "SigntoolVerify",
76+
"parameters": [ ],
77+
"toolName": "sign",
78+
"toolVersion": "1.0"
79+
}
80+
]
81+
SessionTimeout: 20
82+
83+
- task: MSBuild@1
84+
displayName: 'Pack OpenAPI'
85+
inputs:
86+
solution: src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
87+
configuration: Release
88+
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
89+
90+
- task: MSBuild@1
91+
displayName: 'Pack OpenAPI Readers'
92+
inputs:
93+
solution: src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj
94+
configuration: Release
95+
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
96+
97+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
98+
displayName: 'ESRP CodeSigning Nuget Packages'
99+
inputs:
100+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
101+
FolderPath: '$(Build.ArtifactStagingDirectory)'
102+
Pattern: '*.nupkg'
103+
signConfigType: inlineSignParams
104+
inlineOperation: |
105+
[
106+
{
107+
"keyCode": "CP-401405",
108+
"operationSetCode": "NuGetSign",
109+
"parameters": [ ],
110+
"toolName": "sign",
111+
"toolVersion": "1.0"
112+
},
113+
{
114+
"keyCode": "CP-401405",
115+
"operationSetCode": "NuGetVerify",
116+
"parameters": [ ],
117+
"toolName": "sign",
118+
"toolVersion": "1.0"
119+
}
120+
]
121+
SessionTimeout: 20
122+
123+
- task: PublishBuildArtifacts@1
124+
displayName: 'Publish Artifact: Nugets'
125+
inputs:
126+
ArtifactName: Nugets

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
# default location of `.github/workflows`
5+
directory: "/"
6+
open-pull-requests-limit: 10
7+
schedule:
8+
interval: "weekly"
9+
10+
- package-ecosystem: "nuget"
11+
# location of package manifests
12+
directory: "/"
13+
open-pull-requests-limit: 10
14+
schedule:
15+
interval: "daily"
16+
17+
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

.github/workflows/ci-cd.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: CI/CD Pipeline
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
ci:
7+
name: Continuous Integration
8+
runs-on: ubuntu-latest
9+
outputs:
10+
latest_version: ${{ steps.tag_generator.outputs.new_version }}
11+
is_default_branch: ${{ steps.conditionals_handler.outputs.is_default_branch }}
12+
env:
13+
ARTIFACTS_FOLDER: ${{ github.workspace }}/Artifacts
14+
GITHUB_RUN_NUMBER: ${{ github.run_number }}
15+
steps:
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 5.0.x
20+
21+
- name: Data gatherer
22+
id: data_gatherer
23+
shell: pwsh
24+
run: |
25+
# Get default branch
26+
$repo = 'microsoft/OpenAPI.NET'
27+
$defaultBranch = Invoke-RestMethod -Method GET -Uri https://api.github.com/repos/$repo | Select-Object -ExpandProperty default_branch
28+
Write-Output "::set-output name=default_branch::$(echo $defaultBranch)"
29+
30+
- name: Conditionals handler
31+
id: conditionals_handler
32+
shell: pwsh
33+
run: |
34+
$defaultBranch = "${{ steps.data_gatherer.outputs.default_branch }}"
35+
$githubRef = "${{ github.ref }}"
36+
$isDefaultBranch = 'false'
37+
if ( $githubRef -like "*$defaultBranch*" ) {
38+
$isDefaultBranch = 'true'
39+
}
40+
Write-Output "::set-output name=is_default_branch::$(echo $isDefaultBranch)"
41+
42+
- name: Checkout repository
43+
id: checkout_repo
44+
uses: actions/checkout@v2
45+
with:
46+
token: ${{ secrets.GITHUB_TOKEN }}
47+
fetch-depth: 0
48+
49+
- if: steps.conditionals_handler.outputs.is_default_branch == 'true'
50+
name: Bump GH tag
51+
id: tag_generator
52+
uses: mathieudutour/[email protected]
53+
with:
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
default_bump: false
56+
release_branches: ${{ steps.data_gatherer.outputs.default_branch }}
57+
58+
- name: Build projects
59+
id: build_projects
60+
shell: pwsh
61+
run: |
62+
$projectsArray = @(
63+
'.\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj',
64+
'.\src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj',
65+
'.\src\Microsoft.OpenApi.Tool\Microsoft.OpenApi.Tool.csproj'
66+
)
67+
$gitNewVersion = if ("${{ steps.tag_generator.outputs.new_version }}") {"${{ steps.tag_generator.outputs.new_version }}"} else {$null}
68+
$projectCurrentVersion = ([xml](Get-Content .\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj)).Project.PropertyGroup.Version
69+
$projectNewVersion = $gitNewVersion ?? $projectCurrentVersion
70+
71+
$projectsArray | ForEach-Object {
72+
dotnet build $PSItem `
73+
-c Release # `
74+
# -o $env:ARTIFACTS_FOLDER `
75+
# /p:Version=$projectNewVersion
76+
}
77+
78+
# Move NuGet packages to separate folder for pipeline convenience
79+
# New-Item Artifacts/NuGet -ItemType Directory
80+
# Get-ChildItem Artifacts/*.nupkg | Move-Item -Destination "Artifacts/NuGet"
81+
82+
- name: Run unit tests
83+
id: run_unit_tests
84+
shell: pwsh
85+
run: |
86+
$testProjectsArray = @(
87+
'.\test\Microsoft.OpenApi.Tests\Microsoft.OpenApi.Tests.csproj',
88+
'.\test\Microsoft.OpenApi.Readers.Tests\Microsoft.OpenApi.Readers.Tests.csproj',
89+
'.\test\Microsoft.OpenApi.SmokeTests\Microsoft.OpenApi.SmokeTests.csproj'
90+
)
91+
92+
$testProjectsArray | ForEach-Object {
93+
dotnet test $PSItem `
94+
-c Release
95+
}
96+
97+
# - if: steps.tag_generator.outputs.new_version != ''
98+
# name: Upload NuGet packages as artifacts
99+
# id: ul_packages_artifact
100+
# uses: actions/upload-artifact@v1
101+
# with:
102+
# name: NuGet packages
103+
# path: Artifacts/NuGet/
104+
105+
cd:
106+
if: needs.ci.outputs.is_default_branch == 'true' && needs.ci.outputs.latest_version != ''
107+
name: Continuous Deployment
108+
needs: ci
109+
runs-on: ubuntu-latest
110+
steps:
111+
# - name: Download and extract NuGet packages
112+
# id: dl_packages_artifact
113+
# uses: actions/download-artifact@v2
114+
# with:
115+
# name: NuGet packages
116+
# path: NuGet/
117+
118+
# - name: Push NuGet packages to NuGet.org
119+
# id: push_nuget_packages
120+
# continue-on-error: true
121+
# shell: pwsh
122+
# run: |
123+
# Get-ChildItem NuGet/*.nupkg | ForEach-Object {
124+
# nuget push $PSItem `
125+
# -ApiKey $env:NUGET_API_KEY `
126+
# -Source https://api.nuget.org/v3/index.json
127+
# }
128+
# env:
129+
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
130+
131+
- name: Create and publish release
132+
id: create_release
133+
uses: softprops/action-gh-release@v1
134+
with:
135+
name: OpenApi v${{ needs.ci.outputs.latest_version }}
136+
tag_name: v${{ needs.ci.outputs.latest_version }}
137+
# files: |
138+
# NuGet/Microsoft.OpenApi.${{ needs.ci.outputs.latest_version }}.nupkg
139+
# NuGet/Microsoft.OpenApi.Readers.${{ needs.ci.outputs.latest_version }}.nupkg
140+
env:
141+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142+
143+
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

.github/workflows/codeql-analysis.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CodeQL Analysis
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 8 * * *'
8+
9+
jobs:
10+
analyze:
11+
name: CodeQL Analysis
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
id: checkout_repo
16+
uses: actions/checkout@v2
17+
18+
- name: Setup .NET
19+
uses: actions/setup-dotnet@v1
20+
with:
21+
dotnet-version: 5.0.x
22+
23+
- name: Initialize CodeQL
24+
id: init_codeql
25+
uses: github/codeql-action/init@v1
26+
with:
27+
queries: security-and-quality
28+
29+
- name: Build projects
30+
id: build_projects
31+
shell: pwsh
32+
run: |
33+
$projectsArray = @(
34+
'.\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj',
35+
'.\src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj',
36+
'.\src\Microsoft.OpenApi.Tool\Microsoft.OpenApi.Tool.csproj'
37+
)
38+
39+
$projectsArray | ForEach-Object {
40+
dotnet build $PSItem -c Release
41+
}
42+
43+
- name: Perform CodeQL Analysis
44+
id: analyze_codeql
45+
uses: github/codeql-action/analyze@v1
46+
47+
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

.vscode/launch.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
// Use IntelliSense to find out which attributes exist for C# debugging
6+
// Use hover for the description of the existing attributes
7+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/src/Microsoft.OpenApi.Tool/bin/Debug/netcoreapp3.1/Microsoft.OpenApi.Tool.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}/src/Microsoft.OpenApi.Tool",
16+
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17+
"console": "internalConsole",
18+
"stopAtEntry": false
19+
},
20+
{
21+
"name": ".NET Core Attach",
22+
"type": "coreclr",
23+
"request": "attach",
24+
"processId": "${command:pickProcess}"
25+
}
26+
]
27+
}

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.background": "#03323C",
4+
"titleBar.activeBackground": "#054754",
5+
"titleBar.activeForeground": "#F0FCFE"
6+
}
7+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
The **OpenAPI.NET** SDK contains a useful object model for OpenAPI documents in .NET along with common serializers to extract raw OpenAPI JSON and YAML documents from the model.
1212

13-
**See more information on the OpenAPI specification and its history here: <a href="https://www.openapis.org">Open API Initiative</a>**
13+
**See more information on the OpenAPI specification and its history here: <a href="https://www.openapis.org">OpenAPI Initiative</a>**
1414

1515
Project Objectives
1616

0 commit comments

Comments
 (0)