浏览代码

Merge pull request #40652 from akien-mga/ci-more-cache-key

CI: Fix cache key and include base branch
Rémi Verschelde 5 年之前
父节点
当前提交
93b50a62e3

+ 10 - 10
.github/workflows/android_builds.yml

@@ -3,13 +3,14 @@ on: [push, pull_request]
 
 # Global Cache Settings
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_LIMIT: 4096
 
 jobs:
   android-template:
     runs-on: "ubuntu-20.04"
 
-    name: Android Template (target=release, tools=no)
+    name: Template (target=release, tools=no)
 
     steps:
       - uses: actions/checkout@v2
@@ -20,13 +21,13 @@ jobs:
           sudo cp -f misc/ci/sources.list /etc/apt/sources.list
           sudo apt-get update
 
-      # install all packages (except scons)
+      # Install all packages (except scons)
       - name: Configure dependencies
         run: |
          sudo apt-get install openjdk-8-jdk
          echo "::set-env name=JAVA_HOME::usr/lib/jvm/java-8-openjdk-amd64"
 
-      - name: Install Android Sdk and Ndk
+      - name: Install Android SDK and NDK
         run: |
           echo "::set-env name=PATH::/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:${PATH}"
           java -version
@@ -36,20 +37,18 @@ jobs:
           source ~/.bashrc
 
       # Upload cache on completion and check it out now
-      # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
-      # Linux with this will work reliably, so not as bad to edit for Linux.
       - name: Load .scons_cache directory
         id: android-template-cache
         uses: actions/cache@v2
         with:
           path: ${{github.workspace}}/.scons_cache/
-          key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+          key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
           restore-keys: |
-            ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
-            ${{github.job}}-${GITHUB_REF##*/}
-            ${{github.job}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}
 
-        # Use python 3.x release (works cross platform)
+      # Use python 3.x release (works cross platform)
       - name: Set up Python 3.x
         uses: actions/setup-python@v2
         with:
@@ -65,6 +64,7 @@ jobs:
           python -m pip install scons
           python --version
           scons --version
+
       - name: Compilation
         env:
           SCONS_CACHE: ${{github.workspace}}/.scons_cache/

+ 5 - 6
.github/workflows/javascript_builds.yml

@@ -3,6 +3,7 @@ on: [push, pull_request]
 
 # Global Cache Settings
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_LIMIT: 4096
   EM_VERSION: latest
   EM_CACHE_FOLDER: 'emsdk-cache'
@@ -22,18 +23,16 @@ jobs:
           sudo apt-get update
 
       # Upload cache on completion and check it out now
-      # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
-      # Linux with this will work reliably, so not as bad to edit for Linux.
       - name: Load .scons_cache directory
         id: javascript-template-cache
         uses: actions/cache@v2
         with:
           path: ${{github.workspace}}/.scons_cache/
-          key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+          key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
           restore-keys: |
-            ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
-            ${{github.job}}-${GITHUB_REF##*/}
-            ${{github.job}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}
 
       # Additional cache for Emscripten generated system libraries
       - name: Load Emscripten cache

+ 10 - 12
.github/workflows/linux_builds.yml

@@ -3,6 +3,7 @@ on: [push, pull_request]
 
 # Global Cache Settings
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_LIMIT: 4096
 
 jobs:
@@ -26,18 +27,16 @@ jobs:
             libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
 
       # Upload cache on completion and check it out now
-      # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
-      # Linux with this will work reliably, so not as bad to edit for Linux.
       - name: Load .scons_cache directory
         id: linux-editor-cache
         uses: actions/cache@v2
         with:
           path: ${{github.workspace}}/.scons_cache/
-          key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+          key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
           restore-keys: |
-            ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
-            ${{github.job}}-${GITHUB_REF##*/}
-            ${{github.job}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}
 
       # Use python 3.x release (works cross platform; best to keep self contained in it's own step)
       - name: Set up Python 3.x
@@ -83,18 +82,16 @@ jobs:
             libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
 
       # Upload cache on completion and check it out now
-      # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
-      # Linux with this will work reliably, so not as bad to edit for Linux.
       - name: Load .scons_cache directory
         id: linux-template-cache
         uses: actions/cache@v2
         with:
           path: ${{github.workspace}}/.scons_cache/
-          key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+          key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
           restore-keys: |
-            ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
-            ${{github.job}}-${GITHUB_REF##*/}
-            ${{github.job}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}
 
       # Use python 3.x release (works cross platform)
       - name: Set up Python 3.x
@@ -112,6 +109,7 @@ jobs:
           python -m pip install scons
           python --version
           scons --version
+
       - name: Compilation
         env:
           SCONS_CACHE: ${{github.workspace}}/.scons_cache/

+ 10 - 12
.github/workflows/macos_builds.yml

@@ -3,6 +3,7 @@ on: [push, pull_request]
 
 # Global Cache Settings
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_LIMIT: 4096
 
 jobs:
@@ -15,18 +16,16 @@ jobs:
       - uses: actions/checkout@v2
 
       # Upload cache on completion and check it out now
-      # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
-      # Linux with this will work reliably, so not as bad to edit for Linux.
       - name: Load .scons_cache directory
         id: macos-editor-cache
         uses: actions/cache@v2
         with:
           path: ${{github.workspace}}/.scons_cache/
-          key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+          key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
           restore-keys: |
-            ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
-            ${{github.job}}-${GITHUB_REF##*/}
-            ${{github.job}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}
 
       # Use python 3.x release (works cross platform; best to keep self contained in it's own step)
       - name: Set up Python 3.x
@@ -60,18 +59,16 @@ jobs:
       - uses: actions/checkout@v2
 
       # Upload cache on completion and check it out now
-      # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
-      # Linux with this will work reliably, so not as bad to edit for Linux.
       - name: Load .scons_cache directory
         id: macos-template-cache
         uses: actions/cache@v2
         with:
           path: ${{github.workspace}}/.scons_cache/
-          key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+          key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
           restore-keys: |
-            ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
-            ${{github.job}}-${GITHUB_REF##*/}
-            ${{github.job}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
+            ${{github.job}}-${{env.GODOT_BASE_BRANCH}}
 
       # Use python 3.x release (works cross platform)
       - name: Set up Python 3.x
@@ -89,6 +86,7 @@ jobs:
           python -m pip install scons
           python --version
           scons --version
+
       - name: Compilation
         env:
           SCONS_CACHE: ${{github.workspace}}/.scons_cache/

+ 13 - 13
.github/workflows/windows_builds.yml

@@ -4,6 +4,7 @@ on: [push, pull_request]
 # Global Cache Settings
 # SCONS_CACHE for windows must be set in the build environment
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_MSVC_CONFIG: true
   SCONS_CACHE_LIMIT: 4096
 
@@ -18,19 +19,18 @@ jobs:
     steps:
     - uses: actions/checkout@v2
 
-    # Upload cache on completion and check it out now
-    # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
-    # Linux with this will work reliably, so not as bad to edit for Linux.
+      # Upload cache on completion and check it out now
+      # Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
     - name: Load .scons_cache directory
       id: windows-editor-cache
       uses: RevoluPowered/[email protected]
       with:
         path: /.scons_cache/
-        key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+        key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
         restore-keys: |
-          ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
-          ${{github.job}}-${GITHUB_REF##*/}
-          ${{github.job}}
+          ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+          ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
+          ${{github.job}}-${{env.GODOT_BASE_BRANCH}}
 
     # Use python 3.x release (works cross platform; best to keep self contained in it's own step)
     - name: Set up Python 3.x
@@ -73,18 +73,17 @@ jobs:
     - uses: actions/checkout@v2
 
     # Upload cache on completion and check it out now
-    # Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
-    # Linux with this will work reliably, so not as bad to edit for Linux.
+    # Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
     - name: Load .scons_cache directory
       id: windows-template-cache
       uses: RevoluPowered/[email protected]
       with:
         path: /.scons_cache/
-        key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+        key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
         restore-keys: |
-          ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
-          ${{github.job}}-${GITHUB_REF##*/}
-          ${{github.job}}
+          ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+          ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
+          ${{github.job}}-${{env.GODOT_BASE_BRANCH}}
 
     # Use python 3.x release (works cross platform)
     - name: Set up Python 3.x
@@ -102,6 +101,7 @@ jobs:
         python -m pip install scons pywin32
         python --version
         scons --version
+
     - name: Compilation
       env:
         SCONS_CACHE: /.scons_cache/