Skip to content

Commit

Permalink
[CI] Upload build cache before running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AThousandShips committed Jul 13, 2024
1 parent cfc4a0e commit 078210b
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -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}}
Expand Down
17 changes: 17 additions & 0 deletions .github/actions/godot-cache-save/action.yml
Original file line number Diff line number Diff line change
@@ -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}}
8 changes: 6 additions & 2 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ios_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 6 additions & 2 deletions .github/workflows/javascript_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
10 changes: 8 additions & 2 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.*
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/server_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
10 changes: 8 additions & 2 deletions .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 078210b

Please sign in to comment.