Browse Source

CI: Fix cache key and include base branch

The base branch is hardcoded as an env variable as I couldn't find a simple
way to just get either `3.2` or `master`. But it's easy to change when we
branch off from `master` to a new stable branch, which doesn't happen often.

(There's `{{github.base_ref}}` but it's probably more verbose like
`ref/heads/master`, and only valid for PRs.)
Rémi Verschelde 5 years ago
parent
commit
2cf5ad9ea9

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

@@ -3,13 +3,14 @@ on: [push, pull_request]
 
 
 # Global Cache Settings
 # Global Cache Settings
 env:
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_LIMIT: 4096
   SCONS_CACHE_LIMIT: 4096
 
 
 jobs:
 jobs:
   android-template:
   android-template:
     runs-on: "ubuntu-20.04"
     runs-on: "ubuntu-20.04"
 
 
-    name: Android Template (target=release, tools=no)
+    name: Template (target=release, tools=no)
 
 
     steps:
     steps:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
@@ -20,13 +21,13 @@ jobs:
           sudo cp -f misc/ci/sources.list /etc/apt/sources.list
           sudo cp -f misc/ci/sources.list /etc/apt/sources.list
           sudo apt-get update
           sudo apt-get update
 
 
-      # install all packages (except scons)
+      # Install all packages (except scons)
       - name: Configure dependencies
       - name: Configure dependencies
         run: |
         run: |
          sudo apt-get install openjdk-8-jdk
          sudo apt-get install openjdk-8-jdk
          echo "::set-env name=JAVA_HOME::usr/lib/jvm/java-8-openjdk-amd64"
          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: |
         run: |
           echo "::set-env name=PATH::/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:${PATH}"
           echo "::set-env name=PATH::/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:${PATH}"
           java -version
           java -version
@@ -36,20 +37,18 @@ jobs:
           source ~/.bashrc
           source ~/.bashrc
 
 
       # Upload cache on completion and check it out now
       # 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
       - name: Load .scons_cache directory
         id: android-template-cache
         id: android-template-cache
         uses: actions/cache@v2
         uses: actions/cache@v2
         with:
         with:
           path: ${{github.workspace}}/.scons_cache/
           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: |
           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
       - name: Set up Python 3.x
         uses: actions/setup-python@v2
         uses: actions/setup-python@v2
         with:
         with:
@@ -65,6 +64,7 @@ jobs:
           python -m pip install scons
           python -m pip install scons
           python --version
           python --version
           scons --version
           scons --version
+
       - name: Compilation
       - name: Compilation
         env:
         env:
           SCONS_CACHE: ${{github.workspace}}/.scons_cache/
           SCONS_CACHE: ${{github.workspace}}/.scons_cache/

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

@@ -3,6 +3,7 @@ on: [push, pull_request]
 
 
 # Global Cache Settings
 # Global Cache Settings
 env:
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_LIMIT: 4096
   SCONS_CACHE_LIMIT: 4096
   EM_VERSION: latest
   EM_VERSION: latest
   EM_CACHE_FOLDER: 'emsdk-cache'
   EM_CACHE_FOLDER: 'emsdk-cache'
@@ -22,18 +23,16 @@ jobs:
           sudo apt-get update
           sudo apt-get update
 
 
       # Upload cache on completion and check it out now
       # 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
       - name: Load .scons_cache directory
         id: javascript-template-cache
         id: javascript-template-cache
         uses: actions/cache@v2
         uses: actions/cache@v2
         with:
         with:
           path: ${{github.workspace}}/.scons_cache/
           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: |
           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
       # Additional cache for Emscripten generated system libraries
       - name: Load Emscripten cache
       - name: Load Emscripten cache

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

@@ -3,6 +3,7 @@ on: [push, pull_request]
 
 
 # Global Cache Settings
 # Global Cache Settings
 env:
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_LIMIT: 4096
   SCONS_CACHE_LIMIT: 4096
 
 
 jobs:
 jobs:
@@ -26,18 +27,16 @@ jobs:
             libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
             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
       # 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
       - name: Load .scons_cache directory
         id: linux-editor-cache
         id: linux-editor-cache
         uses: actions/cache@v2
         uses: actions/cache@v2
         with:
         with:
           path: ${{github.workspace}}/.scons_cache/
           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: |
           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)
       # Use python 3.x release (works cross platform; best to keep self contained in it's own step)
       - name: Set up Python 3.x
       - 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
             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
       # 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
       - name: Load .scons_cache directory
         id: linux-template-cache
         id: linux-template-cache
         uses: actions/cache@v2
         uses: actions/cache@v2
         with:
         with:
           path: ${{github.workspace}}/.scons_cache/
           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: |
           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
       - name: Set up Python 3.x
@@ -112,6 +109,7 @@ jobs:
           python -m pip install scons
           python -m pip install scons
           python --version
           python --version
           scons --version
           scons --version
+
       - name: Compilation
       - name: Compilation
         env:
         env:
           SCONS_CACHE: ${{github.workspace}}/.scons_cache/
           SCONS_CACHE: ${{github.workspace}}/.scons_cache/

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

@@ -3,6 +3,7 @@ on: [push, pull_request]
 
 
 # Global Cache Settings
 # Global Cache Settings
 env:
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_LIMIT: 4096
   SCONS_CACHE_LIMIT: 4096
 
 
 jobs:
 jobs:
@@ -15,18 +16,16 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
 
 
       # Upload cache on completion and check it out now
       # 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
       - name: Load .scons_cache directory
         id: macos-editor-cache
         id: macos-editor-cache
         uses: actions/cache@v2
         uses: actions/cache@v2
         with:
         with:
           path: ${{github.workspace}}/.scons_cache/
           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: |
           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)
       # Use python 3.x release (works cross platform; best to keep self contained in it's own step)
       - name: Set up Python 3.x
       - name: Set up Python 3.x
@@ -60,18 +59,16 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
 
 
       # Upload cache on completion and check it out now
       # 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
       - name: Load .scons_cache directory
         id: macos-template-cache
         id: macos-template-cache
         uses: actions/cache@v2
         uses: actions/cache@v2
         with:
         with:
           path: ${{github.workspace}}/.scons_cache/
           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: |
           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
       - name: Set up Python 3.x
@@ -89,6 +86,7 @@ jobs:
           python -m pip install scons
           python -m pip install scons
           python --version
           python --version
           scons --version
           scons --version
+
       - name: Compilation
       - name: Compilation
         env:
         env:
           SCONS_CACHE: ${{github.workspace}}/.scons_cache/
           SCONS_CACHE: ${{github.workspace}}/.scons_cache/

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

@@ -4,6 +4,7 @@ on: [push, pull_request]
 # Global Cache Settings
 # Global Cache Settings
 # SCONS_CACHE for windows must be set in the build environment
 # SCONS_CACHE for windows must be set in the build environment
 env:
 env:
+  GODOT_BASE_BRANCH: master
   SCONS_CACHE_MSVC_CONFIG: true
   SCONS_CACHE_MSVC_CONFIG: true
   SCONS_CACHE_LIMIT: 4096
   SCONS_CACHE_LIMIT: 4096
 
 
@@ -18,19 +19,18 @@ jobs:
     steps:
     steps:
     - uses: actions/checkout@v2
     - 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
     - name: Load .scons_cache directory
       id: windows-editor-cache
       id: windows-editor-cache
       uses: RevoluPowered/[email protected]
       uses: RevoluPowered/[email protected]
       with:
       with:
         path: /.scons_cache/
         path: /.scons_cache/
-        key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+        key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
         restore-keys: |
         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)
     # Use python 3.x release (works cross platform; best to keep self contained in it's own step)
     - name: Set up Python 3.x
     - name: Set up Python 3.x
@@ -73,18 +73,17 @@ jobs:
     - uses: actions/checkout@v2
     - uses: actions/checkout@v2
 
 
     # Upload cache on completion and check it out now
     # 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
     - name: Load .scons_cache directory
       id: windows-template-cache
       id: windows-template-cache
       uses: RevoluPowered/[email protected]
       uses: RevoluPowered/[email protected]
       with:
       with:
         path: /.scons_cache/
         path: /.scons_cache/
-        key: ${{github.job}}-${GITHUB_REF##*/}-${{github.sha}}
+        key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
         restore-keys: |
         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
     - name: Set up Python 3.x
@@ -102,6 +101,7 @@ jobs:
         python -m pip install scons pywin32
         python -m pip install scons pywin32
         python --version
         python --version
         scons --version
         scons --version
+
     - name: Compilation
     - name: Compilation
       env:
       env:
         SCONS_CACHE: /.scons_cache/
         SCONS_CACHE: /.scons_cache/