Skip to content

Commit

Permalink
Merge pull request #1532 from microsoft/vnext
Browse files Browse the repository at this point in the history
Master refresh: Release Hidi & libs
  • Loading branch information
MaggieKimani1 committed Jan 16, 2024
2 parents 7387007 + 217d40a commit 79f59bf
Show file tree
Hide file tree
Showing 26 changed files with 231 additions and 138 deletions.
49 changes: 27 additions & 22 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pool:
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)'
ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)'


stages:
Expand All @@ -31,22 +31,22 @@ stages:
- job: build
steps:
- task: UseDotNet@2
displayName: 'Use .NET 2' # needed for ESRP signing
displayName: 'Use .NET 6' # needed for ESRP signing
inputs:
version: 2.x
version: 6.x

- task: UseDotNet@2
displayName: 'Use .NET 7'
inputs:
version: 7.x

- task: PoliCheck@1
- task: PoliCheck@2
displayName: 'Run PoliCheck "/src"'
inputs:
inputType: CmdLine
cmdLineArgs: '/F:$(Build.SourcesDirectory)/src /T:9 /Sev:"1|2" /PE:2 /O:poli_result_src.xml'

- task: PoliCheck@1
- task: PoliCheck@2
displayName: 'Run PoliCheck "/test"'
inputs:
inputType: CmdLine
Expand Down Expand Up @@ -75,14 +75,14 @@ stages:
arguments: '--configuration $(BuildConfiguration) --no-build'

# CredScan
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
displayName: 'Run CredScan - Src'
inputs:
toolMajorVersion: 'V2'
scanFolder: '$(Build.SourcesDirectory)\src'
debugMode: false

- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
displayName: 'Run CredScan - Test'
inputs:
toolMajorVersion: 'V2'
Expand All @@ -95,34 +95,38 @@ stages:
FileDirPath: '$(ProductBinPath)'
enabled: false

- task: BinSkim@3
- task: BinSkim@4
displayName: 'Run BinSkim - Product Binaries'
inputs:
InputType: Basic
AnalyzeTarget: '$(ProductBinPath)\**\Microsoft.OpenApi.dll'
AnalyzeTargetGlob: '$(ProductBinPath)\**\Microsoft.OpenApi.dll'
AnalyzeSymPath: '$(ProductBinPath)'
AnalyzeVerbose: true
AnalyzeHashes: true
AnalyzeEnvironment: true

- task: PublishSecurityAnalysisLogs@2
- task: PublishSecurityAnalysisLogs@3
displayName: 'Publish Security Analysis Logs'
inputs:
ArtifactName: SecurityLogs

- task: PostAnalysis@1
- task: PostAnalysis@2
displayName: 'Post Analysis'
inputs:
BinSkim: true
CredScan: true
PoliCheck: true

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
- task: EsrpCodeSigning@2
displayName: 'ESRP CodeSigning'
inputs:
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
FolderPath: src
signConfigType: inlineSignParams
UseMinimatch: true
Pattern: |
**\*.exe
**\*.dll
inlineOperation: |
[
{
Expand Down Expand Up @@ -162,26 +166,27 @@ stages:
}
]
SessionTimeout: 20

# Pack
- pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
displayName: 'pack OpenAPI'

# Pack
- pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
displayName: 'pack Readers'

# Pack
- pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
displayName: 'pack Hidi'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: 'pack Hidi'

- task: EsrpCodeSigning@2
displayName: 'ESRP CodeSigning Nuget Packages'
inputs:
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
FolderPath: '$(Build.ArtifactStagingDirectory)'
Pattern: '*.nupkg'
signConfigType: inlineSignParams
UseMinimatch: true
inlineOperation: |
[
{
Expand Down Expand Up @@ -209,7 +214,7 @@ stages:
$xml = [Xml] (Get-Content .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)
$version = $xml.Project.PropertyGroup.Version
echo $version
echo "##vso[task.setvariable variable=hidiversion]$version"
echo "##vso[task.setvariable variable=hidiversion]$version"
# publish hidi as an .exe
- task: DotNetCoreCLI@2
Expand All @@ -219,7 +224,7 @@ stages:
arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)
projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj'
publishWebProjects: False
zipAfterPublish: false
zipAfterPublish: false

- task: CopyFiles@2
displayName: Prepare staging folder for upload
Expand All @@ -236,7 +241,7 @@ stages:

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Hidi'
inputs:
inputs:
ArtifactName: Microsoft.OpenApi.Hidi-v$(hidiversion)
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)'

Expand Down Expand Up @@ -295,8 +300,8 @@ stages:
{ "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" }]'
{ "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" }]'

- deployment: deploy_lib
dependsOn: []
environment: nuget-org
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ assignees: ''
**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the current behavior:
**OpenApi File To Reproduce**
Add the OpenApi file you're using or a link to it as well as the steps to reproduce the current behavior.

**Expected behavior**
A clear and concise description of what you expected to happen.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
GITHUB_RUN_NUMBER: ${{ github.run_number }}
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x

- name: Initialize CodeQL
id: init_codeql
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
queries: security-and-quality

Expand All @@ -43,6 +43,6 @@ jobs:
- name: Perform CodeQL Analysis
id: analyze_codeql
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3

# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)
6 changes: 3 additions & 3 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ jobs:
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Setup .NET 5 # At the moment the scanner requires dotnet 5 https://www.nuget.org/packages/dotnet-sonarscanner
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 5.0.x
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- uses: actions/checkout@v4
Expand Down
81 changes: 0 additions & 81 deletions docs/CI-CD_DOCUMENTATION.md

This file was deleted.

Binary file removed docs/images/Actions_workflow_dispatch.png
Binary file not shown.
6 changes: 3 additions & 3 deletions src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Nullable>enable</Nullable>
<ToolCommandName>hidi</ToolCommandName>
<PackageOutputPath>./../../artifacts</PackageOutputPath>
<Version>1.3.6</Version>
<Version>1.3.7</Version>
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand All @@ -34,8 +34,8 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Microsoft.OData.Edm" Version="7.18.0" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.5.0-preview9" />
<PackageReference Include="Microsoft.OData.Edm" Version="7.20.0" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.6.0-preview.2" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.6.11</Version>
<Version>1.6.12</Version>
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public static IOpenApiAny GetSpecificOpenApiAny(IOpenApiAny openApiAny, OpenApiS
{
if (DateTimeOffset.TryParse(value, CultureInfo.InvariantCulture, DateTimeStyles.None, out var dateTimeValue))
{
return new OpenApiDateTime(dateTimeValue);
// if the time component is exactly midnight(00:00:00) meaning no time has elapsed, return a date-only value
return dateTimeValue.TimeOfDay == TimeSpan.Zero ? new OpenApiDate(dateTimeValue.Date)
: new OpenApiDateTime(dateTimeValue);
}
}
else if (type == "string")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302" PrivateAssets="all" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.0" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.1" />
</ItemGroup>
<ItemGroup>
<Resource Include="Themes\Metro\HowToApplyTheme.txt" />
Expand Down
15 changes: 14 additions & 1 deletion src/Microsoft.OpenApi/Any/OpenApiPrimitive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.

using System;
using System.Globalization;
using System.Text;
using Microsoft.OpenApi.Exceptions;
using Microsoft.OpenApi.Properties;
Expand Down Expand Up @@ -74,7 +75,19 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)

case PrimitiveType.Double:
var doubleValue = (OpenApiDouble)(IOpenApiPrimitive)this;
writer.WriteValue(doubleValue.Value);
var actualValue = doubleValue.Value;
if (actualValue.Equals(double.NaN)
|| actualValue.Equals(double.NegativeInfinity)
|| actualValue.Equals(double.PositiveInfinity))
{
// Write out NaN, -Infinity, Infinity as strings
writer.WriteValue(actualValue.ToString(CultureInfo.InvariantCulture));
break;
}
else
{
writer.WriteValue(actualValue);
}
break;

case PrimitiveType.String:
Expand Down
Loading

0 comments on commit 79f59bf

Please sign in to comment.