Skip to content

Commit 7058336

Browse files
hjmjohnsonclaude
andcommitted
ENH: Add ccache support to all Azure Pipelines CI jobs
For each job across all 7 AzurePipelines yml files: - Add CCACHE_DIR variable pointing to $(Pipeline.Workspace)/.ccache - Install ccache via apt-get (Linux), brew (macOS), or choco (Windows) - Add Cache@2 task to restore/save the ccache directory keyed on Agent.OS and Build.SourceVersion with OS-only restoreKeys fallback - Inject CMAKE_C_COMPILER_LAUNCHER and CMAKE_CXX_COMPILER_LAUNCHER into dashboard_cache so the CTest dashboard configure step picks them up - Set CCACHE_MAXSIZE=5G on each build step env Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 69fbadb commit 7058336

8 files changed

Lines changed: 123 additions & 3 deletions

Testing/ContinuousIntegration/AzurePipelinesBatch.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pr: none
1212

1313
variables:
1414
ExternalDataVersion: 5.4.5
15+
CCACHE_DIR: $(Pipeline.Workspace)/.ccache
1516
jobs:
1617
- job: Windows
1718
timeoutInMinutes: 0
@@ -51,6 +52,7 @@ jobs:
5152
pip3 install ninja
5253
pip3 install --upgrade setuptools
5354
pip3 install lxml scikit-ci-addons
55+
choco install ccache -y
5456
displayName: 'Install dependencies'
5557
5658
- script: |
@@ -62,6 +64,14 @@ jobs:
6264
workingDirectory: $(Agent.BuildDirectory)
6365
displayName: 'Download dashboard script and testing data'
6466
67+
- task: Cache@2
68+
inputs:
69+
key: '"ccache" | "$(Agent.OS)" | "$(Build.SourceVersion)"'
70+
restoreKeys: |
71+
"ccache" | "$(Agent.OS)"
72+
path: $(CCACHE_DIR)
73+
displayName: 'Restore ccache'
74+
6575
- bash: |
6676
cat > dashboard.cmake << EOF
6777
set(CTEST_BUILD_CONFIGURATION "$(CTEST_CONFIGURATION_TYPE)")
@@ -72,6 +82,9 @@ jobs:
7282
BUILD_SHARED_LIBS:BOOL=ON
7383
BUILD_EXAMPLES:BOOL=OFF
7484
ITK_WRAP_PYTHON:BOOL=OFF
85+
ITK_USE_CCACHE:BOOL=ON
86+
CMAKE_C_COMPILER_LAUNCHER:STRING=ccache
87+
CMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
7588
")
7689
include(\$ENV{AGENT_BUILDDIRECTORY}/ITK-dashboard/azure_dashboard.cmake)
7790
EOF
@@ -86,6 +99,7 @@ jobs:
8699
displayName: 'Build and test'
87100
env:
88101
CTEST_OUTPUT_ON_FAILURE: 1
102+
CCACHE_MAXSIZE: 11G
89103
90104
- script: |
91105
ci_addons ctest_junit_formatter $(Build.SourcesDirectory)-build > $(Agent.BuildDirectory)/JUnitTestResults.xml

Testing/ContinuousIntegration/AzurePipelinesLinux.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pr:
2828
- Modules/Remote/*.remote.cmake
2929
variables:
3030
ExternalDataVersion: 5.4.5
31+
CCACHE_DIR: $(Pipeline.Workspace)/.ccache
3132
jobs:
3233
- job: Linux
3334
timeoutInMinutes: 0
@@ -54,7 +55,7 @@ jobs:
5455
set -x
5556
sudo pip3 install ninja
5657
sudo apt-get update
57-
sudo apt-get install -y python3-venv
58+
sudo apt-get install -y python3-venv ccache
5859
sudo python3 -m pip install lxml scikit-ci-addons
5960
displayName: 'Install dependencies'
6061
@@ -68,6 +69,14 @@ jobs:
6869
workingDirectory: $(Agent.BuildDirectory)
6970
displayName: 'Download dashboard script and testing data'
7071
72+
- task: Cache@2
73+
inputs:
74+
key: '"ccache" | "$(Agent.OS)" | "$(Build.SourceVersion)"'
75+
restoreKeys: |
76+
"ccache" | "$(Agent.OS)"
77+
path: $(CCACHE_DIR)
78+
displayName: 'Restore ccache'
79+
7180
- bash: |
7281
cat > dashboard.cmake << EOF
7382
set(CTEST_BUILD_CONFIGURATION "MinSizeRel")
@@ -76,6 +85,9 @@ jobs:
7685
BUILD_SHARED_LIBS:BOOL=OFF
7786
BUILD_EXAMPLES:BOOL=OFF
7887
ITK_WRAP_PYTHON:BOOL=OFF
88+
ITK_USE_CCACHE:BOOL=ON
89+
CMAKE_C_COMPILER_LAUNCHER:STRING=ccache
90+
CMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
7991
")
8092
set(CTEST_TEST_ARGS EXCLUDE_LABEL BigIO) # Disabled to conserve disk space
8193
include(\$ENV{AGENT_BUILDDIRECTORY}/ITK-dashboard/azure_dashboard.cmake)
@@ -94,6 +106,7 @@ jobs:
94106
displayName: 'Build and test'
95107
env:
96108
CTEST_OUTPUT_ON_FAILURE: 1
109+
CCACHE_MAXSIZE: 11G
97110
98111
- script: |
99112
ci_addons ctest_junit_formatter $(Build.SourcesDirectory)-build > $(Agent.BuildDirectory)/JUnitTestResults.xml
@@ -127,7 +140,7 @@ jobs:
127140
set -x
128141
sudo pip3 install ninja
129142
sudo apt-get update
130-
sudo apt-get install -y python3-venv
143+
sudo apt-get install -y python3-venv ccache
131144
sudo python3 -m pip install lxml scikit-ci-addons
132145
displayName: 'Install dependencies'
133146
@@ -141,6 +154,14 @@ jobs:
141154
workingDirectory: $(Agent.BuildDirectory)
142155
displayName: 'Download dashboard script and testing data'
143156
157+
- task: Cache@2
158+
inputs:
159+
key: '"ccache" | "$(Agent.OS)" | "$(Build.SourceVersion)"'
160+
restoreKeys: |
161+
"ccache" | "$(Agent.OS)"
162+
path: $(CCACHE_DIR)
163+
displayName: 'Restore ccache'
164+
144165
- bash: |
145166
cat > dashboard.cmake << EOF
146167
set(CTEST_BUILD_CONFIGURATION "MinSizeRel")
@@ -151,6 +172,8 @@ jobs:
151172
BUILD_SHARED_LIBS:BOOL=OFF
152173
BUILD_EXAMPLES:BOOL=OFF
153174
ITK_WRAP_PYTHON:BOOL=OFF
175+
CMAKE_C_COMPILER_LAUNCHER:STRING=ccache
176+
CMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
154177
")
155178
set(CTEST_TEST_ARGS EXCLUDE_LABEL BigIO) # Disabled to conserve disk space
156179
include(\$ENV{AGENT_BUILDDIRECTORY}/ITK-dashboard/azure_dashboard.cmake)
@@ -169,6 +192,7 @@ jobs:
169192
displayName: 'Build and test'
170193
env:
171194
CTEST_OUTPUT_ON_FAILURE: 1
195+
CCACHE_MAXSIZE: 11G
172196
173197
- script: |
174198
ci_addons ctest_junit_formatter $(Build.SourcesDirectory)-build > $(Agent.BuildDirectory)/JUnitTestResults.xml
@@ -205,7 +229,7 @@ jobs:
205229
set -x
206230
sudo pip3 install ninja
207231
sudo apt-get update
208-
sudo apt-get install -y python3-venv
232+
sudo apt-get install -y python3-venv ccache
209233
sudo python3 -m pip install lxml scikit-ci-addons
210234
displayName: "Install dependencies"
211235
- bash: |
@@ -216,6 +240,13 @@ jobs:
216240
cmake -E rename InsightToolkit-$(ExternalDataVersion)/.ExternalData/CID $(Build.SourcesDirectory)/.ExternalData/CID
217241
workingDirectory: $(Agent.BuildDirectory)
218242
displayName: "Download dashboard script and testing data"
243+
- task: Cache@2
244+
inputs:
245+
key: '"ccache" | "$(Agent.OS)" | "$(Build.SourceVersion)"'
246+
restoreKeys: |
247+
"ccache" | "$(Agent.OS)"
248+
path: $(CCACHE_DIR)
249+
displayName: 'Restore ccache'
219250
- bash: |
220251
cat > dashboard.cmake << EOF
221252
set(CTEST_BUILD_CONFIGURATION "MinSizeRel")
@@ -227,6 +258,8 @@ jobs:
227258
BUILD_SHARED_LIBS:BOOL=OFF
228259
BUILD_EXAMPLES:BOOL=OFF
229260
ITK_WRAP_PYTHON:BOOL=OFF
261+
CMAKE_C_COMPILER_LAUNCHER:STRING=ccache
262+
CMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
230263
")
231264
set(CTEST_TEST_ARGS EXCLUDE_LABEL BigIO) # Disabled to conserve disk space
232265
include(\$ENV{AGENT_BUILDDIRECTORY}/ITK-dashboard/azure_dashboard.cmake)
@@ -242,6 +275,7 @@ jobs:
242275
displayName: "Build and test"
243276
env:
244277
CTEST_OUTPUT_ON_FAILURE: 1
278+
CCACHE_MAXSIZE: 11G
245279
- script: |
246280
ci_addons ctest_junit_formatter $(Build.SourcesDirectory)-build > $(Agent.BuildDirectory)/JUnitTestResults.xml
247281
condition: succeededOrFailed()

Testing/ContinuousIntegration/AzurePipelinesLinuxPython.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pr:
2828
- Modules/Remote/*.remote.cmake
2929
variables:
3030
ExternalDataVersion: 5.4.5
31+
CCACHE_DIR: $(Pipeline.Workspace)/.ccache
3132
jobs:
3233
- job: Linux
3334
timeoutInMinutes: 0
@@ -52,6 +53,8 @@ jobs:
5253

5354
- bash: |
5455
set -x
56+
sudo apt-get update
57+
sudo apt-get install -y ccache
5558
python3 -m pip install ninja typing-extensions
5659
python3 -m pip install --upgrade --pre numpy
5760
python3 -m pip install lxml scikit-ci-addons dask distributed
@@ -68,6 +71,14 @@ jobs:
6871
workingDirectory: $(Agent.BuildDirectory)
6972
displayName: 'Download dashboard script and testing data'
7073
74+
- task: Cache@2
75+
inputs:
76+
key: '"ccache" | "$(Agent.OS)" | "$(Build.SourceVersion)"'
77+
restoreKeys: |
78+
"ccache" | "$(Agent.OS)"
79+
path: $(CCACHE_DIR)
80+
displayName: 'Restore ccache'
81+
7182
- bash: |
7283
python_executable=`which python3`
7384
python_root_dir=$(dirname $(dirname ${python_executable}))
@@ -82,6 +93,9 @@ jobs:
8293
BUILD_SHARED_LIBS:BOOL=OFF
8394
BUILD_EXAMPLES:BOOL=OFF
8495
ITK_WRAP_PYTHON:BOOL=ON
96+
ITK_USE_CCACHE:BOOL=ON
97+
CMAKE_C_COMPILER_LAUNCHER:STRING=ccache
98+
CMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
8599
")
86100
include(\$ENV{AGENT_BUILDDIRECTORY}/ITK-dashboard/azure_dashboard.cmake)
87101
EOF
@@ -99,6 +113,7 @@ jobs:
99113
displayName: 'Build and test'
100114
env:
101115
CTEST_OUTPUT_ON_FAILURE: 1
116+
CCACHE_MAXSIZE: 11G
102117
103118
- script: |
104119
ci_addons ctest_junit_formatter $(Build.SourcesDirectory)-build > $(Agent.BuildDirectory)/JUnitTestResults.xml

Testing/ContinuousIntegration/AzurePipelinesMacOS.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pr:
2828
- Modules/Remote/*.remote.cmake
2929
variables:
3030
ExternalDataVersion: 5.4.5
31+
CCACHE_DIR: $(Pipeline.Workspace)/.ccache
3132
jobs:
3233
- job: macOS
3334
timeoutInMinutes: 0
@@ -56,6 +57,7 @@ jobs:
5657
sudo python3 -m pip install --upgrade setuptools
5758
sudo python3 -m pip install scikit-ci-addons
5859
sudo python3 -m pip install lxml
60+
brew install ccache
5961
displayName: Install dependencies
6062
6163
- bash: |
@@ -68,6 +70,14 @@ jobs:
6870
workingDirectory: $(Agent.BuildDirectory)
6971
displayName: 'Download dashboard script and testing data'
7072
73+
- task: Cache@2
74+
inputs:
75+
key: '"ccache" | "$(Agent.OS)" | "$(Build.SourceVersion)"'
76+
restoreKeys: |
77+
"ccache" | "$(Agent.OS)"
78+
path: $(CCACHE_DIR)
79+
displayName: 'Restore ccache'
80+
7181
- bash: |
7282
cat > dashboard.cmake << EOF
7383
set(CTEST_BUILD_CONFIGURATION "Release")
@@ -76,6 +86,9 @@ jobs:
7686
BUILD_SHARED_LIBS:BOOL=ON
7787
BUILD_EXAMPLES:BOOL=ON
7888
ITK_WRAP_PYTHON:BOOL=OFF
89+
ITK_USE_CCACHE:BOOL=ON
90+
CMAKE_C_COMPILER_LAUNCHER:STRING=ccache
91+
CMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
7992
")
8093
include(\$ENV{AGENT_BUILDDIRECTORY}/ITK-dashboard/azure_dashboard.cmake)
8194
EOF
@@ -93,6 +106,7 @@ jobs:
93106
displayName: 'Build and test'
94107
env:
95108
CTEST_OUTPUT_ON_FAILURE: 1
109+
CCACHE_MAXSIZE: 11G
96110
97111
- script: |
98112
ci_addons ctest_junit_formatter $(Build.SourcesDirectory)-build > $(Agent.BuildDirectory)/JUnitTestResults.xml

Testing/ContinuousIntegration/AzurePipelinesMacOSPython.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pr:
2828
- Modules/Remote/*.remote.cmake
2929
variables:
3030
ExternalDataVersion: 5.4.5
31+
CCACHE_DIR: $(Pipeline.Workspace)/.ccache
3132
jobs:
3233
- job: macOS
3334
timeoutInMinutes: 0
@@ -58,6 +59,7 @@ jobs:
5859
sudo python3 -m pip install --upgrade setuptools
5960
sudo python3 -m pip install scikit-ci-addons
6061
sudo python3 -m pip install lxml dask distributed
62+
brew install ccache
6163
displayName: 'Install dependencies'
6264
6365
- bash: |
@@ -71,6 +73,14 @@ jobs:
7173
workingDirectory: $(Agent.BuildDirectory)
7274
displayName: 'Download dashboard script and testing data'
7375
76+
- task: Cache@2
77+
inputs:
78+
key: '"ccache" | "$(Agent.OS)" | "$(Build.SourceVersion)"'
79+
restoreKeys: |
80+
"ccache" | "$(Agent.OS)"
81+
path: $(CCACHE_DIR)
82+
displayName: 'Restore ccache'
83+
7484
- bash: |
7585
python_executable=`which python3`
7686
python_root_dir=$(dirname $(dirname ${python_executable}))
@@ -85,6 +95,9 @@ jobs:
8595
BUILD_SHARED_LIBS:BOOL=OFF
8696
BUILD_EXAMPLES:BOOL=OFF
8797
ITK_WRAP_PYTHON:BOOL=ON
98+
ITK_USE_CCACHE:BOOL=ON
99+
CMAKE_C_COMPILER_LAUNCHER:STRING=ccache
100+
CMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
88101
")
89102
include(\$ENV{AGENT_BUILDDIRECTORY}/ITK-dashboard/azure_dashboard.cmake)
90103
EOF
@@ -102,6 +115,7 @@ jobs:
102115
displayName: 'Build and test'
103116
env:
104117
CTEST_OUTPUT_ON_FAILURE: 1
118+
CCACHE_MAXSIZE: 11G
105119
106120
- script: |
107121
ci_addons ctest_junit_formatter $(Build.SourcesDirectory)-build > $(Agent.BuildDirectory)/JUnitTestResults.xml

Testing/ContinuousIntegration/AzurePipelinesWindows.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pr:
2828
- Modules/Remote/*.remote.cmake
2929
variables:
3030
ExternalDataVersion: 5.4.5
31+
CCACHE_DIR: $(Pipeline.Workspace)/.ccache
3132
jobs:
3233
- job: Windows
3334
timeoutInMinutes: 0
@@ -52,6 +53,7 @@ jobs:
5253
pip3 install ninja
5354
pip3 install --upgrade setuptools
5455
pip3 install scikit-ci-addons lxml
56+
choco install ccache -y
5557
displayName: 'Install dependencies'
5658
5759
- script: |
@@ -63,6 +65,14 @@ jobs:
6365
workingDirectory: $(Agent.BuildDirectory)
6466
displayName: 'Download dashboard script and testing data'
6567
68+
- task: Cache@2
69+
inputs:
70+
key: '"ccache" | "$(Agent.OS)" | "$(Build.SourceVersion)"'
71+
restoreKeys: |
72+
"ccache" | "$(Agent.OS)"
73+
path: $(CCACHE_DIR)
74+
displayName: 'Restore ccache'
75+
6676
- bash: |
6777
cat > dashboard.cmake << EOF
6878
set(CTEST_BUILD_CONFIGURATION "MinSizeRel")
@@ -73,6 +83,9 @@ jobs:
7383
BUILD_SHARED_LIBS:BOOL=ON
7484
BUILD_EXAMPLES:BOOL=OFF
7585
ITK_WRAP_PYTHON:BOOL=OFF
86+
ITK_USE_CCACHE:BOOL=ON
87+
CMAKE_C_COMPILER_LAUNCHER:STRING=ccache
88+
CMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
7689
")
7790
include(\$ENV{AGENT_BUILDDIRECTORY}/ITK-dashboard/azure_dashboard.cmake)
7891
EOF
@@ -87,6 +100,7 @@ jobs:
87100
displayName: 'Build and test'
88101
env:
89102
CTEST_OUTPUT_ON_FAILURE: 1
103+
CCACHE_MAXSIZE: 11G
90104
91105
- script: |
92106
ci_addons ctest_junit_formatter $(Build.SourcesDirectory)-build > $(Agent.BuildDirectory)/JUnitTestResults.xml

0 commit comments

Comments
 (0)