From c01fe31aaaa899d4b4faa92ad829df8f523ca020 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 20 Jul 2024 21:07:55 +0200 Subject: [PATCH] Backported: [CI] Upload build cache before running tests. - AThousandShips https://github.com/godotengine/godot/commit/078210bce16b9d7e4109db938560ad17c28a10c7 --- .../action.yml | 9 ++++----- .../actions/pandemonium-cache-save/action.yml | 17 +++++++++++++++++ .github/workflows/android_builds.yml | 8 ++++++-- .github/workflows/android_editor_builds.yml | 8 ++++++-- .github/workflows/http_server_builds.yml | 10 +++++++--- .github/workflows/ios_builds.yml | 8 ++++++-- .github/workflows/javascript_builds.yml | 8 ++++++-- .github/workflows/linux_builds.yml | 8 ++++++-- .github/workflows/macos_builds.yml | 8 ++++++-- .github/workflows/server_builds.yml | 10 +++++++--- .github/workflows/windows_builds.yml | 8 ++++++-- .github/workflows/windows_x86_builds.yml | 8 ++++++-- 12 files changed, 83 insertions(+), 27 deletions(-) rename .github/actions/{pandemonium-cache => pandemonium-cache-restore}/action.yml (76%) create mode 100644 .github/actions/pandemonium-cache-save/action.yml diff --git a/.github/actions/pandemonium-cache/action.yml b/.github/actions/pandemonium-cache-restore/action.yml similarity index 76% rename from .github/actions/pandemonium-cache/action.yml rename to .github/actions/pandemonium-cache-restore/action.yml index 8ae12b18a..b68170e04 100644 --- a/.github/actions/pandemonium-cache/action.yml +++ b/.github/actions/pandemonium-cache-restore/action.yml @@ -1,5 +1,5 @@ -name: Setup Pandemonium build cache -description: Setup Pandemonium build cache. +name: Restore Pandemonium build cache +description: Restore Pandemonium 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.PANDEMONIUM_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} diff --git a/.github/actions/pandemonium-cache-save/action.yml b/.github/actions/pandemonium-cache-save/action.yml new file mode 100644 index 000000000..a3b9802d7 --- /dev/null +++ b/.github/actions/pandemonium-cache-save/action.yml @@ -0,0 +1,17 @@ +name: Save Pandemonium build cache +description: Save Pandemonium 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.PANDEMONIUM_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml index a75149673..23029241d 100644 --- a/.github/workflows/android_builds.yml +++ b/.github/workflows/android_builds.yml @@ -32,8 +32,8 @@ jobs: distribution: temurin java-version: 17 - - name: Setup Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore continue-on-error: true - name: Setup python and scons @@ -55,6 +55,10 @@ jobs: target: release tools: false + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-save + continue-on-error: true + - name: Generate Pandemonium templates run: | cd platform/android/java diff --git a/.github/workflows/android_editor_builds.yml b/.github/workflows/android_editor_builds.yml index 56bcd9ed5..c20fd9cfb 100644 --- a/.github/workflows/android_editor_builds.yml +++ b/.github/workflows/android_editor_builds.yml @@ -32,8 +32,8 @@ jobs: distribution: temurin java-version: 17 - - name: Setup Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore continue-on-error: true - name: Setup python and scons @@ -54,6 +54,10 @@ jobs: platform: android target: release_debug tools: true + + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-save + continue-on-error: true - name: Generate Pandemonium Editor APK run: | diff --git a/.github/workflows/http_server_builds.yml b/.github/workflows/http_server_builds.yml index 55235cb62..f883cb8f2 100644 --- a/.github/workflows/http_server_builds.yml +++ b/.github/workflows/http_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 Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -61,6 +61,10 @@ jobs: platform: server target: ${{ matrix.target }} tools: ${{ matrix.tools }} + + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-save + continue-on-error: true - name: Prepare artifact if: ${{ matrix.artifact }} @@ -72,4 +76,4 @@ jobs: uses: ./.github/actions/upload-artifact if: ${{ matrix.artifact }} with: - name: ${{ matrix.cache-name }} \ No newline at end of file + name: ${{ matrix.cache-name }} diff --git a/.github/workflows/ios_builds.yml b/.github/workflows/ios_builds.yml index ae570b77a..99810d301 100644 --- a/.github/workflows/ios_builds.yml +++ b/.github/workflows/ios_builds.yml @@ -19,8 +19,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore continue-on-error: true - name: Setup python and scons @@ -33,6 +33,10 @@ jobs: platform: iphone target: release tools: false + + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-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 78340e028..c3bec31d1 100644 --- a/.github/workflows/javascript_builds.yml +++ b/.github/workflows/javascript_builds.yml @@ -31,8 +31,8 @@ jobs: run: | emcc -v - - name: Setup Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore continue-on-error: true - name: Setup python and scons @@ -46,5 +46,9 @@ jobs: target: release tools: false + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-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 e0112bdf6..ec8f211d0 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -61,8 +61,8 @@ jobs: sudo rm -rf /usr/local/lib/android echo "Disk usage after:" && df -h - - name: Setup Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -78,6 +78,10 @@ jobs: target: ${{ matrix.target }} tools: ${{ matrix.tools }} + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-save + continue-on-error: true + - name: Prepare artifact if: ${{ matrix.artifact }} run: | diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml index e597f335c..3edfcd8d5 100644 --- a/.github/workflows/macos_builds.yml +++ b/.github/workflows/macos_builds.yml @@ -32,8 +32,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -49,6 +49,10 @@ jobs: target: ${{ matrix.target }} tools: ${{ matrix.tools }} + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-save + continue-on-error: true + - name: Prepare artifact run: | strip bin/pandemonium.* diff --git a/.github/workflows/server_builds.yml b/.github/workflows/server_builds.yml index b923d2376..8a8d1ce6c 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 Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -68,8 +68,12 @@ jobs: strip bin/pandemonium_server.* chmod +x bin/pandemonium_server.* + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-save + continue-on-error: true + - name: Upload artifact uses: ./.github/actions/upload-artifact if: ${{ matrix.artifact }} with: - name: ${{ matrix.cache-name }} \ No newline at end of file + name: ${{ matrix.cache-name }} diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index ad6fd5921..cbbe2b7f1 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -36,8 +36,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -53,6 +53,10 @@ jobs: target: ${{ matrix.target }} tools: ${{ matrix.tools }} + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-save + continue-on-error: true + - name: Prepare artifact run: | Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force diff --git a/.github/workflows/windows_x86_builds.yml b/.github/workflows/windows_x86_builds.yml index 2d9c2d86f..a3ad4b1d1 100644 --- a/.github/workflows/windows_x86_builds.yml +++ b/.github/workflows/windows_x86_builds.yml @@ -36,8 +36,8 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Pandemonium build cache - uses: ./.github/actions/pandemonium-cache + - name: Restore Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -58,6 +58,10 @@ jobs: target: ${{ matrix.target }} tools: ${{ matrix.tools }} + - name: Save Pandemonium build cache + uses: ./.github/actions/pandemonium-cache-save + continue-on-error: true + - name: Prepare artifact run: | Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force