11parameters :
2- displayName : ' Ubuntu 20.04'
2+ displayName : Ubuntu 20.04
33 ubuntuVersion : ' 20.04'
44 cudaEnabled : false
55 asanEnabled : false
66 cmakeBuildType : Release
77
88jobs :
99- job : ubuntu_build_${{ replace(parameters.ubuntuVersion, '.', '') }}_cuda_${{ parameters.cudaEnabled }}_asan_${{ parameters.asanEnabled }}_${{ parameters.cmakeBuildType }}
10- displayName : ' ${{ parameters.displayName }}'
10+ displayName : ${{ parameters.displayName }}
1111 pool :
1212 vmImage : ' ubuntu-${{ parameters.ubuntuVersion }}'
1313 variables :
14+ CCACHE_DIR : $(Pipeline.Workspace)/ccache
15+ CCACHE_BASEDIR : $(Build.SourcesDirectory)
16+ CCACHE_VERSION : 1
1417 ${{ if eq(parameters.asanEnabled, false) }} :
1518 ctestExclusions : " (mvs/gpu_mat_test)"
1619 ${{ if eq(parameters.asanEnabled, true) }} :
4144 libgl1-mesa-dri \
4245 libunwind-dev \
4346 xvfb
44- displayName: ' Install dependencies'
47+ displayName: Install dependencies
4548
4649 - ${{ if eq(parameters.cudaEnabled, true) }} :
4750 - ${{ if eq(parameters.ubuntuVersion, '22.04') }} :
@@ -53,29 +56,47 @@ jobs:
5356 echo '##vso[task.setvariable variable=CC]/usr/bin/gcc-10'
5457 echo '##vso[task.setvariable variable=CXX]/usr/bin/g++-10'
5558 echo '##vso[task.setvariable variable=CUDAHOSTCXX]/usr/bin/g++-10'
56- displayName: ' Install CUDA'
59+ displayName: Install CUDA
5760 - ${{ if ne(parameters.ubuntuVersion, '22.04') }} :
5861 - script : |
5962 sudo apt-get install -y \
6063 nvidia-cuda-toolkit \
6164 nvidia-cuda-toolkit-gcc
6265 echo '##vso[task.setvariable variable=CC]/usr/bin/cuda-gcc'
6366 echo '##vso[task.setvariable variable=CXX]/usr/bin/cuda-g++'
64- displayName: ' Install CUDA'
67+ displayName: Install CUDA
6568
6669 - ${{ if eq(parameters.asanEnabled, true) }} :
6770 - script : |
6871 sudo apt-get install -y clang-15
6972 echo '##vso[task.setvariable variable=CC]/usr/bin/clang-15'
7073 echo '##vso[task.setvariable variable=CXX]/usr/bin/clang++-15'
71- displayName: ' Install Clang'
74+ displayName: Install Clang
7275
7376 - ${{ if eq(parameters.cmakeBuildType, 'ClangTidy') }} :
7477 - script : |
7578 sudo apt-get install -y clang-15 clang-tidy-15
7679 echo '##vso[task.setvariable variable=CC]/usr/bin/clang-15'
7780 echo '##vso[task.setvariable variable=CXX]/usr/bin/clang++-15'
78- displayName: 'Install Clang'
81+ displayName: Install Clang
82+
83+ - task : Cache@2
84+ inputs :
85+ key : ccache | "$(CCACHE_VERSION)" | "$(Agent.OS)" | "${{ parameters.displayName }}"
86+ restoreKeys : ccache | "$(CCACHE_VERSION)" | "$(Agent.OS)" | "${{ parameters.displayName }}"
87+ path : $(CCACHE_DIR)
88+ displayName : Restore ccache
89+
90+ - script : |
91+ set -x
92+ wget https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz
93+ echo "0b33f39766fe9db67f40418aed6a5b3d7b2f4f7fab025a8213264b77a2d0e1b1 ccache-4.8.2-linux-x86_64.tar.xz" | sha256sum --check
94+ tar xfv ccache-4.8.2-linux-x86_64.tar.xz
95+ mkdir -p "$(CCACHE_DIR)/bin"
96+ mv ./ccache-4.8.2-linux-x86_64/ccache "$(CCACHE_DIR)/bin"
97+ echo "##vso[task.prependpath]$(CCACHE_DIR)/bin"
98+ displayName: Install CCache
99+ condition: ne(variables.CCACHE_RESTORED, 'true')
79100
80101 - script : |
81102 cmake --version
@@ -88,19 +109,27 @@ jobs:
88109 -DCMAKE_CUDA_ARCHITECTURES=50 \
89110 -DASAN_ENABLED=${{ parameters.asanEnabled }}
90111 ninja
91- displayName: 'Configure and build'
112+ displayName: Configure and build
113+
114+ - ${{ if ne(parameters.cmakeBuildType, 'ClangTidy') }} :
115+ - script : |
116+ export DISPLAY=":99.0"
117+ export QT_QPA_PLATFORM="offscreen"
118+ Xvfb :99 &
119+ sleep 3
120+ cd build
121+ ctest -E "$(ctestExclusions)"
122+ tests_pass=$?
123+ if [ $tests_pass -ne 0 ]; then
124+ echo "Tests failed, rerunning with verbose output"
125+ ctest --rerun-failed --output-on-failure
126+ fi
127+ exit $tests_pass
128+ displayName: Run tests
92129
93130 - script : |
94- export DISPLAY=":99.0"
95- export QT_QPA_PLATFORM="offscreen"
96- Xvfb :99 &
97- sleep 3
98- cd build
99- ctest -E "$(ctestExclusions)"
100- tests_pass=$?
101- if [ $tests_pass -ne 0 ]; then
102- echo "Tests failed, rerunning with verbose output"
103- ctest --rerun-failed --output-on-failure
104- fi
105- exit $tests_pass
106- displayName: 'Run tests'
131+ set -x
132+ ccache --show-stats
133+ ccache --evict-older-than 1d
134+ ccache --show-stats
135+ displayName: Cleanup ccache
0 commit comments