osquery-1/azure-pipelines.yml
Stefano Bonicatti 08c36472cf Enable Debug builds on the CI (#5626)
* Add an option to avoid generating debug symbols

A new option, OSQUERY_NO_DEBUG_SYMBOLS, has been added
to avoid generating debug symbols when building in Debug or RelWithDebInfo.
This is especially needed on the CI where the disk size is limited
and symbols are not necessary, because we cannot directly access
processes to debug them.

* Enable Debug builds on the CI

Enabled Debug builds on macOS and Linux; a special job has been created
to represent the combined build status of Release and Debug builds.

Also format the other long cmakeArgs line so that there's one argument
per line.

* Run Docker as privileged also in Debug builds

* Simplify azure pipelines configuration

Use strategy and matrix to avoid repeating the script
for Release and Debug builds.
2019-07-10 00:32:26 +02:00

199 lines
4.6 KiB
YAML

trigger:
- master
jobs:
# LINUX
- job: LinuxBuild
displayName: Linux
strategy:
matrix:
Release:
BUILD_TYPE: Release
EXTRA_CMAKE_ARGS:
Debug:
BUILD_TYPE: Debug
EXTRA_CMAKE_ARGS: -DOSQUERY_NO_DEBUG_SYMBOLS=ON
pool:
vmImage: 'Ubuntu-16.04'
container:
image: trailofbits/osql-experimental:ubuntu-18.04
options: --privileged
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=$(BUILD_TYPE)
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DBUILD_TESTING=ON
$(EXTRA_CMAKE_ARGS)
$(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
- script: |
ctest --build-nocmake -V
displayName: "Run tests"
workingDirectory: $(Build.BinariesDirectory)/build
- script: |
echo "##vso[task.setvariable variable=Status;isOutput=true]1"
name: JobResult
- job: Linux
pool:
vmImage: 'Ubuntu-16.04'
condition: succeededOrFailed()
dependsOn:
- LinuxBuild
variables:
LinuxReleaseStatus: $[ dependencies.LinuxBuild.outputs['Release.JobResult.Status'] ]
LinuxDebugStatus: $[ dependencies.LinuxBuild.outputs['Debug.JobResult.Status'] ]
steps:
- checkout: none
- script: |
if [ -z "$(LinuxReleaseStatus)" ] || [ -z "$(LinuxDebugStatus)" ]; then
exit 1
fi
displayName: "Detect Linux Release and Debug build status"
# LINUX
# MACOS
- job: macOSBuild
displayName: macOS
strategy:
matrix:
Release:
BUILD_TYPE: Release
EXTRA_CMAKE_ARGS:
Debug:
BUILD_TYPE: Debug
EXTRA_CMAKE_ARGS: -DOSQUERY_NO_DEBUG_SYMBOLS=ON
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=$(BUILD_TYPE) -DBUILD_TESTING=ON $(EXTRA_CMAKE_ARGS) $(Build.SourcesDirectory)
- task: CMake@1
displayName: "Build osquery"
inputs:
workingDirectory: $(Build.BinariesDirectory)/build
cmakeArgs: --build . -j 3
- script: |
ctest --build-nocmake -V
displayName: "Run tests"
workingDirectory: $(Build.BinariesDirectory)/build
- script: |
echo "##vso[task.setvariable variable=Status;isOutput=true]1"
name: JobResult
- job: macOS
pool:
vmImage: 'Ubuntu-16.04'
condition: succeededOrFailed()
dependsOn:
- macOSBuild
variables:
macOSReleaseStatus: $[ dependencies.macOSBuild.outputs['Release.JobResult.Status'] ]
macOSDebugStatus: $[ dependencies.macOSBuild.outputs['Debug.JobResult.Status'] ]
steps:
- checkout: none
- script: |
if [ -z "$(macOSReleaseStatus)" ] || [ -z "$(macOSDebugStatus)" ]; then
exit 1
fi
displayName: "Detect macOS Release and Debug build status"
# MACOS
# WINDOWS
- job: Windows
pool:
vmImage: vs2017-win2016
steps:
- powershell: |
git config --global core.autocrlf false
- checkout: self
- 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
- powershell: |
ctest --build-nocmake -C Release -V
displayName: "Run tests"
workingDirectory: $(Build.BinariesDirectory)/build
# WINDOWS