osquery-1/azure-pipelines.yml

235 lines
6.1 KiB
YAML
Raw Normal View History

trigger:
- master
jobs:
# LINUX
- job: LinuxBuild
pool:
vmImage: 'Ubuntu-16.04'
container: trailofbits/osql-experimental:ubuntu-18.04
steps:
- script: mkdir $(Build.BinariesDirectory)/build
displayName: "Create build folder"
- task: CMake@1
displayName: "Configure osquery"
inputs:
workingDirectory: $(Build.BinariesDirectory)/build
cmakeArgs: -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_TESTING=ON $(Build.SourcesDirectory)
- task: CMake@1
displayName: "Check code formatting"
inputs:
workingDirectory: $(Build.BinariesDirectory)/build
cmakeArgs: --build . --target format_check
- task: CMake@1
displayName: "Build osquery"
inputs:
workingDirectory: $(Build.BinariesDirectory)/build
cmakeArgs: --build . -j 3
- task: CopyFiles@2
displayName: "Copy build folder to staging directory"
inputs:
sourceFolder: $(Build.BinariesDirectory)
contents: |
build/**/CTestTestfile.cmake
build/**/*-test
build/test_configs/**
targetFolder: $(Build.ArtifactStagingDirectory)
- script: |
tar -cf build.tar build
displayName: "Tar the build folder"
workingDirectory: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: "Publish build folder for the next job"
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)/build.tar
artifactName: linux-osquery-build
- job: LinuxTest
pool:
vmImage: 'Ubuntu-16.04'
container: trailofbits/osql-experimental:ubuntu-18.04
dependsOn: LinuxBuild
steps:
- checkout: none
- task: DownloadBuildArtifacts@0
displayName: "Download build folder"
inputs:
artifactName: linux-osquery-build
downloadPath: $(Build.BinariesDirectory)
- script: |
tar -xvf linux-osquery-build/build.tar
displayName: "Untar build folder"
workingDirectory: $(Build.BinariesDirectory)
- script: |
ctest --build-nocmake -V
displayName: "Run tests"
workingDirectory: $(Build.BinariesDirectory)/build
env:
GTEST_COLOR: 1
# LINUX
# MACOS
- job: macOSBuild
pool:
vmImage: macos-10.14
steps:
- script: |
brew upgrade
brew install ccache
displayName: "Install Homebrew and prerequisites"
timeoutInMinutes: 20
- script: mkdir $(Build.BinariesDirectory)/build
displayName: "Create build folder"
- task: CMake@1
displayName: "Configure osquery"
inputs:
workingDirectory: $(Build.BinariesDirectory)/build
cmakeArgs: -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON $(Build.SourcesDirectory)
- task: CMake@1
displayName: "Build osquery"
inputs:
workingDirectory: $(Build.BinariesDirectory)/build
cmakeArgs: --build . -j 3
- task: CopyFiles@2
displayName: "Copy build folder to staging directory"
inputs:
sourceFolder: $(Build.BinariesDirectory)
contents: |
build/**/CTestTestfile.cmake
build/**/*-test
build/test_configs/**
targetFolder: $(Build.ArtifactStagingDirectory)
- script: |
tar -cf build.tar build
displayName: "Tar the build folder"
workingDirectory: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: "Publish build folder for the next job"
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)/build.tar
artifactName: macos-osquery-build
- job: macOSTest
pool:
vmImage: macos-10.14
dependsOn: macOSBuild
steps:
- checkout: none
- task: DownloadBuildArtifacts@0
displayName: "Download build folder"
inputs:
artifactName: macos-osquery-build
downloadPath: $(Build.BinariesDirectory)
- script: |
tar -xvf macos-osquery-build/build.tar
displayName: "Untar build folder"
workingDirectory: $(Build.BinariesDirectory)
- script: |
ctest --build-nocmake -V
displayName: "Run tests"
workingDirectory: $(Build.BinariesDirectory)/build
env:
GTEST_COLOR: 1
# MACOS
# WINDOWS
- job: WindowsBuild
pool:
vmImage: vs2017-win2016
steps:
- powershell: |
mkdir $(Build.BinariesDirectory)\build
displayName: "Create build folder"
- task: CMake@1
displayName: "Configure osquery"
inputs:
workingDirectory: $(Build.BinariesDirectory)\build
cmakeArgs: -G "Visual Studio 15 2017 Win64" -T host=x64 -DBUILD_TESTING=ON $(Build.SourcesDirectory)
- task: CMake@1
displayName: "Build osquery"
inputs:
workingDirectory: $(Build.BinariesDirectory)\build
cmakeArgs: --build . -j 3 --config Release
- task: CopyFiles@2
displayName: "Copy build folder to staging directory"
inputs:
sourceFolder: $(Build.BinariesDirectory)
contents: |
build/**/CTestTestfile.cmake
build/**/*-test.exe
build/test_configs/**
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: "Publish build folder for the next job"
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: windows-osquery-build
- job: WindowsTest
pool:
vmImage: vs2017-win2016
dependsOn: WindowsBuild
steps:
- checkout: none
- task: DownloadBuildArtifacts@0
displayName: "Download build folder"
inputs:
artifactName: windows-osquery-build
downloadPath: $(Build.BinariesDirectory)
- powershell: |
mv $(Build.BinariesDirectory)/windows-osquery-build/build $(Build.BinariesDirectory)/build
rmdir $(Build.BinariesDirectory)/windows-osquery-build
displayName: "Move build folder to the original path"
- powershell: |
ctest --build-nocmake -C Release -V
displayName: "Run tests"
workingDirectory: $(Build.BinariesDirectory)/build
env:
GTEST_COLOR: 1
# WINDOWS