Skip to content

Truly independent web browser

CI: Restrict cache uploads to master workflows

Timothy Flynn42c76d2d47c2
diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml
index 0d8024e2fae..b1a8d8f1ae6 100644
--- a/.github/actions/build/action.yml
+++ b/.github/actions/build/action.yml
@@ -109,11 +109,12 @@ runs:
sccache_path: ${{ steps.setup.outputs.sccache_path }}
vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}
- - name: Cache the WebAssembly spec test suite
+ - name: Restore the WebAssembly spec test suite
+ id: 'wasm-spec-tests-cache'
if: ${{ inputs.os != 'Windows' }}
- uses: actions/cache@v6
+ uses: actions/cache/restore@v6
with:
- path: ${{ github.workspace }}/caches/WasmSpecTests
+ path: ${{ github.workspace }}/Build/caches/WasmSpecTests
key: wasm-spec-test-suite | ${{ hashFiles('Meta/CMake/wasm_spec_tests.cmake') }}
- name: Set dynamic environment variables
@@ -177,6 +178,13 @@ runs:
shell: bash
run: cmake --install . --strip --prefix "${{ github.workspace }}/Install"
+ - name: Save the WebAssembly spec test suite
+ if: ${{ github.ref == 'refs/heads/master' && inputs.os != 'Windows' && steps.wasm-spec-tests-cache.outputs.cache-hit != 'true' }}
+ uses: actions/cache/save@v6
+ with:
+ path: ${{ github.workspace }}/Build/caches/WasmSpecTests
+ key: ${{ steps.wasm-spec-tests-cache.outputs.cache-primary-key }}
+
- name: Save Caches
uses: ./.github/actions/cache-save
with:
diff --git a/.github/actions/cache-save/action.yml b/.github/actions/cache-save/action.yml
index 25f6c6f5dc9..4ff1624edc8 100644
--- a/.github/actions/cache-save/action.yml
+++ b/.github/actions/cache-save/action.yml
@@ -36,6 +36,7 @@ runs:
ccache --evict-older-than=1d
- name: 'Compiler Cache'
+ if: ${{ github.ref == 'refs/heads/master' }}
uses: actions/cache/save@v6
with:
path: ${{ inputs.ccache_path }}
@@ -56,13 +57,14 @@ runs:
sccache --stop-server || true
- name: 'Rust Compiler Cache'
+ if: ${{ github.ref == 'refs/heads/master' }}
uses: actions/cache/save@v6
with:
path: ${{ inputs.sccache_path }}
key: ${{ inputs.sccache_primary_key }}
- name: 'vcpkg binary cache'
- if: ${{ inputs.vcpkg_cache_primary_key != '' }}
+ if: ${{ github.ref == 'refs/heads/master' && inputs.vcpkg_cache_primary_key != '' }}
uses: actions/cache/save@v6
with:
path: ${{ inputs.vcpkg_cache_path }}
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index 6cf347a3f33..30653ada2f6 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -208,7 +208,7 @@ runs:
# Saved right after the install rather than by actions/cache's post-job step, which runs only if the whole job
# succeeds — so a flaky test would keep the cache from ever being saved.
- name: 'Save wasm-tools'
- if: ${{ inputs.type == 'build' && inputs.os != 'Linux' && steps.wasm-tools-cache.outputs.cache-hit != 'true' }}
+ if: ${{ github.ref == 'refs/heads/master' && inputs.type == 'build' && inputs.os != 'Linux' && steps.wasm-tools-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v6
with:
path: ${{ github.workspace }}/wasm-tools
@@ -275,7 +275,7 @@ runs:
# Saved right after the install rather than by actions/cache's post-job step, which runs only if the whole job
# succeeds — so a flaky test would keep the cache from ever being saved.
- name: 'Save sccache'
- if: ${{ inputs.type == 'build' && steps.sccache-cache.outputs.cache-hit != 'true' }}
+ if: ${{ github.ref == 'refs/heads/master' && inputs.type == 'build' && steps.sccache-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v6
with:
path: ${{ github.workspace }}/sccache
@@ -312,7 +312,7 @@ runs:
# Saved right after the fetch rather than by actions/cache's post-job step, which runs only if the whole job
# succeeds — so a flaky test would keep the cache from ever being saved.
- name: 'Save cargo registry'
- if: ${{ steps.cargo-registry.outputs.cache-hit != 'true' }}
+ if: ${{ github.ref == 'refs/heads/master' && steps.cargo-registry.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v6
with:
path: |