Skip to content

Commit 9b0a5d8

Browse files
committed
[CI] Update actions, add cache for faster builds.
1 parent 1769730 commit 9b0a5d8

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

.github/workflows/build_release.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
name: 🔧 Build -> Package 📦
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+
48
jobs:
59
static-checks:
610
name: 📊 Static Checks (clang-format, black format, file format)
711
runs-on: ubuntu-20.04
812
steps:
913
- name: Checkout
10-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1115

1216
- name: Install dependencies
1317
run: |
@@ -42,48 +46,55 @@ jobs:
4246
gdnative_flags: 'android_arch=x86_64'
4347
sconsflags: ''
4448
os: 'ubuntu-20.04'
49+
cache-name: android-x86_64
4550
- platform: android
4651
arch: 'arm64'
4752
gdnative_flags: 'android_arch=arm64v8'
4853
sconsflags: ''
4954
os: 'ubuntu-20.04'
55+
cache-name: android-arm64
5056

5157
# iOS
5258
- platform: ios
5359
arch: 'x86_64'
5460
gdnative_flags: 'ios_arch=x86_64'
5561
sconsflags: 'ios_simulator=true'
5662
os: 'macos-latest'
63+
cache-name: ios-x86_64-simulator
5764
- platform: ios
5865
arch: 'arm64'
5966
gdnative_flags: 'ios_arch=arm64'
6067
sconsflags: ''
6168
os: 'macos-11'
62-
69+
cache-name: ios-arm64
6370

6471
# Linux
6572
- platform: linux
6673
arch: 'x86_32'
6774
gdnative_flags: 'bits=32'
6875
sconsflags: ''
6976
os: 'ubuntu-20.04'
77+
cache-name: linux-x86_32
7078
- platform: linux
7179
arch: 'x86_64'
7280
gdnative_flags: 'bits=64'
7381
sconsflags: ''
7482
os: 'ubuntu-20.04'
83+
cache-name: linux-x86_64
7584

7685
# macOS
7786
- platform: macos
7887
arch: 'x86_64'
7988
gdnative_flags: 'macos_arch=x86_64 bits=64'
8089
sconsflags: ''
8190
os: 'macos-11'
91+
cache-name: macos-x86_64
8292
- platform: macos
8393
gdnative_flags: 'macos_arch=arm64 bits=64'
8494
arch: 'arm64'
8595
sconsflags: ''
8696
os: 'macos-11'
97+
cache-name: macos-arm64
8798

8899
# Windows
89100
- platform: windows
@@ -92,25 +103,34 @@ jobs:
92103
sconsflags: 'use_mingw=yes'
93104
os: 'ubuntu-20.04'
94105
msvc_arch: amd64_x86
106+
cache-name: win-x86_32
95107
- platform: windows
96108
arch: 'x86_64'
97109
gdnative_flags: 'bits=64'
98110
sconsflags: 'use_mingw=yes'
99111
os: 'ubuntu-20.04'
100112
msvc_arch: amd64
113+
cache-name: win-x86_64
101114

102115
env:
116+
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
103117
SCONSFLAGS: ${{ matrix.sconsflags }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} --jobs=2
104118

105119
defaults:
106120
run:
107121
shell: bash
108122

109123
steps:
110-
- uses: actions/checkout@v2
124+
- uses: actions/checkout@v3
111125
with:
112126
submodules: recursive
113127

128+
- name: Setup Godot build cache
129+
uses: ./godot-cpp/.github/actions/godot-cache
130+
with:
131+
cache-name: ${{ matrix.cache-name }}
132+
continue-on-error: true
133+
114134
- name: Install Windows build dependencies
115135
if: ${{ matrix.platform == 'windows' }}
116136
run: |
@@ -129,7 +149,7 @@ jobs:
129149
sudo apt-get install build-essential gcc-multilib g++-multilib
130150
131151
- name: Set up Python 3.x
132-
uses: actions/setup-python@v2
152+
uses: actions/setup-python@v4
133153
with:
134154
python-version: '3.x'
135155
architecture: 'x64'
@@ -168,7 +188,7 @@ jobs:
168188
needs: build
169189
runs-on: "ubuntu-latest"
170190
steps:
171-
- uses: actions/checkout@v2
191+
- uses: actions/checkout@v3
172192
with:
173193
submodules: recursive
174194

SConstruct

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ if env["godot_version"] == "3":
2828

2929
env = SConscript("godot-cpp-3.x/SConstruct")
3030

31+
scons_cache_path = os.environ.get("SCONS_CACHE")
32+
if scons_cache_path is not None:
33+
CacheDir(scons_cache_path)
34+
Decider("MD5")
35+
3136
# Patch base env
3237
replace_flags(env["CCFLAGS"], {
3338
"-mios-simulator-version-min=10.0": "-mios-simulator-version-min=11.0",

0 commit comments

Comments
 (0)