From 8e88531d09b324ee2311272db4da99abc14a5997 Mon Sep 17 00:00:00 2001 From: joshua-spacetime Date: Thu, 30 Jul 2026 12:23:38 -0700 Subject: [PATCH] Fix caching for unity builds --- .github/workflows/ci.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 038334613ec..1e5b2ec392a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -804,11 +804,22 @@ jobs: env: CARGO_TARGET_DIR: ${{ github.workspace }}/target RUST_BACKTRACE: full + UNITY_VERSION: 2022.3.32f1 steps: - name: Checkout repository id: checkout-stdb uses: actions/checkout@v4 + # Keep this before generation/hydration so ignored build outputs do not affect hashFiles. + - name: Restore Unity Library + id: restore-unity-library + uses: actions/cache/restore@v4 + with: + path: demo/Blackholio/client-unity/Library + key: Unity-v2-${{ runner.os }}-${{ env.UNITY_VERSION }}-${{ hashFiles('demo/Blackholio/client-unity/**', 'sdks/csharp/**', 'crates/bindings-csharp/BSATN.Runtime/**', 'crates/bindings-csharp/Runtime/**', 'crates/bindings-csharp/Directory.Build.props', 'tools/regen/src/csharp.rs', 'global.json') }} + restore-keys: | + Unity-v2-${{ runner.os }}-${{ env.UNITY_VERSION }}- + # Run cheap .NET tests first. If those fail, no need to run expensive Unity tests. - name: Setup dotnet @@ -917,16 +928,10 @@ jobs: yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "file:../../../../sdks/csharp"' manifest.json cat manifest.json - - uses: actions/cache@v3 - with: - path: demo/Blackholio/client-unity/Library - key: Unity-${{ github.head_ref }} - restore-keys: Unity- - - name: Run Unity tests uses: game-ci/unity-test-runner@v4 with: - unityVersion: 2022.3.32f1 # Adjust Unity version to a valid tag + unityVersion: ${{ env.UNITY_VERSION }} projectPath: demo/Blackholio/client-unity # Path to the Unity project subdirectory githubToken: ${{ secrets.GITHUB_TOKEN }} testMode: playmode @@ -937,6 +942,13 @@ jobs: UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} + - name: Save Unity Library + if: ${{ github.ref == 'refs/heads/master' && steps.restore-unity-library.outputs.cache-hit != 'true' }} + uses: actions/cache/save@v4 + with: + path: demo/Blackholio/client-unity/Library + key: ${{ steps.restore-unity-library.outputs.cache-primary-key }} + godot-testsuite: needs: [merge_queue_noop, lints] if: ${{ needs.merge_queue_noop.outputs.skip != 'true' }}