Skip to content

Commit f3a1a2f

Browse files
authored
Merge pull request #1695 from dsnopek/4.3-cherrypicks-3
Cherry-picks for the godot-cpp 4.3 branch - 3rd batch
2 parents 56571dc + 08e4c89 commit f3a1a2f

31 files changed

+703
-307
lines changed

.github/actions/godot-cache-restore/action.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ description: Restore Godot build cache.
33
inputs:
44
cache-name:
55
description: The cache base name (job name by default).
6-
default: "${{github.job}}"
6+
default: ${{ github.job }}
77
scons-cache:
8-
description: The scons cache path.
9-
default: "${{github.workspace}}/.scons-cache/"
8+
description: The SCons cache path.
9+
default: ${{ github.workspace }}/.scons-cache/
10+
1011
runs:
11-
using: "composite"
12+
using: composite
1213
steps:
13-
- name: Restore .scons_cache directory
14-
uses: actions/cache/restore@v3
14+
- name: Restore SCons cache directory
15+
uses: actions/cache/restore@v4
1516
with:
16-
path: ${{inputs.scons-cache}}
17-
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
17+
path: ${{ inputs.scons-cache }}
18+
key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
19+
1820
restore-keys: |
19-
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
20-
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
21-
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}
21+
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
22+
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}
23+
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-refs/heads/${{ env.GODOT_BASE_BRANCH }}
24+
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}

.github/actions/godot-cache-save/action.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ description: Save Godot build cache.
33
inputs:
44
cache-name:
55
description: The cache base name (job name by default).
6-
default: "${{github.job}}"
6+
default: ${{ github.job }}
77
scons-cache:
88
description: The SCons cache path.
9-
default: "${{github.workspace}}/.scons-cache/"
9+
default: ${{ github.workspace }}/.scons-cache/
10+
1011
runs:
11-
using: "composite"
12+
using: composite
1213
steps:
1314
- name: Save SCons cache directory
1415
uses: actions/cache/save@v4
1516
with:
16-
path: ${{inputs.scons-cache}}
17-
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
17+
path: ${{ inputs.scons-cache }}
18+
key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Setup godot-cpp
2+
description: Setup build dependencies for godot-cpp.
3+
4+
inputs:
5+
platform:
6+
required: true
7+
description: Target platform.
8+
em-version:
9+
default: 3.1.62
10+
description: Emscripten version.
11+
windows-compiler:
12+
required: true
13+
description: The compiler toolchain to use on Windows ('mingw' or 'msvc').
14+
type: choice
15+
options:
16+
- mingw
17+
- msvc
18+
default: mingw
19+
mingw-version:
20+
default: 12.2.0
21+
description: MinGW version.
22+
ndk-version:
23+
default: r23c
24+
description: Android NDK version.
25+
scons-version:
26+
default: 4.4.0
27+
description: SCons version.
28+
29+
runs:
30+
using: composite
31+
steps:
32+
- name: Setup Python (for SCons)
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: 3.x
36+
37+
- name: Setup Android dependencies
38+
if: inputs.platform == 'android'
39+
uses: nttld/setup-ndk@v1
40+
with:
41+
ndk-version: ${{ inputs.ndk-version }}
42+
link-to-sdk: true
43+
44+
- name: Setup Web dependencies
45+
if: inputs.platform == 'web'
46+
uses: mymindstorm/setup-emsdk@v14
47+
with:
48+
version: ${{ inputs.em-version }}
49+
no-cache: true
50+
51+
- name: Setup MinGW for Windows/MinGW build
52+
if: inputs.platform == 'windows' && inputs.windows-compiler == 'mingw'
53+
uses: egor-tensin/setup-mingw@v2
54+
with:
55+
version: ${{ inputs.mingw-version }}
56+
57+
- name: Setup SCons
58+
shell: bash
59+
run: |
60+
python -c "import sys; print(sys.version)"
61+
python -m pip install scons==${{ inputs.scons-version }}
62+
scons --version

.github/workflows/ci.yml

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
name: Continuous integration
2-
on: [push, pull_request]
2+
on:
3+
workflow_call:
34

45
env:
56
# Only used for the cache key. Increment version to force clean build.
67
GODOT_BASE_BRANCH: master
78
# Used to select the version of Godot to run the tests with.
8-
GODOT_TEST_VERSION: master
9+
GODOT_TEST_VERSION: 4.3-stable
910

1011
concurrency:
11-
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
12+
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}
1213
cancel-in-progress: true
1314

1415
jobs:
@@ -91,7 +92,6 @@ jobs:
9192
env:
9293
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
9394
EM_VERSION: 3.1.39
94-
EM_CACHE_FOLDER: "emsdk-cache"
9595

9696
steps:
9797
- name: Checkout
@@ -105,34 +105,11 @@ jobs:
105105
cache-name: ${{ matrix.cache-name }}
106106
continue-on-error: true
107107

108-
- name: Set up Python (for SCons)
109-
uses: actions/setup-python@v5
108+
- name: Setup godot-cpp
109+
uses: ./.github/actions/setup-godot-cpp
110110
with:
111-
python-version: '3.x'
112-
113-
- name: Android dependencies
114-
if: ${{ matrix.platform == 'android' }}
115-
uses: nttld/setup-ndk@v1
116-
with:
117-
ndk-version: r23c
118-
link-to-sdk: true
119-
120-
- name: Web dependencies
121-
if: ${{ matrix.platform == 'web' }}
122-
uses: mymindstorm/setup-emsdk@v14
123-
with:
124-
version: ${{env.EM_VERSION}}
125-
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
126-
127-
- name: Setup MinGW for Windows/MinGW build
128-
if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
129-
uses: egor-tensin/setup-mingw@v2
130-
with:
131-
version: 12.2.0
132-
133-
- name: Install scons
134-
run: |
135-
python -m pip install scons==4.0.0
111+
platform: ${{ matrix.platform }}
112+
windows-compiler: ${{ contains(matrix.flags, 'use_mingw=yes') && 'mingw' || 'msvc' }}
136113

137114
- name: Generate godot-cpp sources only
138115
run: |
@@ -161,7 +138,7 @@ jobs:
161138

162139
- name: Download latest Godot artifacts
163140
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
164-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
141+
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
165142
with:
166143
repo: godotengine/godot
167144
branch: master
@@ -175,21 +152,21 @@ jobs:
175152
path: godot-artifacts
176153

177154
- name: Prepare Godot artifacts for testing
178-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
155+
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
179156
run: |
180157
chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
181158
echo "GODOT=$(pwd)/godot-artifacts/godot.linuxbsd.editor.x86_64.mono" >> $GITHUB_ENV
182159
183160
- name: Download requested Godot version for testing
184-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION != 'master' }}
161+
if: matrix.run-tests && env.GODOT_TEST_VERSION != 'master'
185162
run: |
186163
wget "https://github.com/godotengine/godot-builds/releases/download/${GODOT_TEST_VERSION}/Godot_v${GODOT_TEST_VERSION}_linux.x86_64.zip" -O Godot.zip
187164
unzip -a Godot.zip
188165
chmod +x "Godot_v${GODOT_TEST_VERSION}_linux.x86_64"
189166
echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV
190167
191168
- name: Run tests
192-
if: ${{ matrix.run-tests }}
169+
if: matrix.run-tests
193170
run: |
194171
$GODOT --headless --version
195172
cd test

.github/workflows/runner.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 🔗 GHA
2+
on: [push, pull_request, merge_group]
3+
4+
concurrency:
5+
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-runner
6+
cancel-in-progress: true
7+
8+
jobs:
9+
# First stage: Only static checks, fast and prevent expensive builds from running.
10+
11+
static-checks:
12+
if: '!vars.DISABLE_GODOT_CI'
13+
name: 📊 Static Checks
14+
uses: ./.github/workflows/static_checks.yml
15+
16+
# Second stage: Run all the builds and some of the tests.
17+
18+
ci:
19+
name: 🛠️ Continuous Integration
20+
needs: static-checks
21+
uses: ./.github/workflows/ci.yml

.github/workflows/static_checks.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: 📊 Static Checks
2-
on: [push, pull_request]
2+
on:
3+
workflow_call:
34

45
concurrency:
5-
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-static
6+
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-static
67
cancel-in-progress: true
78

89
jobs:
@@ -31,3 +32,7 @@ jobs:
3132
uses: pre-commit/[email protected]
3233
with:
3334
extra_args: --verbose --hook-stage manual --files ${{ env.CHANGED_FILES }}
35+
36+
- name: Check generated files consistency
37+
run:
38+
python misc/scripts/check_get_file_list.py

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ wish to help out, ensure you have an account on GitHub and create a "fork" of
7171
this repository. See [Pull request workflow](https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html)
7272
for instructions.
7373

74-
Please install clang-format and copy the files in `misc/hooks` into `.git/hooks`
75-
so formatting is done before your changes are submitted.
74+
Please install clang-format and the [pre-commit](https://pre-commit.com/) Python framework so formatting is done before your changes are submitted. See the [code style guidelines](https://docs.godotengine.org/en/latest/contributing/development/code_style_guidelines.html#pre-commit-hook) for instructions.
7675

7776
## Getting started
7877

0 commit comments

Comments
 (0)