Skip to content

Commit

Permalink
add initial azure pipelines definition
Browse files Browse the repository at this point in the history
  • Loading branch information
vigsterkr committed Sep 29, 2018
1 parent e338426 commit b73c36e
Show file tree
Hide file tree
Showing 13 changed files with 445 additions and 141 deletions.
22 changes: 22 additions & 0 deletions .ci/archive-deploy.yml
@@ -0,0 +1,22 @@
parameters:
artifactName: ''
archive: ''
name: ''
dir: ''

steps:
- task: ArchiveFiles@2
displayName: ${{ format('Archive {0}', parameters.name) }}
inputs:
rootFolderOrFile: ${{ parameters.dir }}
includeRootFolder: false
archiveType: tar
tarCompression: xz
archiveFile: ${{ parameters.archive }}

- task: PublishBuildArtifacts@1
displayName: ${{ format('Publish {0} archive', parameters.name) }}
inputs:
pathtoPublish: ${{ parameters.archive }}
artifactName: ${{ parameters.artifactName }}
publishLocation: 'Container'
114 changes: 114 additions & 0 deletions .ci/ci.yml
@@ -0,0 +1,114 @@
jobs:
- job: libshogun
displayName: Linux libshogun CI Tests

pool:
vmImage: ubuntu-16.04

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

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: Linux SWIG Interface CI Tests
dependsOn: libshogun

pool:
vmImage: ubuntu-16.04

strategy:
maxParallel: 7
matrix:
python:
CC: "clang"
CXX: "clang++"
cmakeOptions: '$(commonSWIGCMakeFlags) -DINTERFACE_PYTHON=ON'
interfaceName: 'python'
java:
CC: "clang"
CXX: "clang++"
cmakeOptions: '$(commonSWIGCMakeFlags) -DINTERFACE_JAVA=ON'
interfaceName: 'java'
csharp:
CC: "clang"
CXX: "clang++"
cmakeOptions: '$(commonSWIGCMakeFlags) -DINTERFACE_CSHARP=ON'
interfaceName: 'csharp'
r:
CC: "clang"
CXX: "clang++"
cmakeOptions: '$(commonSWIGCMakeFlags) -DINTERFACE_R=ON'
interfaceName: 'r'
lua:
CC: "clang"
CXX: "clang++"
cmakeOptions: '$(commonSWIGCMakeFlags) -DINTERFACE_LUA=ON'
interfaceName: 'lua'
octave:
CC: "gcc"
CXX: "g++"
cmakeOptions: '$(commonSWIGCMakeFlags) -DINTERFACE_OCTAVE=ON'
interfaceName: 'octave'
ruby:
CC: "clang"
CXX: "clang++"
cmakeOptions: '$(commonSWIGCMakeFlags) -DINTERFACE_RUBY=ON'
interfaceName: 'ruby'

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'
commonSWIGCMakeFlags: '-DLIBSHOGUN=OFF -DDISABLE_UNIT_TESTS=ON -DDISABLE_META_CPP=ON'
ccacheDir: '$(build.binariesDirectory)/ccache'
ccacheArtifactName: 'ccache-$(interfaceName)'
ccacheArchive: '$(Build.ArtifactStagingDirectory)/ccache-$(Build.BuildId).tar.xz'

steps:
- template: ./docker-steps.yml
parameters:
swig: true

- job: macOS
displayName: macOS CI Tests

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

pool:
vmImage: xcode9-macos10.13

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

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

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

- template: ./download-extract.yml
parameters:
name: 'CCache'
artifactName: $(ccacheArtifactName)
destinationFolder: $(ccacheDir)
downloadPath: $(build.binariesDirectory)

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

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

- 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 -DCMAKE_INSTALL_PREFIX=/build/opt $(cmakeOptions) /src'
detached: false

- ${{ if ne(parameters.swig, 'true') }}:
# some of the cpps are just requiring way too much memory
- 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 -j3 -s all'
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 ne(parameters.swig, 'true') }}:
- template: ./archive-deploy.yml
parameters:
name: 'LibShogun'
dir: $(targetPrefix)
archive: $(libshogunArchive)
artifactName: $(libshogunArtifactName)

- template: ./archive-deploy.yml
parameters:
name: 'CCache'
dir: $(ccacheDir)
archive: $(ccacheArchive)
artifactName: $(ccacheArtifactName)
43 changes: 43 additions & 0 deletions .ci/download-extract.yml
@@ -0,0 +1,43 @@
# NOTE: downloadPath and destinationFolder should not be the same!
# as ExtractFiles will create destinationFolder that will result
# in deleting anything in it, including the archive if downloadPath
# is the same as destinationFolder
parameters:
artifactName: ''
downloadPath: ''
name: ''
archiveFilePatterns: ''
destinationFolder: ''
specificBuildWithTriggering: false

steps:
- ${{ if eq(parameters.specificBuildWithTriggering, 'true') }}:
- task: DownloadBuildArtifacts@0
displayName: ${{ format('Download {0} archive', parameters.name) }}
continueOnError: true
inputs:
specificBuildWithTriggering: true
artifactName: ${{ parameters.artifactName }}
downloadPath: ${{ parameters.downloadPath }}


- ${{ if ne(parameters.specificBuildWithTriggering, 'true') }}:
- task: DownloadBuildArtifacts@0
displayName: ${{ format('Download {0} archive', parameters.name) }}
continueOnError: true
inputs:
buildType: 'specific'
project: $(System.TeamProject)
pipeline: $(System.TeamProjectId)
branchName: $(Build.SourceBranch)
buildVersionToDownload: 'latest'
artifactName: ${{ parameters.artifactName }}
downloadPath: ${{ parameters.downloadPath }}

- task: ExtractFiles@1
displayName: ${{ format('Extract {0} archive', parameters.name) }}
continueOnError: true
inputs:
archiveFilePatterns: ${{ format('{0}/{1}/*.tar.xz', parameters.downloadPath, parameters.artifactName) }}
destinationFolder: ${{ parameters.destinationFolder }}
cleanDestinationFolder: True
43 changes: 43 additions & 0 deletions .ci/macos-steps.yml
@@ -0,0 +1,43 @@
steps:
- checkout: self
clean: true
fetchDepth: 5
submodules: true

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

- template: ./download-extract.yml
parameters:
name: 'CCache'
artifactName: $(ccacheArtifactName)
destinationFolder: $(ccacheDir)
downloadPath: $(build.binariesDirectory)

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

- 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
env:
CCACHE_DIR: $(ccacheDir)

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

- template: ./archive-deploy.yml
parameters:
name: 'CCache'
dir: $(ccacheDir)
archive: $(ccacheArchive)
artifactName: $(ccacheArtifactName)
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%

0 comments on commit b73c36e

Please sign in to comment.