Skip to content

Commit 85b62c5

Browse files
author
Jean-Marc Hengen
committed
Create Azure DevOps pipeline based on .github/workflows/build_cmake.yml
The Azure DevOps pipeline performs mainly the same steps with some adaptions.
1 parent a78e837 commit 85b62c5

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

azure.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
trigger:
2+
batch: true
3+
branches:
4+
include:
5+
- master
6+
7+
parameters:
8+
- name: buildType
9+
displayName: Build type used during smoke tests.
10+
default: RelWithDebInfo
11+
type: string
12+
values:
13+
- Debug
14+
- Release
15+
- RelWithDebInfo
16+
17+
variables:
18+
- name: Build.CMakeBinariesDirectory
19+
readonly: true
20+
value: $(Build.BinariesDirectory)/build
21+
- name: Build.CCacheDirectory
22+
readonly: true
23+
value: $(Build.BinariesDirectory)/ccache
24+
- name: Conan.SystemRequiresMode
25+
readonly: true
26+
value: enabled
27+
- name: Conan.UserHome
28+
readonly: true
29+
value: $(Build.BinariesDirectory)/conan-cache
30+
- name: Conan.UserHomeShort
31+
readonly: true
32+
value: $(Build.BinariesDirectory)/conan-cache/short
33+
34+
jobs:
35+
- job:
36+
37+
pool:
38+
vmImage: ubuntu-20.04
39+
40+
workspace:
41+
clean: outputs
42+
43+
steps:
44+
- checkout: self
45+
clean: true
46+
displayName: Get the software
47+
fetchDepth: 1
48+
49+
- bash: |
50+
sudo apt-get install ccache -y
51+
echo "##vso[task.prependpath]/usr/lib/ccache"
52+
displayName: Install ccache and update PATH to use linked versions of gcc, cc, etc
53+
54+
- bash: echo "##vso[task.setvariable variable=pip.CacheDirectory;]$HOME/.cache/pip"
55+
displayName: Set pip cache directory
56+
57+
- task: Cache@2
58+
displayName: Ccache
59+
inputs:
60+
key: '"Ccache" | "$(Agent.OS)" | "${{ parameters.buildType }}" | "$(Build.SourceVersion)"'
61+
path: $(Build.CCacheDirectory)
62+
restoreKeys: '"Ccache" | "$(Agent.OS)" | "${{ parameters.buildType }}"'
63+
64+
- task: Cache@2
65+
displayName: ConanModules
66+
inputs:
67+
key: '"ConanModules" | "$(Agent.OS)" | "${{ parameters.buildType }}" | $(Build.SourcesDirectory)/CMakeLists.txt | $(Build.SourcesDirectory)/cmake/Conan.cmake'
68+
path: $(Conan.UserHome)
69+
70+
- task: Cache@2
71+
displayName: pip
72+
inputs:
73+
key: '"pip" | "$(Agent.OS)" | "${{ parameters.buildType }}" | $(Build.SourcesDirectory)/CMakeLists.txt | $(Build.SourcesDirectory)/cmake/Conan.cmake'
74+
path: $(pip.CacheDirectory)
75+
76+
- bash: |
77+
python3 -m pip install --upgrade pip setuptools
78+
python3 -m pip install conan
79+
source ~/.profile
80+
displayName: Install conan
81+
82+
- task: CMake@1
83+
displayName: Create Build Environment
84+
inputs:
85+
cmakeArgs: -E make_directory $(Build.CMakeBinariesDirectory)
86+
87+
- task: CMake@1
88+
displayName: Configure CMake
89+
inputs:
90+
cmakeArgs: -DCMAKE_BUILD_TYPE=${{ parameters.buildType }} -S "$(Build.SourcesDirectory)" -B "$(Build.CMakeBinariesDirectory)"
91+
env:
92+
CCACHE_DIR: $(Build.CCacheDirectory)
93+
CONAN_SYSREQUIRES_MODE: $(Conan.SystemRequiresMode)
94+
CONAN_USER_HOME: $(Conan.UserHome)
95+
CONAN_USER_HOME_SHORT: $(Conan.UserHomeShort)
96+
97+
- task: CMake@1
98+
displayName: Build
99+
inputs:
100+
cmakeArgs: --build . --config ${{ parameters.buildType }} --parallel --verbose
101+
workingDirectory: $(Build.CMakeBinariesDirectory)
102+
env:
103+
CCACHE_DIR: $(Build.CCacheDirectory)
104+
105+
- bash: ctest -C ${{ parameters.buildType }}
106+
displayName: Test
107+
workingDirectory: $(Build.CMakeBinariesDirectory)

0 commit comments

Comments
 (0)