Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kiota Dotnet Mono repo migration #262

Merged
merged 18 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 26 additions & 29 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ pr:
include:
- main


variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
ProductBinPath: '$(Build.SourcesDirectory)\src\bin\$(BuildConfiguration)'

resources:
repositories:
Expand All @@ -25,7 +23,6 @@ resources:
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release


extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
Expand Down Expand Up @@ -54,10 +51,19 @@ extends:
inputs:
targetType: filePath
filePath: 'scripts\EnableSigning.ps1'
arguments: '-projectPath "$(Build.SourcesDirectory)/src/Microsoft.Kiota.Abstractions.csproj"'
arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props"'
pwsh: true
enabled: true


- task: PowerShell@2
displayName: 'Validate project version has been incremented'
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded())
inputs:
targetType: 'filePath'
filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1
arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props" -packageName "Microsoft.Kiota.Abstractions"'
pwsh: true

# Install the nuget tool.
- task: NuGetToolInstaller@1
displayName: 'Install Nuget dependency manager'
Expand All @@ -67,25 +73,25 @@ extends:

# Build the Product project
- task: DotNetCoreCLI@2
displayName: 'Build Microsoft.Kiota.Abstractions'
displayName: 'Build projects in Microsoft.Kiota'
inputs:
projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.Abstractions.sln'
projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln'
arguments: '--configuration $(BuildConfiguration) --no-incremental'

# Run the Unit test
- task: DotNetCoreCLI@2
displayName: 'Test Microsoft.Kiota.Abstractions'
displayName: 'Test projects in Microsoft.Kiota'
inputs:
command: test
projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.Abstractions.sln'
projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln'
arguments: '--configuration $(BuildConfiguration) --no-build --framework net8.0'

- task: EsrpCodeSigning@2
- task: EsrpCodeSigning@3
displayName: 'ESRP DLL Strong Name'
inputs:
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
FolderPath: $(ProductBinPath)
Pattern: '**\*Microsoft.Kiota.Abstractions.dll'
FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder
Pattern: '**\*Microsoft.Kiota.*.dll'
signConfigType: inlineSignParams
UseMinimatch: true
inlineOperation: |
Expand All @@ -107,14 +113,14 @@ extends:
]
SessionTimeout: 20

- task: EsrpCodeSigning@2
- task: EsrpCodeSigning@3
displayName: 'ESRP DLL CodeSigning'
inputs:
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
FolderPath: src
FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder
signConfigType: inlineSignParams
UseMinimatch: true
Pattern: '**\*Microsoft.Kiota.Abstractions.dll'
Pattern: '**\*Microsoft.Kiota.*.dll'
inlineOperation: |
[
{
Expand Down Expand Up @@ -156,21 +162,12 @@ extends:
SessionTimeout: 20

# arguments are not parsed in DotNetCoreCLI@2 task for `pack` command, that's why we have a custom pack command here
- pwsh: dotnet pack $env:BUILD_SOURCESDIRECTORY/src/Microsoft.Kiota.Abstractions.csproj /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION
- pwsh: dotnet pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION
env:
BUILD_CONFIGURATION: $(BuildConfiguration)
displayName: Dotnet pack

- task: PowerShell@2
displayName: 'Validate project version has been incremented'
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded())
inputs:
targetType: 'filePath'
filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1
arguments: '-projectPath "$(Build.SourcesDirectory)/src/Microsoft.Kiota.Abstractions.csproj" -packageName "Microsoft.Kiota.Abstractions"'
pwsh: true

- task: EsrpCodeSigning@2
- task: EsrpCodeSigning@3
baywet marked this conversation as resolved.
Show resolved Hide resolved
displayName: 'ESRP CodeSigning Nuget Packages'
inputs:
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
Expand Down Expand Up @@ -215,7 +212,7 @@ extends:
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded())
dependsOn: build
jobs:
- deployment: deploy_dotnet_abstractions
- deployment: deploy_dotnet_kiota_libs
dependsOn: []
environment: nuget-org
strategy:
Expand Down Expand Up @@ -243,10 +240,10 @@ extends:
pwsh: true
arguments: '-packageDirPath "$(Pipeline.Workspace)/"'
- task: 1ES.PublishNuget@1
displayName: 'NuGet push'
displayName: 'Push Nuget for Kiota libraries'
inputs:
command: push
packagesToPush: '$(Pipeline.Workspace)/Microsoft.Kiota.Abstractions.*.nupkg'
packagesToPush: '$(Pipeline.Workspace)/Microsoft.Kiota.*.nupkg'
packageParentPath: '$(Pipeline.Workspace)'
nuGetFeedType: external
publishFeedCredentials: 'Kiota Nuget Connection'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
build-and-test:
runs-on: windows-latest
env:
solutionName: Microsoft.Kiota.Abstractions.sln
solutionName: Microsoft.Kiota.sln
steps:
- uses: actions/checkout@v4
- name: Setup .NET
Expand All @@ -30,10 +30,10 @@ jobs:
- name: Restore dependencies
run: dotnet restore ${{ env.solutionName }}
- name: Build
run: dotnet build ${{ env.solutionName }} --no-restore -c Release /p:UseSharedCompilation=false
run: dotnet build ${{ env.solutionName }} --no-restore /p:UseSharedCompilation=false
- name: Test for net462
run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal -c Release --framework net462
run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal --framework net462
- name: Test for net8.0 and collect coverage
run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal -c Release /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=opencover --framework net8.0
run: dotnet test ${{ env.solutionName }} --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=opencover --framework net8.0
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
4 changes: 2 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ jobs:
CoverletOutputFormat: "opencover" # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682
shell: pwsh
run: |
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_kiota-abstractions-dotnet" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="Microsoft.Kiota.Abstractions.Tests/coverage.net8.0.opencover.xml"
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_kiota-abstractions-dotnet" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="tests/abstractions/coverage.net8.0.opencover.xml,tests/authentication/azure/coverage.net8.0.opencover.xml,tests/http/httpClient/coverage.net8.0.opencover.xml,tests/serialization/json/coverage.net8.0.opencover.xml,tests/serialization/text/coverage.net8.0.opencover.xml,tests/serialization/form/coverage.net8.0.opencover.xml,tests/serialization/multipart/coverage.net8.0.opencover.xml"
dotnet workload restore
dotnet build
dotnet test Microsoft.Kiota.Abstractions.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --framework net8.0
dotnet test Microsoft.Kiota.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --framework net8.0
dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
// 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)",
"name": "Test - Abstractions",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Microsoft.Kiota.Abstractions.Tests/bin/Debug/net8.0/Microsoft.Kiota.Abstractions.Tests.dll",
"program": "${workspaceFolder}/tests/abstractions/bin/Debug/net8.0/Microsoft.Kiota.Abstractions.Tests.dll",
"args": [],
"cwd": "${workspaceFolder}/Microsoft.Kiota.Abstractions.Tests",
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
Expand All @@ -23,4 +23,4 @@
"request": "attach"
}
]
}
}
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/Microsoft.Kiota.Abstractions.sln",
"${workspaceFolder}/Microsoft.Kiota.sln",
// Ask dotnet build to generate full paths for file names.
"/property:GenerateFullPaths=true",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
Expand All @@ -24,7 +24,7 @@
"type": "process",
"args": [
"test",
"${workspaceFolder}/Microsoft.Kiota.Abstractions.sln",
"${workspaceFolder}/Microsoft.Kiota.sln",
// Ask dotnet build to generate full paths for file names.
"/property:GenerateFullPaths=true",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
Expand Down
File renamed without changes.
Loading
Loading