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

Azure Pipeline for Windows CI #1853

Merged
merged 22 commits into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
db06a36
Update Clarius.TransformOnBuild to work with VS2017
lokitoth Mar 25, 2019
5732a7a
Add explicit project dependencies to the solution
lokitoth Apr 24, 2019
1264330
Enable finding VS2017 MSBuild automatically
lokitoth Apr 24, 2019
8b7f95a
Update NuGet.exe to support SemVer
lokitoth Mar 26, 2019
da4e284
Fix init.cmd to also find vstest.console when it is not provided
lokitoth Apr 24, 2019
1eb6cb3
Enable a way to suppres c smoke test
lokitoth Apr 24, 2019
7a63b58
Simplify vw_core.vcxproj
lokitoth Mar 25, 2019
f6f7411
Simplify libvw.vcxproj
lokitoth Mar 25, 2019
9e99ba2
Fix c_test.vcxproj dependency
lokitoth Apr 24, 2019
2972990
Disable node reuse to avoid keeping stale MSBuild.exe processes aroun…
lokitoth Apr 24, 2019
c5441e0
Fix CodeAnalysis rule files location
lokitoth Apr 24, 2019
4e41c4e
Unify C# outputs
lokitoth Apr 24, 2019
fbda596
Fix NuGet pack binary search paths
lokitoth Apr 24, 2019
83c5e39
Make package.cmd more robust
lokitoth Apr 24, 2019
ae507d9
Remove in-build NuGet restore
lokitoth Apr 24, 2019
451776c
Remove DebugLeakCheck configuration
lokitoth Apr 24, 2019
ee107b2
Simplify cluster.vcxproj and unify output paths
lokitoth Apr 24, 2019
c493cbc
Normalize usage of $(SolutionDir)
lokitoth Apr 24, 2019
4052452
Simplify cs_unittest.csproj and unify outputs
lokitoth Apr 24, 2019
f96eed9
Switch to using exit codes to perform test validation
lokitoth Apr 24, 2019
0d9559d
Create Azure Pipeline configuration for Windows CI
lokitoth Apr 24, 2019
ecd2720
Bring set closer to check for envvars
lokitoth May 2, 2019
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: 55 additions & 0 deletions .pipelines/build-windows-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
resources:
- repo: self

pool:
name: Hosted VS2017
demands: Cmd

steps:
- task: VisualStudioTestPlatformInstaller@1
inputs:
packageFeedSelector: 'nugetOrg' # Options: nugetOrg, customFeed, netShare
versionSelector: 'latestStable' # Required when packageFeedSelector == NugetOrg || PackageFeedSelector == CustomFeed# Options: latestPreRelease, latestStable, specificVersion
#testPlatformVersion: # Required when versionSelector == SpecificVersion
#customFeed: # Required when packageFeedSelector == CustomFeed
#username: # Optional
#password: # Optional
#netShare: # Required when packageFeedSelector == NetShare
- script: CALL .scripts/restore.cmd
displayName: 'Restore dependencies'
env:
nugetPath: $(Build.SourcesDirectory)\vowpalwabbit\.nuget\nuget.exe
failOnStderr: true
- script: CALL .scripts/build.cmd
displayName: 'Build vw.sln'
env:
nugetPath: $(Build.SourcesDirectory)\vowpalwabbit\.nuget\nuget.exe
failOnStderr: true
- script: CALL .scripts/test.cmd
displayName: 'Run tests'
env:
nugetPath: $(Build.SourcesDirectory)\vowpalwabbit\.nuget\nuget.exe
failOnStderr: false
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: VSTest
testResultsFiles: '**/vowpalwabbit/out/test/Release/x64/*.trx'
- script: CALL .scripts/package.cmd
displayName: 'Package artifacts'
env:
Tag: +$(Build.SourceVersion)
nugetPath: $(Build.SourcesDirectory)\vowpalwabbit\.nuget\nuget.exe
failOnStderr: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: target'
inputs:
PathtoPublish: $(Build.SourcesDirectory)\vowpalwabbit\out\target
ArtifactName: target
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: package'
inputs:
PathtoPublish: $(Build.SourcesDirectory)\vowpalwabbit\out\package
ArtifactName: package
condition: succeededOrFailed()
2 changes: 1 addition & 1 deletion .scripts/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PUSHD %~dp0

REM TODO: Figure out how to parametrize this script?! (is there a standard, or do we actually need parse args?)
ECHO Building "%vwRoot%\vowpalwabbit\vw.sln" for Release x64
"%msbuildPath%" /v:normal /m /p:Configuration=Release;Platform=x64 "%vwRoot%\vowpalwabbit\vw.sln"
"%msbuildPath%" /v:normal /m /nr:false /p:Configuration=Release;Platform=x64 "%vwRoot%\vowpalwabbit\vw.sln"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is nr?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This disables node-reuse, which means it gets new msbuild "nodes" (processes) to build. It leads to more reliable builds, at the cost of a minute amount of built time, linear in number of projects.


POPD

Expand Down
6 changes: 6 additions & 0 deletions .scripts/find-vs2017.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
IF NOT DEFINED VsInstallDir (
REM Try to find VS Install
FOR /f "usebackq tokens=*" %%i IN (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) DO (
SET "VsInstallDir=%%i"
)
)
24 changes: 23 additions & 1 deletion .scripts/init.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,29 @@ IF NOT DEFINED nugetPath (
)

IF NOT DEFINED msbuildPath (
SET msbuildPath=msbuild
CALL %~dp0find-vs2017.cmd
)

IF NOT DEFINED vstestPath (
CALL %~dp0find-vs2017.cmd
)

IF NOT DEFINED msbuildPath (
IF EXIST "%VsInstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
SET "msBuildPath=%VsInstallDir%\MSBuild\15.0\Bin\MSBuild.exe"
) ELSE (
ECHO ERROR: MsBuild couldn't be found
EXIT /b 1
)
)

IF NOT DEFINED vstestPath (
IF EXIST "%VsInstallDir%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" (
SET "vstestPath=%VsInstallDir%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
) ELSE (
ECHO ERROR: vstest.console couldn't be found
EXIT /b 1
)
)

REM Repo-specific paths
Expand Down
15 changes: 11 additions & 4 deletions .scripts/package.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,29 @@ SETLOCAL

CALL %~dp0init.cmd

PUSHD %~dp0..

REM TODO: these should be read from the version props file, or similar
SET Version=8.6.1
SET Tag=-INTERNALONLY

SET RootRelativeOutputDirX64=%vwRoot%\vowpalwabbit\out\target\
SET RootRelativeOutputDirAnyCPU=%vwRoot%\vowpalwabbit\out\target\
SET SolutionDir=%vwRoot%\vowpalwabbit\
SET OutputDir="%SolutionDir%out\package\Release\x64"

IF NOT EXIST %OutputDir% MKDIR %OutputDir%

REM Do not add a training backslash here, as it will break the nuget xml parser for some reason
REM Do not add a trailing backslash here, as it will break the nuget xml parser for some reason
SET RepoRoot=%vwRoot%

REM TODO-pre-checkin: Figure out how to parametrize this script?! (is there a standard, or do we actually need parse args?)
nuget pack %SolutionDir%..\cs\cs\cs.nuspec -OutputDirectory "out\target\x64\Release" -Verbosity detailed -BasePath "." -Properties "RootRelativeOutputDirX64=%RootRelativeOutputDirX64%;RootRelativeOutputDirAnyCPU=%RootRelativeOutputDirAnyCPU%;Configuration=Release;Platform=X64;version=%Version%;Tag=%Tag%;RepoRoot=%RepoRoot%;SolutionDir=%SolutionDir%"
nuget pack %SolutionDir%..\cs\cs_json\cs_json.nuspec -OutputDirectory "out\target\x64\Release" -Verbosity detailed -BasePath "." -Properties "RootRelativeOutputDirX64=%RootRelativeOutputDirX64%;RootRelativeOutputDirAnyCPU=%RootRelativeOutputDirAnyCPU%;Configuration=Release;Platform=X64;version=%Version%;Tag=%Tag%;RepoRoot=%RepoRoot%;SolutionDir=%SolutionDir%"
nuget pack %SolutionDir%..\cs\cs_parallel\cs_parallel.nuspec -OutputDirectory "out\target\x64\Release" -Verbosity detailed -BasePath "." -Properties "RootRelativeOutputDirX64=%RootRelativeOutputDirX64%;RootRelativeOutputDirAnyCPU=%RootRelativeOutputDirAnyCPU%;Configuration=Release;Platform=X64;version=%Version%;Tag=%Tag%;RepoRoot=%RepoRoot%;SolutionDir=%SolutionDir%"
"%nugetPath%" pack %SolutionDir%..\cs\cs\cs.nuspec -OutputDirectory "%OutputDir%" -Verbosity detailed -BasePath "." -Properties "RootRelativeOutputDirX64=%RootRelativeOutputDirX64%;RootRelativeOutputDirAnyCPU=%RootRelativeOutputDirAnyCPU%;Configuration=Release;Platform=X64;version=%Version%;Tag=%Tag%;RepoRoot=%RepoRoot%;SolutionDir=%SolutionDir%"
"%nugetPath%" pack %SolutionDir%..\cs\cs_json\cs_json.nuspec -OutputDirectory "%OutputDir%" -Verbosity detailed -BasePath "." -Properties "RootRelativeOutputDirX64=%RootRelativeOutputDirX64%;RootRelativeOutputDirAnyCPU=%RootRelativeOutputDirAnyCPU%;Configuration=Release;Platform=X64;version=%Version%;Tag=%Tag%;RepoRoot=%RepoRoot%;SolutionDir=%SolutionDir%"
"%nugetPath%" pack %SolutionDir%..\cs\cs_parallel\cs_parallel.nuspec -OutputDirectory "%OutputDir%" -Verbosity detailed -BasePath "." -Properties "RootRelativeOutputDirX64=%RootRelativeOutputDirX64%;RootRelativeOutputDirAnyCPU=%RootRelativeOutputDirAnyCPU%;Configuration=Release;Platform=X64;version=%Version%;Tag=%Tag%;RepoRoot=%RepoRoot%;SolutionDir=%SolutionDir%"

REM TODO: Need to also include the .pdb files, once we fix all the GitLink warnings

POPD

ENDLOCAL
23 changes: 18 additions & 5 deletions .scripts/test.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,30 @@ SETLOCAL

CALL %~dp0init.cmd

REM TODO: Determine how to pass test failure out of this script so it can be used by CI/CD setups

REM TODO: Ensure all errors caught by the smoke test will result in non-zero exit codes
ECHO Running VW C Smoke test
"%vwRoot%\vowpalwabbit\out\target\Release\x64\c_test.exe"

IF "%ERRORLEVEL%" NEQ "0" (
ENDLOCAL
EXIT /B %ERRORLEVEL%
)

ECHO Running VW Unit Tests in C++
"%vwRoot%\vowpalwabbit\out\target\Release\x64\vw_unit_test.exe"

IF "%ERRORLEVEL%" NEQ "0" (
ENDLOCAL
EXIT /B %ERRORLEVEL%
)

ECHO Running VW Unit Tests in C#
%vstestPath% /Platform:x64 /inIsolation "%vwRoot%\vowpalwabbit\x64\Release\cs_unittest.dll" /TestCaseFilter:"TestCategory!=NotOnVSO"
REM this is the same as above, just xcopied to the out folder. This is broken due to baked-in paths. The fix is to place the output straight into out.
REM %vstestPath% /Platform:x64 /inIsolation "%vwRoot%\vowpalwabbit\x64\Release\cs_unittest.dll" /TestCaseFilter:"TestCategory!=NotOnVSO"
REM TODO: Add explicit logging configuration so it can be uploaded to pipeline results.
"%vstestPath%" /Platform:x64 /inIsolation "%vwRoot%\vowpalwabbit\x64\Release\cs_unittest.dll" /TestCaseFilter:"TestCategory!=NotOnVSO" --logger:trx "--ResultsDirectory:%vwRoot%\vowpalwabbit\out\test\Release\x64"

IF "%ERRORLEVEL%" NEQ "0" (
ENDLOCAL
EXIT /B %ERRORLEVEL%
)

ENDLOCAL
15 changes: 3 additions & 12 deletions c_test/c_test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<RootNamespace>c_test</RootNamespace>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\vowpalwabbit\</SolutionDir>
<!-- This is the ruleset file for code analysis, you can change it in VS -->
<CodeAnalysisRuleSet>..\sdl\SDL-7.0-Recommended.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>$(MSBuildProjectDirectory)\..\sdl\SDL-7.0-Recommended.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Expand Down Expand Up @@ -90,19 +90,10 @@
<ClCompile Include="sample.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\vowpalwabbit\vw_core.vcxproj">
<Project>{1e205806-7f80-47dd-a38d-fc08083f3593}</Project>
<ProjectReference Include="..\vowpalwabbit\libvw.vcxproj">
<Project>{EA52DE0D-A5BE-4FB9-8C84-3A57BDFEBED9}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="..\sdl\SDL-7.0-NativeAnalysis.targets" />
</Project>
Loading