Skip to content

Commit d5e8675

Browse files
committed
[CI] Add concurrency options and scons caching.
1 parent bef1fa0 commit d5e8675

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Setup Godot build cache
2+
description: Setup Godot build cache.
3+
inputs:
4+
cache-name:
5+
description: The cache base name (job name by default).
6+
default: "${{github.job}}"
7+
scons-cache:
8+
description: The scons cache path.
9+
default: "${{github.workspace}}/.scons-cache/"
10+
runs:
11+
using: "composite"
12+
steps:
13+
# Upload cache on completion and check it out now
14+
- name: Load .scons_cache directory
15+
uses: actions/cache@v3
16+
with:
17+
path: ${{inputs.scons-cache}}
18+
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
19+
restore-keys: |
20+
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
21+
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
22+
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}

.github/workflows/ci.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: Continuous integration
22
on: [push, pull_request]
33

4+
env:
5+
# Only used for the cache key. Increment version to force clean build.
6+
GODOT_BASE_BRANCH: master
7+
8+
concurrency:
9+
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
10+
cancel-in-progress: true
11+
412
jobs:
513
build:
614
name: ${{ matrix.name }}
@@ -14,54 +22,70 @@ jobs:
1422
platform: linux
1523
artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
1624
artifact-path: bin/libgodot-cpp.linux.release.x86_64.a
25+
cache-name: linux-x86_64
1726

1827
- name: 🐧 Linux (GCC, Double Precision)
1928
os: ubuntu-18.04
2029
platform: linux
2130
artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release
2231
artifact-path: bin/libgodot-cpp.linux.release.x86_64.a
2332
flags: float=64
33+
cache-name: linux-x86_64-f64
2434

2535
- name: 🏁 Windows (x86_64, MSVC)
2636
os: windows-2019
2737
platform: windows
2838
artifact-name: godot-cpp-windows-msvc2019-x86_64-release
2939
artifact-path: bin/libgodot-cpp.windows.release.x86_64.lib
40+
cache-name: windows-x86_64-msvc
3041

3142
- name: 🏁 Windows (x86_64, MinGW)
3243
os: windows-2019
3344
platform: windows
3445
artifact-name: godot-cpp-linux-mingw-x86_64-release
3546
artifact-path: bin/libgodot-cpp.windows.release.x86_64.a
3647
flags: use_mingw=yes
48+
cache-name: windows-x86_64-mingw
3749

3850
- name: 🍎 macOS (universal)
3951
os: macos-11
4052
platform: macos
4153
artifact-name: godot-cpp-macos-universal-release
4254
artifact-path: bin/libgodot-cpp.macos.release.universal.a
4355
flags: arch=universal
56+
cache-name: macos-universal
4457

4558
- name: 🤖 Android (arm64)
4659
os: ubuntu-18.04
4760
platform: android
4861
artifact-name: godot-cpp-android-arm64-release
4962
artifact-path: bin/libgodot-cpp.android.release.arm64.a
5063
flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME arch=arm64
64+
cache-name: android-arm64
5165

5266
- name: 🍏 iOS (arm64)
5367
os: macos-11
5468
platform: ios
5569
artifact-name: godot-cpp-ios-arm64-release
5670
artifact-path: bin/libgodot-cpp.ios.release.arm64.a
5771
flags: arch=arm64
72+
cache-name: ios-arm64
73+
74+
env:
75+
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
5876

5977
steps:
6078
- name: Checkout
6179
uses: actions/checkout@v3
6280
with:
6381
submodules: recursive
6482

83+
- name: Setup Godot build cache
84+
uses: ./.github/actions/godot-cache
85+
with:
86+
cache-name: ${{ matrix.cache-name }}
87+
continue-on-error: true
88+
6589
- name: Set up Python (for SCons)
6690
uses: actions/setup-python@v4
6791
with:
@@ -83,7 +107,7 @@ jobs:
83107

84108
- name: Build godot-cpp (debug)
85109
run: |
86-
scons platform=${{ matrix.platform }} target=debug generate_bindings=yes ${{ matrix.flags }}
110+
scons platform=${{ matrix.platform }} target=debug ${{ matrix.flags }}
87111
88112
- name: Build test without rebuilding godot-cpp (debug)
89113
run: |

0 commit comments

Comments
 (0)