From 078210bce16b9d7e4109db938560ad17c28a10c7 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Sat, 13 Jul 2024 17:43:37 +0200 Subject: [PATCH] [CI] Upload build cache before running tests --- .../action.yml | 9 ++++----- .github/actions/godot-cache-save/action.yml | 17 +++++++++++++++++ .github/workflows/android_builds.yml | 8 ++++++-- .github/workflows/ios_builds.yml | 8 ++++++-- .github/workflows/javascript_builds.yml | 8 ++++++-- .github/workflows/linux_builds.yml | 10 ++++++++-- .github/workflows/macos_builds.yml | 10 ++++++++-- .github/workflows/server_builds.yml | 10 ++++++++-- .github/workflows/windows_builds.yml | 10 ++++++++-- 9 files changed, 71 insertions(+), 19 deletions(-) rename .github/actions/{godot-cache => godot-cache-restore}/action.yml (77%) create mode 100644 .github/actions/godot-cache-save/action.yml diff --git a/.github/actions/godot-cache/action.yml b/.github/actions/godot-cache-restore/action.yml similarity index 77% rename from .github/actions/godot-cache/action.yml rename to .github/actions/godot-cache-restore/action.yml index e54e6064a73..614a98330d4 100644 --- a/.github/actions/godot-cache/action.yml +++ b/.github/actions/godot-cache-restore/action.yml @@ -1,5 +1,5 @@ -name: Setup Godot build cache -description: Setup Godot build cache. +name: Restore Godot build cache +description: Restore Godot build cache. inputs: cache-name: description: The cache base name (job name by default). @@ -10,9 +10,8 @@ inputs: runs: using: "composite" steps: - # Upload cache on completion and check it out now - - name: Load .scons_cache directory - uses: actions/cache@v4 + - name: Restore .scons_cache directory + uses: actions/cache/restore@v4 with: path: ${{inputs.scons-cache}} key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} diff --git a/.github/actions/godot-cache-save/action.yml b/.github/actions/godot-cache-save/action.yml new file mode 100644 index 00000000000..bb3f18ad85a --- /dev/null +++ b/.github/actions/godot-cache-save/action.yml @@ -0,0 +1,17 @@ +name: Save Godot build cache +description: Save Godot build cache. +inputs: + cache-name: + description: The cache base name (job name by default). + default: "${{github.job}}" + scons-cache: + description: The scons cache path. + default: "${{github.workspace}}/.scons-cache/" +runs: + using: "composite" + steps: + - name: Save .scons_cache directory + uses: actions/cache/save@v4 + with: + path: ${{inputs.scons-cache}} + key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml index e289002ae83..13da21b85c5 100644 --- a/.github/workflows/android_builds.yml +++ b/.github/workflows/android_builds.yml @@ -33,8 +33,8 @@ jobs: distribution: temurin java-version: 17 - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache + - name: Restore Godot build cache + uses: ./.github/actions/godot-cache-restore continue-on-error: true - name: Setup python and scons @@ -56,6 +56,10 @@ jobs: target: release tools: false + - name: Save Godot build cache + uses: ./.github/actions/godot-cache-save + continue-on-error: true + - name: Generate Godot templates run: | cd platform/android/java diff --git a/.github/workflows/ios_builds.yml b/.github/workflows/ios_builds.yml index 8dc4e9aa184..1f0bfed3fb4 100644 --- a/.github/workflows/ios_builds.yml +++ b/.github/workflows/ios_builds.yml @@ -20,8 +20,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache + - name: Restore Godot build cache + uses: ./.github/actions/godot-cache-restore continue-on-error: true - name: Setup python and scons @@ -35,5 +35,9 @@ jobs: target: release tools: false + - name: Save Godot build cache + uses: ./.github/actions/godot-cache-save + continue-on-error: true + - name: Upload artifact uses: ./.github/actions/upload-artifact diff --git a/.github/workflows/javascript_builds.yml b/.github/workflows/javascript_builds.yml index d824c4af66f..c3fde9b23a6 100644 --- a/.github/workflows/javascript_builds.yml +++ b/.github/workflows/javascript_builds.yml @@ -33,8 +33,8 @@ jobs: run: | emcc -v - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache + - name: Restore Godot build cache + uses: ./.github/actions/godot-cache-restore continue-on-error: true - name: Setup python and scons @@ -48,5 +48,9 @@ jobs: target: release tools: false + - name: Save Godot build cache + uses: ./.github/actions/godot-cache-save + continue-on-error: true + - name: Upload artifact uses: ./.github/actions/upload-artifact diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index a4659cca709..2f69ca22856 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -78,8 +78,8 @@ jobs: sudo rm -rf /usr/local/lib/android echo "Disk usage after:" && df -h - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache + - name: Restore Godot build cache + uses: ./.github/actions/godot-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -98,6 +98,12 @@ jobs: target: ${{ matrix.target }} tools: ${{ matrix.tools }} + - name: Save Godot build cache + uses: ./.github/actions/godot-cache-save + with: + cache-name: ${{ matrix.cache-name }} + continue-on-error: true + # Generate mono glue - name: Generate Mono glue code if: ${{ matrix.build-mono }} diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml index f386e2b8d1b..ad73d649583 100644 --- a/.github/workflows/macos_builds.yml +++ b/.github/workflows/macos_builds.yml @@ -34,8 +34,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache + - name: Restore Godot build cache + uses: ./.github/actions/godot-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -51,6 +51,12 @@ jobs: target: ${{ matrix.target }} tools: ${{ matrix.tools }} + - name: Save Godot build cache + uses: ./.github/actions/godot-cache-save + with: + cache-name: ${{ matrix.cache-name }} + continue-on-error: true + - name: Prepare artifact run: | strip bin/godot.* diff --git a/.github/workflows/server_builds.yml b/.github/workflows/server_builds.yml index a6a1f99fcf3..8758574015c 100644 --- a/.github/workflows/server_builds.yml +++ b/.github/workflows/server_builds.yml @@ -45,8 +45,8 @@ jobs: libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \ libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache + - name: Restore Godot build cache + uses: ./.github/actions/godot-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -61,3 +61,9 @@ jobs: platform: server target: ${{ matrix.target }} tools: ${{ matrix.tools }} + + - name: Save Godot build cache + uses: ./.github/actions/godot-cache-save + with: + cache-name: ${{ matrix.cache-name }} + continue-on-error: true diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index 8729984dca7..ea3e9054ec1 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -37,8 +37,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache + - name: Restore Godot build cache + uses: ./.github/actions/godot-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -57,6 +57,12 @@ jobs: target: ${{ matrix.target }} tools: ${{ matrix.tools }} + - name: Save Godot build cache + uses: ./.github/actions/godot-cache-save + with: + cache-name: ${{ matrix.cache-name }} + continue-on-error: true + - name: Prepare artifact run: | Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force