Skip to content

Commit

Permalink
Testing pipelines and validating artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Omondi committed Jul 8, 2024
1 parent 2f72ff2 commit 47e64f5
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 27 deletions.
20 changes: 9 additions & 11 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pr:
include:
- main


variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
Expand All @@ -25,7 +24,6 @@ resources:
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release


extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
Expand Down Expand Up @@ -54,7 +52,7 @@ 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

Expand All @@ -67,25 +65,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
displayName: 'ESRP DLL Strong Name'
inputs:
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
FolderPath: $(ProductBinPath)
Pattern: '**\*Microsoft.Kiota.Abstractions.dll'
Pattern: '**\*Microsoft.Kiota.*.dll'
signConfigType: inlineSignParams
UseMinimatch: true
inlineOperation: |
Expand Down Expand Up @@ -114,7 +112,7 @@ extends:
FolderPath: src
signConfigType: inlineSignParams
UseMinimatch: true
Pattern: '**\*Microsoft.Kiota.Abstractions.dll'
Pattern: '**\*Microsoft.Kiota.*.dll'
inlineOperation: |
[
{
Expand Down Expand Up @@ -156,7 +154,7 @@ 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
Expand All @@ -167,7 +165,7 @@ extends:
inputs:
targetType: 'filePath'
filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1
arguments: '-projectPath "$(Build.SourcesDirectory)/src/Microsoft.Kiota.Abstractions.csproj" -packageName "Microsoft.Kiota.Abstractions"'
arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props" -packageName "Microsoft.Kiota.Abstractions"'
pwsh: true

- task: EsrpCodeSigning@2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
19 changes: 8 additions & 11 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<Project>

<!-- Common default project properties for ALL projects-->
<PropertyGroup>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<IsTestProject>false</IsTestProject><!-- This is overidden in test projects by setting to true-->
<IsAnalyzerProject>false</IsAnalyzerProject><!-- This is overidden in test projects by setting to true-->
<VersionSuffix>
</VersionSuffix>
<!-- This is overidden in test projects by setting to true-->
<IsTestProject>false</IsTestProject>
<!-- This is overidden in test projects by setting to true-->
<IsAnalyzerProject>false</IsAnalyzerProject>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

<!-- Common project properties for PACKAGED projects TO BE RELEASED-->
<PropertyGroup Condition="('$(IsTestProject)' != 'true') and ('$(IsAnalyzerProject)' != 'true')">
<Authors>Microsoft</Authors>
Expand All @@ -36,25 +37,21 @@
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net8.0'))">true</IsAotCompatible>
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>

<!-- Common project properties for TEST projects-->
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
<IsPackable>false</IsPackable>
<OutputType>Library</OutputType>
</PropertyGroup>


<!-- Include ReadMe.md for PACKAGED projects TO BE RELEASED-->
<ItemGroup Condition="('$(IsTestProject)' != 'true') and ('$(IsAnalyzerProject)' != 'true')">
<None Include="README.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
<PackagePath>
</PackagePath>
</None>
</ItemGroup>

<!-- Include SourceLink Dependency for packages TO BE RELEASED-->
<ItemGroup Condition="('$(IsTestProject)' != 'true') and ('$(IsAnalyzerProject)' != 'true')">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

</Project>
8 changes: 7 additions & 1 deletion scripts/EnableSigning.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ $delaySign.'#text' = "true"
$signAssembly = $doc.SelectSingleNode("//SignAssembly");
$signAssembly.'#text' = "true"

# Set the AssemblyOriginatorKeyFile to an absolute path to resolve any path resolution issues.
# Assumption: The key file is in the same directory as the project file.
$dirName = [System.IO.Path]::GetDirectoryName([System.IO.Path]::GetFullPath($projectPath))
$assemblyOriginatorKeyFile = $doc.SelectSingleNode("//AssemblyOriginatorKeyFile");
$assemblyOriginatorKeyFile.'#text' = Join-Path $dirName $assemblyOriginatorKeyFile.'#text'

$doc.Save($projectPath);

Write-Host "Updated the .csproj file so that we can sign the built assemblies." -ForegroundColor Green
Write-Host "Updated the project file so that we can sign the built assemblies." -ForegroundColor Green
Binary file removed src/authentication/azure/35MSSharedLib1024.snk
Binary file not shown.
Binary file removed src/http/httpClient/35MSSharedLib1024.snk
Binary file not shown.
6 changes: 5 additions & 1 deletion src/http/httpClient/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@

[assembly: Guid("b0c91cbc-af85-4c64-b989-d320e6989b2a")]

[assembly: InternalsVisibleTo("Microsoft.Kiota.Http.HttpClientLibrary.Tests")]
#if DEBUG
[assembly: InternalsVisibleTo("Microsoft.Kiota.Http.HttpClientLibrary.Tests")]
#else
[assembly: InternalsVisibleTo("Microsoft.Kiota.Http.HttpClientLibrary.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
#endif
Binary file removed src/serialization/form/35MSSharedLib1024.snk
Binary file not shown.
Binary file removed src/serialization/json/35MSSharedLib1024.snk
Binary file not shown.
Binary file removed src/serialization/multipart/35MSSharedLib1024.snk
Binary file not shown.
Binary file removed src/serialization/text/35MSSharedLib1024.snk
Binary file not shown.

0 comments on commit 47e64f5

Please sign in to comment.