Skip to content

Commit 51c9bc5

Browse files
committed
add windows c# ci job
1 parent 8b4103d commit 51c9bc5

File tree

5 files changed

+89
-21
lines changed

5 files changed

+89
-21
lines changed

.ci/ci.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
steps:
140140
- template: ./macos-steps.yml
141141

142-
- job: windows
142+
- job: windows_libshogun
143143
displayName: Windows
144144
timeoutInMinutes: 120
145145

@@ -151,13 +151,47 @@ jobs:
151151
py36:
152152
CONDA_PY: "36"
153153
CONDA_ENV: shogun
154+
cmakeOptions: '-DBUILD_META_EXAMPLES=OFF'
154155

155156
variables:
156157
clcacheDir: 'C:\\Users\\VssAdministrator\\clcache'
157158
clcacheArtifactName: 'clcache-vs17'
158-
clcacheArchive: '$(Build.ArtifactStagingDirectory)/clache-$(Build.BuildId).tar.gz'
159+
clcacheArchive: '$(Build.ArtifactStagingDirectory)/clcache-$(Build.BuildId).tar.gz'
160+
libshogunArtifactName: 'libshogun-vs17'
161+
libshogunArchive: '$(Build.ArtifactStagingDirectory)/libshogun-$(Build.BuildId).tar.gz'
162+
targetPrefix: '$(Build.BinariesDirectory)\\opt'
159163
buildConfiguration: Release
160164
buildPlatform: x64
161165

162166
steps:
163167
- template: ./windows-steps.yml
168+
169+
- job: windows_swig
170+
displayName: Windows SWIG Interface
171+
dependsOn: windows_libshogun
172+
timeoutInMinutes: 120
173+
174+
pool:
175+
vmImage: 'vs2017-win2016'
176+
177+
strategy:
178+
matrix:
179+
csharp:
180+
cmakeOptions: '$(commonSWIGCMakeFlags) -DINTERFACE_CSHARP=ON'
181+
interfaceName: 'csharp'
182+
183+
variables:
184+
targetPrefix: '$(Build.BinariesDirectory)\\opt'
185+
libshogunArtifactName: 'libshogun-vs17'
186+
libshogunArchive: '$(Build.ArtifactStagingDirectory)/libshogun-$(Build.BuildId).tar.gz'
187+
commonSWIGCMakeFlags: '-DLIBSHOGUN=OFF -DDISABLE_UNIT_TESTS=ON -DDISABLE_META_CPP=ON'
188+
clcacheDir: 'C:\\Users\\VssAdministrator\\clcache'
189+
clcacheArtifactName: 'clcache-$(interfaceName)'
190+
clcacheArchive: '$(Build.ArtifactStagingDirectory)/clcache-$(Build.BuildId).tar.gz'
191+
buildConfiguration: Release
192+
buildPlatform: x64
193+
194+
steps:
195+
- template: ./windows-steps.yml
196+
parameters:
197+
swig: true

.ci/docker-steps.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ steps:
55
submodules: true
66

77
- script: mkdir $(ccacheDir) $(targetPrefix)
8-
condition:
98
displayName: Create artifact directories
109

1110
- template: ./download-extract.yml

.ci/download-extract.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,31 @@ steps:
4444
workingDirectory: ${{ parameters.downloadPath }}
4545
failOnStderr: true
4646

47+
# Windows
48+
- powershell: |
49+
$ARTIFACT_DIR = ${{ format('"{0}\{1}"', parameters.downloadPath, parameters.artifactName) }}
50+
if (Test-Path -Path $ARTIFACT_DIR) {
51+
Write-Host "##vso[task.setVariable variable=ARTIFACT_EXISTS;]true"
52+
} else {
53+
Write-Host "##vso[task.setVariable variable=ARTIFACT_EXISTS;]false"
54+
}
55+
displayName: ${{ format('Checking {0} download task status', parameters.name) }}
56+
condition: eq(variables['Agent.OS'], 'Windows_NT')
57+
58+
# Linux and macOS
59+
- bash: |
60+
if [ -d ${{ format('{0}/{1}', parameters.downloadPath, parameters.artifactName) }} ]; then
61+
echo "##vso[task.setVariable variable=ARTIFACT_EXISTS]true"
62+
else
63+
echo "##vso[task.setVariable variable=ARTIFACT_EXISTS]false"
64+
fi
65+
displayName: ${{ format('Checking {0} download task status', parameters.name) }}
66+
condition: ne(variables['Agent.OS'], 'Windows_NT')
67+
4768
- task: ExtractFiles@1
4869
displayName: ${{ format('Extract {0} archive', parameters.name) }}
49-
condition: eq(variables['Agent.JobStatus'], 'Succeeded')
70+
condition: eq(variables.ARTIFACT_EXISTS, 'true')
5071
inputs:
5172
archiveFilePatterns: ${{ format('{0}/{1}/*.tar*', parameters.downloadPath, parameters.artifactName) }}
5273
destinationFolder: ${{ parameters.destinationFolder }}
53-
cleanDestinationFolder: True
74+
cleanDestinationFolder: true

.ci/windows-steps.yml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,57 @@ steps:
99
inputs:
1010
createCustomEnvironment: True
1111
environmentName: shogun
12-
packageSpecs: 'python=3.6.* setuptools numpy scipy eigen rxcpp snappy zlib ctags ply jinja2 gtest mkl-devel'
12+
packageSpecs: 'python=3.6.* setuptools numpy scipy eigen rxcpp snappy zlib ctags ply jinja2 gtest mkl-devel swig'
1313
createOptions: '-c conda-forge'
1414
updateConda: false
1515

1616
- script: |
1717
.ci\\setup_clcache.cmd
1818
displayName: Setup CLCache
1919

20+
- script: mkdir $(targetPrefix)
21+
displayName: Create artifact directory
22+
2023
- template: ./download-extract.yml
2124
parameters:
2225
name: 'CLcache'
2326
artifactName: $(clcacheArtifactName)
2427
destinationFolder: $(clcacheDir)
25-
downloadPath: $(build.binariesDirectory)
28+
downloadPath: $(Build.BinariesDirectory)
29+
30+
- ${{ if eq(parameters.swig, 'true') }}:
31+
- template: ./download-extract.yml
32+
parameters:
33+
name: 'LibShogun'
34+
artifactName: $(libshogunArtifactName)
35+
downloadPath: $(Build.BinariesDirectory)
36+
destinationFolder: $(targetPrefix)
37+
specificBuildWithTriggering: true
2638

2739
- task: CMake@1
2840
displayName: Setup
2941
inputs:
30-
cmakeArgs: '-G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=$(buildConfiguration) -DCMAKE_INSTALL_PREFIX=$(CONDA_PREFIX)\Library -DBUILD_META_EXAMPLES=OFF -DENABLE_TESTING=ON ..'
42+
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) ..'
3143

32-
- task: VSBuild@1
33-
displayName: 'VSBuild ($(buildConfiguration) $(buildPlatform))'
34-
inputs:
35-
solution: 'build/shogun.sln'
36-
vsVersion: 'latest'
37-
platform: $(buildPlatform)
38-
msbuildArchitecture: $(buildPlatform)
39-
msbuildArgs: '/p:TrackFileAccess=false /p:CLToolExe=clcache.exe'
40-
configuration: $(buildConfiguration)
41-
42-
- script: ctest -j%NUMBER_OF_PROCESSORS% -C $(buildConfiguration)
44+
- script: cmake --build . --config $(buildConfiguration) --target INSTALL -- /p:TrackFileAccess=false /p:CLToolExe=clcache.exe /m:2
45+
displayName: 'Build ($(buildConfiguration) $(buildPlatform))'
46+
workingDirectory: $(Build.SourcesDirectory)\build
47+
48+
- script: ctest -j 2
4349
displayName: Test
44-
workingDirectory: build
50+
workingDirectory: $(Build.SourcesDirectory)\build
4551

4652
- script: clcache -s
4753
displayName: CLCache statistics
4854

55+
- ${{ if ne(parameters.swig, 'true') }}:
56+
- template: ./archive-deploy.yml
57+
parameters:
58+
name: 'LibShogun'
59+
dir: $(targetPrefix)
60+
archive: $(libshogunArchive)
61+
artifactName: $(libshogunArtifactName)
62+
4963
- template: ./archive-deploy.yml
5064
parameters:
5165
name: 'CLcache'

cmake/FindCSharp.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ endif( )
6464

6565

6666
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CSharp FOUND_VAR CSHARP_FOUND
67-
REQUIRED_VARS CSHARP_TYPE CSHARP_COMPILER CSHARP_INTERPRETER
67+
REQUIRED_VARS CSHARP_TYPE CSHARP_COMPILER
6868
VERSION_VAR CSHARP_VERSION)
6969

7070
mark_as_advanced( CSHARP_TYPE CSHARP_VERSION CSHARP_COMPILER CSHARP_INTERPRETER CSHARP_PLATFORM CSHARP_SDK )

0 commit comments

Comments
 (0)