Skip to content

Commit

Permalink
add initial azure pipelines definition
Browse files Browse the repository at this point in the history
test macos build
  • Loading branch information
vigsterkr committed Sep 27, 2018
1 parent ef0e4dc commit 70adc12
Show file tree
Hide file tree
Showing 8 changed files with 352 additions and 118 deletions.
95 changes: 95 additions & 0 deletions .ci/ci.yml
@@ -0,0 +1,95 @@
jobs:
- job: libshogun
displayName: Linux libshogun CI Tests

pool:
vmImage: ubuntu-16.04

strategy:
maxParallel: 2
matrix:
clang:
CC: "clang"
CXX: "clang++"
gcc:
CC: "gcc"
CXX: "g++"

variables:
testRunTitle: '$(build.sourceBranchName)-debian'
testRunPlatform: debian
imageName: 'shogun/shogun-dev'
targetPrefix: '$(build.binariesDirectory)/opt'
libshogunArtifactName: 'libshogun-$(CC)'
libshogunArchive: '$(Build.ArtifactStagingDirectory)/libshogun-$(Build.BuildId).tar.xz'
ccacheDir: '$(build.binariesDirectory)/ccache'
ccacheArtifactName: 'ccache-$(CC)'
ccacheArchive: '$(Build.ArtifactStagingDirectory)/ccache-$(Build.BuildId).tar.xz'

steps:
- template: ./docker-steps.yml

- job: swig
displayName: SWIG Interface CI Tests
dependsOn: libshogun

pool:
vmImage: ubuntu-16.04

strategy:
maxParallel: 6
matrix:
python:
CC: "clang"
CXX: "clang++"
cmakeOptions: '-DLIBSHOGUN=OFF -DINTERFACE_PYTHON=ON'
java:
CC: "clang"
CXX: "clang++"
cmakeOptions: '-DLIBSHOGUN=OFF -DINTERFACE_JAVA=ON'
# csharp:
# CC: "clang"
# CXX: "clang++"
# cmakeOptions: '-DLIBSHOGUN=OFF -DINTERFACE_JAVA=ON'
# r:
# CC: "clang"
# CXX: "clang++"
# cmakeOptions: '-DLIBSHOGUN=OFF -DINTERFACE_JAVA=ON'
# lua:
# CC: "clang"
# CXX: "clang++"
# cmakeOptions: '-DLIBSHOGUN=OFF -DINTERFACE_JAVA=ON'
# octave:
# CC: "clang"
# CXX: "clang++"
# cmakeOptions: '-DLIBSHOGUN=OFF -DINTERFACE_JAVA=ON'

variables:
testRunTitle: '$(build.sourceBranchName)-debian'
testRunPlatform: debian
imageName: 'shogun/shogun-dev'
targetPrefix: '$(build.binariesDirectory)/opt'
libshogunArtifactName: 'libshogun-$(CC)'
libshogunArchive: '$(Build.ArtifactStagingDirectory)/libshogun-$(Build.BuildId).tar.xz'

steps:
- template: ./docker-steps.yml

- job: macOS
displayName: macOS CI Tests

variables:
testRunTitle: '$(build.sourceBranchName)-macos'
testRunPlatform: macos
ccacheDir: $(Agent.HomeDirectory)/.ccache
ccacheArtifactName: 'ccache-macos'

pool:
vmImage: xcode9-macos10.13

steps:
- template: ./macos-steps.yml

- template: ./windows-steps.yml
parameters:
buildConfiguration: Release
155 changes: 155 additions & 0 deletions .ci/docker-steps.yml
@@ -0,0 +1,155 @@
steps:
- checkout: self
clean: true
fetchDepth: 5
submodules: true

- script: mkdir $(ccacheDir) $(targetPrefix)
condition:
displayName: Create CCache directory

- task: DownloadBuildArtifacts@0
displayName: 'Download ccache archive'
inputs:
artifactName: $(ccacheArtifactName)
downloadPath: $(build.binariesDirectory)

- task: ExtractFiles@1
displayName: 'Extract ccache archive'
inputs:
archiveFilePatterns: '$(build.binariesDirectory)/*.tar.xz'
destinationFolder: $(ccacheDir)
cleanDestinationFolder: True

- ${{ if ne(parameters.cmakeOptions, '') }}:
- task: DownloadBuildArtifacts@0
displayName: 'Download libshogun'
inputs:
artifactName: $(libshogunArtifactName)
downloadPath: $(targetPrefix)

- task: ExtractFiles@1
displayName: 'Extract libshogun archive'
inputs:
archiveFilePatterns: '$(targetPrefix)/*.tar.xz'
destinationFolder: $(targetPrefix)
cleanDestinationFolder: True

- script: |
ls -la $(ccacheDir)
displayName: Debug

- task: docker@0
displayName: Setup
inputs:
action: 'Run an image'
imageName: $(imageName)
volumes: |
$(build.sourcesDirectory):/src
$(build.binariesDirectory):/build
envVars: |
CCACHE_DIR=/build/ccache
CC=$(CC)
CXX=$(CXX)
workDir: '/build'
containerCommand: 'cmake -DENABLE_TESTING=ON ${{ parameters.cmakeOptions }} -DCMAKE_INSTALL_PREFIX=/build/opt /src'
detached: false

- ${{ if eq(parameters.cmakeOptions, '') }}:
- task: docker@0
displayName: Build
inputs:
action: 'Run an image'
imageName: $(imageName)
volumes: |
$(build.sourcesDirectory):/src
$(build.binariesDirectory):/build
envVars: |
CCACHE_DIR=/build/ccache
workDir: '/build'
containerCommand: 'make -s shogun'
detached: false

- task: docker@0
displayName: Build
inputs:
action: 'Run an image'
imageName: $(imageName)
volumes: |
$(build.sourcesDirectory):/src
$(build.binariesDirectory):/build
envVars: |
CCACHE_DIR=/build/ccache
workDir: '/build'
containerCommand: 'make -j2 -s all'
detached: false

- ${{ if ne(parameters.cmakeOptions, '') }}:
- task: docker@0
displayName: Build
inputs:
action: 'Run an image'
imageName: $(imageName)
volumes: |
$(build.sourcesDirectory):/src
$(build.binariesDirectory):/build
envVars: |
CCACHE_DIR=/build/ccache
workDir: '/build'
containerCommand: 'make -j2 -s'
detached: false

- task: docker@0
displayName: Install
inputs:
action: 'Run an image'
imageName: $(imageName)
volumes: |
$(build.sourcesDirectory):/src
$(build.binariesDirectory):/build
workDir: '/build'
containerCommand: 'make install'
detached: false

- task: docker@0
displayName: Test
inputs:
action: 'Run an image'
imageName: $(imageName)
volumes: |
$(build.sourcesDirectory):/src
$(build.binariesDirectory):/build
workDir: '/build'
containerCommand: 'ctest --output-on-failure -j 2'
detached: false

- ${{ if eq(parameters.cmakeOptions, '') }}:
- task: ArchiveFiles@2
displayName: 'Archive LibShogun'
inputs:
rootFolderOrFile: $(targetPrefix)
archiveType: tar
tarCompression: xz
archiveFile: $(libshogunArchive)

- task: PublishBuildArtifacts@1
displayName: 'Publish LibShogun archive'
inputs:
pathtoPublish: $(libshogunArchive)
artifactName: $(libshogunArtifactName)
publishLocation: 'Container'

- task: ArchiveFiles@2
displayName: 'Archive CCache'
inputs:
rootFolderOrFile: $(ccacheDir)
archiveType: tar
tarCompression: xz
archiveFile: $(ccacheArchive)

- task: PublishBuildArtifacts@1
displayName: 'Publish CCache archive'
inputs:
pathtoPublish: $(ccacheArchive)
artifactName: $(ccacheArtifactName)
publishLocation: 'Container'
36 changes: 36 additions & 0 deletions .ci/macos-steps.yml
@@ -0,0 +1,36 @@
steps:
- checkout: self
clean: true
fetchDepth: 5
submodules: true

- task: DownloadBuildArtifacts@0
displayName: 'Download ccache'
inputs:
artifactName: $(ccacheArtifactName)
downloadPath: $(ccacheDir)

- bash: |
brew update
brew install cmake ccache pkg-config arpack eigen glpk hdf5 json-c lapack lzo nlopt snappy xz
displayName: Install dependencies
condition: always()

- task: CMake@1
displayName: Setup
inputs:
cmakeArgs: -DBUILD_EXAMPLES=OFF -DBUNDLE_JSON=OFF -DBUNDLE_NLOPT=OFF -DENABLE_TESTING=ON -DENABLE_COVERAGE=OFF -DBUILD_META_EXAMPLES=OFF ..

- script: make -j4
displayName: Build
workingDirectory: build

- script: ctest --output-on-failure -j 2
displayName: Test
workingDirectory: build

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(ccacheDir)
artifactName: $(ccacheArtifactName)
publishLocation: 'Container'
16 changes: 16 additions & 0 deletions .ci/setup_clcache.cmd
@@ -0,0 +1,16 @@
@rem https://github.com/numba/numba/blob/master/buildscripts/incremental/setup_conda_environment.cmd
@rem The cmd /C hack circumvents a regression where conda installs a conda.bat
@rem script in non-root environments.
set CONDA_INSTALL=cmd /C conda install -q -y
set PIP_INSTALL=pip install -q

@echo on

@rem Use clcache for faster builds
pip install -q git+https://github.com/frerich/clcache.git
clcache -s
set CLCACHE_SERVER=1
set CLCACHE_HARDLINK=1
powershell.exe -Command "Start-Process clcache-server"

if %errorlevel% neq 0 exit /b %errorlevel%
49 changes: 49 additions & 0 deletions .ci/windows-steps.yml
@@ -0,0 +1,49 @@
parameters:
buildConfiguration: Release

jobs:
- job: Windows
displayName: Windows CI Tests
pool:
vmImage: 'vs2017-win2016'

strategy:
matrix:
py36:
CONDA_PY: "36"
CONDA_ENV: shogun

steps:
- checkout: self
clean: true
fetchDepth: 5
submodules: true

- task: CondaEnvironment@1
displayName: Install dependencies
inputs:
createCustomEnvironment: True
environmentName: shogun
packageSpecs: 'python=3.6.* setuptools numpy scipy eigen rxcpp cmake snappy zlib ctags ply ninja mkl-devel jinja2'
createOptions: '-c conda-forge'
updateConda: false

- script: |
.ci\\setup_clcache.cmd
displayName: Setup CLCache
- task: CMake@1
displayName: Setup
inputs:
cmakeArgs: '-G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=${{ parameters.buildConfiguration }} -DBUILD_META_EXAMPLES=OFF -DENABLE_TESTING=ON ..'

- task: VSBuild@1
displayName: Build
inputs:
solution: 'build/shogun.sln'
platform: x64
configuration: ${{ parameters.buildConfiguration }}

- script: ctest -j%NUMBER_OF_PROCESSORS% -C ${{ parameters.buildConfiguration }} -V
displayName: Test
workingDirectory: build

0 comments on commit 70adc12

Please sign in to comment.