Skip to content

Commit

Permalink
Cdpx pipelines for PowerBI Csharp sdk
Browse files Browse the repository at this point in the history
Support buddy, pyll request and official pipelines.

Pipeline steps:
- restore nuggets
- auto versioning forassemblies and package
- build Release | AnyCpu
- pack the nuget package
- run tests

**Notes**
- By cdpx's design, only official queue can produce signed bits. The csprojs were changed to delay-sign the dlls only in this case ( or in case we run the legacy non-cdpx queue). Itherwise test in other queues will fail on strong name validation
- By design cdpx pipelines don't support external parameters, it means that we can't pass anymore the clean version *major, minor and patch to the queue, nor suffix.
- The assembly version will be in format major.minor.nnnn.rrrr where r is the revision number (number of tomes the build has been run in a day and nnnn some day counter starting from 2017).
- The version is 3.x.x only in official queue, for other queues we have 0.0.x and 0.1.x versions.
- The dev package version to be deployed to dev will be major.minor.nnnnrrrr and the clean package version will be major.minor.0
- To support suffixes like beta or patch versions we will need to add a additional official queues with tags (in the future)
- In regular sdk releases, we will update the minor version in .pipelines/pipeline.user.windows.official.yml
- The assembli file and informational version will be the full version, the assembly version will be major.minor.0.0
- Official queue packs both Dev and Clean packages, other queues packs onlt Dev unsigned package
  • Loading branch information
laurent-mic committed Apr 22, 2020
1 parent 12ab0fe commit ae0f3b1
Show file tree
Hide file tree
Showing 14 changed files with 346 additions and 112 deletions.
19 changes: 19 additions & 0 deletions .pipelines/pipeline.user.windows.buddy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version:
name: 'sdk version'
major: 0
minor: 1
system: 'Buildrevision'
exclude_commit: false
assembly_version: 'majorminoronly'
assembly_file_version: 'fullversionnumber'
assembly_informational_version: 'fullversionnumber'

package:
commands:
- !!buildcommand
name: 'pack sdk\**\PowerBI.Api.csproj for dev feed'
command: './scripts/pack-sdk-dev.cmd'
artifacts:
- from: 'pack\Dev'
include:
- '**/*'
27 changes: 27 additions & 0 deletions .pipelines/pipeline.user.windows.official.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version:
name: 'sdk version'
major: 3
minor: 12
system: 'Buildrevision'
exclude_commit: false
assembly_version: 'majorminoronly'
assembly_file_version: 'fullversionnumber'
assembly_informational_version: 'fullversionnumber'

package:
commands:
- !!buildcommand
name: 'pack sdk\**\PowerBI.Api.csproj for Official feeds'
command: './scripts/pack-sdk.cmd'
artifacts:
- from: 'pack\Clean'
include:
- '**/*'

- !!buildcommand
name: 'pack sdk\**\PowerBI.Api.csproj for Dev feed'
command: './scripts/pack-sdk-dev.cmd'
artifacts:
- from: 'pack\Dev'
include:
- '**/*'
19 changes: 19 additions & 0 deletions .pipelines/pipeline.user.windows.pullrequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version:
name: 'sdk version'
major: 0
minor: 0
system: 'Buildrevision'
exclude_commit: false
assembly_version: 'majorminoronly'
assembly_file_version: 'fullversionnumber'
assembly_informational_version: 'fullversionnumber'

package:
commands:
- !!buildcommand
name: 'pack sdk\**\PowerBI.Api.csproj for dev feed'
command: './scripts/pack-sdk-dev.cmd'
artifacts:
- from: 'pack\Dev'
include:
- '**/*'
48 changes: 48 additions & 0 deletions .pipelines/pipeline.user.windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
environment:
host:
os: 'windows'
flavor: 'server'
version: '2016'
runtime:
provider: 'appcontainer'

image: 'cdpxwin1809.azurecr.io/global/vse2017:latest'
source_mode: 'map'

signing_options:
profile: 'external_distribution'

restore:
commands:
- !!defaultcommand
name: 'Nuget Restore'
command: './scripts/nuget-restore.cmd'
logs:
- include:
- 'MSBuildLogs\*'
build:
commands:
- !!buildcommand
name: 'Build SDK'
command: './scripts/build-sdk.cmd'
logs:
- include:
- './scripts/msbuild.log'
exclude:
artifacts:
- from: 'sdk\PowerBI.Api\bin'
include:
- '**/*'

test:
commands:
- !!testcommand
name: 'Test sdk'
command: './scripts/run-tests.cmd'
testresults:
- from: 'TestResults'
title: 'SDK Tests'
type: 'vstest'
include:
- '**/*'

7 changes: 7 additions & 0 deletions .version/PipelineAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This is a placeholder file
// When build in CDPx Pipeline, it will be replaced by a generated file with the version assigned by CDPx.
using System.Reflection;

[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.1-dev")]
17 changes: 17 additions & 0 deletions scripts/build-sdk.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@echo off
echo Start running build-sdk.cmd ...
pushd "%~dp0"

echo Build PowerBI.CSharp.Sdk.sln Release - AnyCPU...
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MsBuild.exe" %~dp0..\sdk\PowerBI.CSharp.Sdk.sln /p:Configuration=Release /p:Platform="AnyCPU" -fl

set EX=%ERRORLEVEL%

if "%EX%" neq "0" (
echo "Failed to build PowerBI.CSharp.Sdk.sln."
popd
exit /B %EX%
)
echo "PowerBI.CSharp.Sdk.sln built succesfuly"
popd
exit /B %EX%
20 changes: 20 additions & 0 deletions scripts/clean.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
setlocal
@echo off
pushd "%~dp0"
echo Start cleaning...
for /d %%G in (%~dp0..\sdk\PowerBI.Api\bin, %~dp0..\sdk\PowerBI.Api\obj, %~dp0..\sdk\PowerBI.Api.Tests\bin, %~dp0..\sdk\PowerBI.Api.Tests\obj ) do (call :deletefolder %%G)

echo Cleaning Done.
endlocal
goto :eof

:deletefolder
setlocal
set folder =%1
if exist %1 (
echo Deleting %1
rmdir %1 /s /q
) else (
echo Skipping %1
)
endlocal
24 changes: 24 additions & 0 deletions scripts/nuget-restore.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@echo off
pushd "%~dp0.."

set PACKAGES_DIRECTORY="%~dp0..\sdk\packages"
echo "Remove folder %PACKAGES_DIRECTORY% if exists"
if exist %PACKAGES_DIRECTORY% (
call rmdir %PACKAGES_DIRECTORY% /s /q
)

echo Clean previous build outputs ...
call cmd.exe /c %~dp0clean.cmd
if exist msbuild.log del msbuild.log

echo call nuget restore "%~dp0..\sdk\PowerBI.CSharp.Sdk.sln" -ConfigFile "%~dp0..\sdk\.nuget\NuGet.Config"
call nuget restore "%~dp0..\sdk\PowerBI.CSharp.Sdk.sln" -ConfigFile "%~dp0..\sdk\.nuget\NuGet.Config"
set EX=%ERRORLEVEL%
if "%EX%" neq "0" (
popd
echo "Failed to restore nuget packages."
exit /b %EX%
)

popd
exit /B %EX%
17 changes: 17 additions & 0 deletions scripts/pack-sdk-dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@echo off
echo Start running pack-sdk.cmd ...
pushd "%~dp0"

echo call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MsBuild.exe" %~dp0..\sdk\PowerBI.Api\PowerBI.Api.csproj /t:pack /p:Configuration=Release /p:PackageVersion=%CDP_PACKAGE_VERSION_NUMERIC% /p:PackageOutputPath=%~dp0..\pack\Dev
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MsBuild.exe" %~dp0..\sdk\PowerBI.Api\PowerBI.Api.csproj /t:pack /p:Configuration=Release /p:PackageVersion=%CDP_PACKAGE_VERSION_NUMERIC% /p:PackageOutputPath=%~dp0..\pack\Dev

set EX=%ERRORLEVEL%

if "%EX%" neq "0" (
echo "Failed to pack PowerBI.Api.csproj."
popd
exit /B %EX%
)
echo "PowerBI.Api.csproj packed succesfuly"
popd
exit /B %EX%
17 changes: 17 additions & 0 deletions scripts/pack-sdk.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@echo off
echo Start running pack-sdk.cmd ...
pushd "%~dp0"

echo call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MsBuild.exe" %~dp0..\sdk\PowerBI.Api\PowerBI.Api.csproj /t:pack /p:Configuration=Release /p:PackageVersion=%CDP_MAJOR_NUMBER_ONLY%.%CDP_MINOR_NUMBER_ONLY%.0 /p:PackageOutputPath=%~dp0..\pack\Clean
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MsBuild.exe" %~dp0..\sdk\PowerBI.Api\PowerBI.Api.csproj /t:pack /p:Configuration=Release /p:PackageVersion=%CDP_MAJOR_NUMBER_ONLY%.%CDP_MINOR_NUMBER_ONLY%.0 /p:PackageOutputPath=%~dp0..\pack\Clean

set EX=%ERRORLEVEL%

if "%EX%" neq "0" (
echo "Failed to pack PowerBI.Api.csproj."
popd
exit /B %EX%
)
echo "PowerBI.Api.csproj packed succesfuly"
popd
exit /B %EX%
17 changes: 17 additions & 0 deletions scripts/run-tests.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@echo off
echo Start running run-tests.cmd ...
pushd "%~dp0"

echo "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" /logger:trx /Platform:x64 /InIsolation %~dp0..\sdk\PowerBI.Api.Tests\bin\Release\PowerBI.Api.Tests.dll /framework:framework40 /ResultsDirectory:%~dp0../TestResults
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" /logger:trx /Platform:x64 /InIsolation %~dp0..\sdk\PowerBI.Api.Tests\bin\Release\PowerBI.Api.Tests.dll /framework:framework40 /ResultsDirectory:%~dp0../TestResults

set EX=%ERRORLEVEL%

if "%EX%" neq "0" (
echo "Failed to run tests."
popd
exit /B %EX%
)
echo "Tests run succesfuly"
popd
exit /B %EX%
8 changes: 2 additions & 6 deletions sdk/PowerBI.Api.Tests/PowerBI.Api.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<PropertyGroup Condition="$(CDP_BUILD_TYPE)==Official or $(POWERBI_CSHARP_QUEUE)==true ">
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\certificates\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>..\certificates\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
Loading

0 comments on commit ae0f3b1

Please sign in to comment.