Skip to content

Commit

Permalink
add windows c# ci job
Browse files Browse the repository at this point in the history
  • Loading branch information
vigsterkr committed Jan 10, 2019
1 parent 8b4103d commit 51c9bc5
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 21 deletions.
38 changes: 36 additions & 2 deletions .ci/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
steps:
- template: ./macos-steps.yml

- job: windows
- job: windows_libshogun
displayName: Windows
timeoutInMinutes: 120

Expand All @@ -151,13 +151,47 @@ jobs:
py36:
CONDA_PY: "36"
CONDA_ENV: shogun
cmakeOptions: '-DBUILD_META_EXAMPLES=OFF'

variables:
clcacheDir: 'C:\\Users\\VssAdministrator\\clcache'
clcacheArtifactName: 'clcache-vs17'
clcacheArchive: '$(Build.ArtifactStagingDirectory)/clache-$(Build.BuildId).tar.gz'
clcacheArchive: '$(Build.ArtifactStagingDirectory)/clcache-$(Build.BuildId).tar.gz'
libshogunArtifactName: 'libshogun-vs17'
libshogunArchive: '$(Build.ArtifactStagingDirectory)/libshogun-$(Build.BuildId).tar.gz'
targetPrefix: '$(Build.BinariesDirectory)\\opt'
buildConfiguration: Release
buildPlatform: x64

steps:
- template: ./windows-steps.yml

- job: windows_swig
displayName: Windows SWIG Interface
dependsOn: windows_libshogun
timeoutInMinutes: 120

pool:
vmImage: 'vs2017-win2016'

strategy:
matrix:
csharp:
cmakeOptions: '$(commonSWIGCMakeFlags) -DINTERFACE_CSHARP=ON'
interfaceName: 'csharp'

variables:
targetPrefix: '$(Build.BinariesDirectory)\\opt'
libshogunArtifactName: 'libshogun-vs17'
libshogunArchive: '$(Build.ArtifactStagingDirectory)/libshogun-$(Build.BuildId).tar.gz'
commonSWIGCMakeFlags: '-DLIBSHOGUN=OFF -DDISABLE_UNIT_TESTS=ON -DDISABLE_META_CPP=ON'
clcacheDir: 'C:\\Users\\VssAdministrator\\clcache'
clcacheArtifactName: 'clcache-$(interfaceName)'
clcacheArchive: '$(Build.ArtifactStagingDirectory)/clcache-$(Build.BuildId).tar.gz'
buildConfiguration: Release
buildPlatform: x64

steps:
- template: ./windows-steps.yml
parameters:
swig: true
1 change: 0 additions & 1 deletion .ci/docker-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ steps:
submodules: true

- script: mkdir $(ccacheDir) $(targetPrefix)
condition:
displayName: Create artifact directories

- template: ./download-extract.yml
Expand Down
25 changes: 23 additions & 2 deletions .ci/download-extract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,31 @@ steps:
workingDirectory: ${{ parameters.downloadPath }}
failOnStderr: true

# Windows
- powershell: |
$ARTIFACT_DIR = ${{ format('"{0}\{1}"', parameters.downloadPath, parameters.artifactName) }}
if (Test-Path -Path $ARTIFACT_DIR) {
Write-Host "##vso[task.setVariable variable=ARTIFACT_EXISTS;]true"
} else {
Write-Host "##vso[task.setVariable variable=ARTIFACT_EXISTS;]false"
}
displayName: ${{ format('Checking {0} download task status', parameters.name) }}
condition: eq(variables['Agent.OS'], 'Windows_NT')

# Linux and macOS
- bash: |
if [ -d ${{ format('{0}/{1}', parameters.downloadPath, parameters.artifactName) }} ]; then
echo "##vso[task.setVariable variable=ARTIFACT_EXISTS]true"
else
echo "##vso[task.setVariable variable=ARTIFACT_EXISTS]false"
fi
displayName: ${{ format('Checking {0} download task status', parameters.name) }}
condition: ne(variables['Agent.OS'], 'Windows_NT')

- task: ExtractFiles@1
displayName: ${{ format('Extract {0} archive', parameters.name) }}
condition: eq(variables['Agent.JobStatus'], 'Succeeded')
condition: eq(variables.ARTIFACT_EXISTS, 'true')
inputs:
archiveFilePatterns: ${{ format('{0}/{1}/*.tar*', parameters.downloadPath, parameters.artifactName) }}
destinationFolder: ${{ parameters.destinationFolder }}
cleanDestinationFolder: True
cleanDestinationFolder: true
44 changes: 29 additions & 15 deletions .ci/windows-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,57 @@ steps:
inputs:
createCustomEnvironment: True
environmentName: shogun
packageSpecs: 'python=3.6.* setuptools numpy scipy eigen rxcpp snappy zlib ctags ply jinja2 gtest mkl-devel'
packageSpecs: 'python=3.6.* setuptools numpy scipy eigen rxcpp snappy zlib ctags ply jinja2 gtest mkl-devel swig'
createOptions: '-c conda-forge'
updateConda: false

- script: |
.ci\\setup_clcache.cmd
displayName: Setup CLCache

- script: mkdir $(targetPrefix)
displayName: Create artifact directory

- template: ./download-extract.yml
parameters:
name: 'CLcache'
artifactName: $(clcacheArtifactName)
destinationFolder: $(clcacheDir)
downloadPath: $(build.binariesDirectory)
downloadPath: $(Build.BinariesDirectory)

- ${{ if eq(parameters.swig, 'true') }}:
- template: ./download-extract.yml
parameters:
name: 'LibShogun'
artifactName: $(libshogunArtifactName)
downloadPath: $(Build.BinariesDirectory)
destinationFolder: $(targetPrefix)
specificBuildWithTriggering: true

- task: CMake@1
displayName: Setup
inputs:
cmakeArgs: '-G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=$(buildConfiguration) -DCMAKE_INSTALL_PREFIX=$(CONDA_PREFIX)\Library -DBUILD_META_EXAMPLES=OFF -DENABLE_TESTING=ON ..'
cmakeArgs: '-G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=$(buildConfiguration) -DCMAKE_PREFIX_PATH=$(CONDA_PREFIX)\Library -DENABLE_TESTING=ON -DCMAKE_INSTALL_PREFIX=$(targetPrefix) $(cmakeOptions) ..'

- task: VSBuild@1
displayName: 'VSBuild ($(buildConfiguration) $(buildPlatform))'
inputs:
solution: 'build/shogun.sln'
vsVersion: 'latest'
platform: $(buildPlatform)
msbuildArchitecture: $(buildPlatform)
msbuildArgs: '/p:TrackFileAccess=false /p:CLToolExe=clcache.exe'
configuration: $(buildConfiguration)

- script: ctest -j%NUMBER_OF_PROCESSORS% -C $(buildConfiguration)
- script: cmake --build . --config $(buildConfiguration) --target INSTALL -- /p:TrackFileAccess=false /p:CLToolExe=clcache.exe /m:2
displayName: 'Build ($(buildConfiguration) $(buildPlatform))'
workingDirectory: $(Build.SourcesDirectory)\build

- script: ctest -j 2
displayName: Test
workingDirectory: build
workingDirectory: $(Build.SourcesDirectory)\build

- script: clcache -s
displayName: CLCache statistics

- ${{ if ne(parameters.swig, 'true') }}:
- template: ./archive-deploy.yml
parameters:
name: 'LibShogun'
dir: $(targetPrefix)
archive: $(libshogunArchive)
artifactName: $(libshogunArtifactName)

- template: ./archive-deploy.yml
parameters:
name: 'CLcache'
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindCSharp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ endif( )


FIND_PACKAGE_HANDLE_STANDARD_ARGS(CSharp FOUND_VAR CSHARP_FOUND
REQUIRED_VARS CSHARP_TYPE CSHARP_COMPILER CSHARP_INTERPRETER
REQUIRED_VARS CSHARP_TYPE CSHARP_COMPILER
VERSION_VAR CSHARP_VERSION)

mark_as_advanced( CSHARP_TYPE CSHARP_VERSION CSHARP_COMPILER CSHARP_INTERPRETER CSHARP_PLATFORM CSHARP_SDK )
Expand Down

0 comments on commit 51c9bc5

Please sign in to comment.