]> granicus.if.org Git - graphviz/commitdiff
enable persistent Chocolatey cache in Windows CI jobs
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 2 Nov 2021 00:06:14 +0000 (17:06 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 8 Nov 2021 00:08:23 +0000 (16:08 -0800)
The intention of this change is to accelerate Windows CI jobs, currently one of
the limiting factors on our CI throughput. This change takes a conservative
approach, giving each relevant job its own cache. In theory these jobs could all
share a cache, but the Gitlab docs¹ imply this is only safe if only a single job
has a `push` policy. To do this effectively, we would probably have to create a
new preliminary CI job that only built the cache. Then all other jobs would
become `pull` consumers of this cache. Perhaps an improvement to make in future.

Closes #2143.

¹ https://docs.gitlab.com/ee/ci/yaml/index.html#cachepolicy

.gitlab-ci.yml

index b7ed81dbf6db1baff34a69f965c82745785fd2c4..0ea854c3fe0f22197df7f84b8103922f30e893b3 100644 (file)
@@ -125,6 +125,7 @@ portable-source:
     script:
         - $ErrorActionPreference = "Stop"
         - $PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'
+        - choco config set cacheLocation choco-cache
         - choco install --yes --no-progress --params "/InstallDir:C:\Python3" python3
         - $env:Path = "C:\Python3;" + $env:Path
         - python --version
@@ -481,6 +482,7 @@ windows-cygwin-build:
         # change line endings from crlf to lf
         - git rm --cached -r .
         - git -c core.autocrlf=false reset --hard
+        - choco config set cacheLocation choco-cache
         - choco install --yes --no-progress cygwin
         # avoid BOM in COLLECTION file
         - echo experimental | Out-File COLLECTION -Encoding ascii
@@ -494,6 +496,10 @@ windows-cygwin-build:
             - GRAPHVIZ_VERSION
             - COLLECTION
             - Packages/*/*/*/*/*.xz
+    cache:
+        key: windows-cygwin-build
+        paths:
+            - choco-cache
     tags:
         - windows
     except:
@@ -506,6 +512,7 @@ windows-cygwin-build-using-autogen:
         # change line endings from crlf to lf
         - git rm --cached -r .
         - git -c core.autocrlf=false reset --hard
+        - choco config set cacheLocation choco-cache
         - choco install --yes --no-progress cygwin
         - choco install --yes --no-progress --params "/InstallDir:C:\Python3" python3
         - $env:Path = "C:\Python3;" + $env:Path
@@ -522,6 +529,10 @@ windows-cygwin-build-using-autogen:
         paths:
             - COLLECTION
             - Packages/*/*/*/*/*.xz
+    cache:
+        key: windows-cygwin-build-using-autogen
+        paths:
+            - choco-cache
     tags:
         - windows
     except:
@@ -752,6 +763,10 @@ windows-cmake-Win32-release-build:
         - $Env:project_platform = "Win32"
         - $Env:configuration = "Release"
         - $Env:build_system = "cmake"
+    cache:
+        key: windows-cmake-Win32-release-build
+        paths:
+            - choco-cache
 
 windows-cmake-Win32-debug-build:
     <<: *windows_build_definition
@@ -760,6 +775,10 @@ windows-cmake-Win32-debug-build:
         - $Env:project_platform = "Win32"
         - $Env:configuration = "Debug"
         - $Env:build_system = "cmake"
+    cache:
+        key: windows-cmake-Win32-debug-build
+        paths:
+            - choco-cache
 
 windows-cmake-x64-release-build:
     <<: *windows_build_definition
@@ -768,6 +787,10 @@ windows-cmake-x64-release-build:
         - $Env:project_platform = "x64"
         - $Env:configuration = "Release"
         - $Env:build_system = "cmake"
+    cache:
+        key: windows-cmake-x64-release-build
+        paths:
+            - choco-cache
 
 windows-cmake-x64-debug-build:
     <<: *windows_build_definition
@@ -776,6 +799,10 @@ windows-cmake-x64-debug-build:
         - $Env:project_platform = "x64"
         - $Env:configuration = "Debug"
         - $Env:build_system = "cmake"
+    cache:
+        key: windows-cmake-x64-debug-build
+        paths:
+            - choco-cache
 
 windows-msbuild-Win32-release-build:
     <<: *windows_build_definition
@@ -783,6 +810,10 @@ windows-msbuild-Win32-release-build:
         - $Env:project_platform = "Win32"
         - $Env:configuration = "Release"
         - $Env:build_system = "msbuild"
+    cache:
+        key: windows-msbuild-Win32-release-build
+        paths:
+            - choco-cache
 
 windows-msbuild-Win32-debug-build:
     <<: *windows_build_definition
@@ -790,11 +821,16 @@ windows-msbuild-Win32-debug-build:
         - $Env:project_platform = "Win32"
         - $Env:configuration = "Debug"
         - $Env:build_system = "msbuild"
+    cache:
+        key: windows-msbuild-Win32-debug-build
+        paths:
+            - choco-cache
 
 windows-mingw32-cmake-build:
     stage: build
     needs: []
     script:
+        - choco config set cacheLocation choco-cache
         - choco install --yes --no-progress msys2
         # avoid BOM in COLLECTION file
         - echo experimental | Out-File COLLECTION -Encoding ascii
@@ -807,6 +843,10 @@ windows-mingw32-cmake-build:
             - COLLECTION
             - Packages/*/*/*/*/*.exe
             - Packages/*/*/*/*/*.zip
+    cache:
+        key: windows-mingw32-cmake-build
+        paths:
+            - choco-cache
     tags:
         - windows
     except:
@@ -816,6 +856,7 @@ windows-mingw64-cmake-build:
     stage: build
     needs: []
     script:
+        - choco config set cacheLocation choco-cache
         - choco install --yes --no-progress msys2
         # avoid BOM in COLLECTION file
         - echo experimental | Out-File COLLECTION -Encoding ascii
@@ -828,6 +869,10 @@ windows-mingw64-cmake-build:
             - COLLECTION
             - Packages/*/*/*/*/*.exe
             - Packages/*/*/*/*/*.zip
+    cache:
+        key: windows-mingw64-cmake-build
+        paths:
+            - choco-cache
     tags:
         - windows
     except:
@@ -841,6 +886,7 @@ windows-mingw64-cmake-build:
 #         # change line endings from crlf to lf
 #         - git rm --cached -r .
 #         - git -c core.autocrlf=false reset --hard
+#         - choco config set cacheLocation choco-cache
 #         - choco install --yes --no-progress cygwin
 #         # avoid BOM in COLLECTION file
 #         - echo experimental | Out-File COLLECTION -Encoding ascii
@@ -853,6 +899,10 @@ windows-mingw64-cmake-build:
 #             - COLLECTION
 #             - Packages/*/*/*/*/*.zip
 #             - Packages/*/*/*/*/*.bz2
+#     cache:
+#         key: windows-cygwin-cmake-build
+#         paths:
+#             - choco-cache
 #     tags:
 #         - windows
 #     except: