Skip to content

Commit

Permalink
Merge pull request #1695 from dsnopek/4.3-cherrypicks-3
Browse files Browse the repository at this point in the history
Cherry-picks for the godot-cpp 4.3 branch - 3rd batch
  • Loading branch information
dsnopek authored Jan 28, 2025
2 parents 56571dc + 08e4c89 commit f3a1a2f
Show file tree
Hide file tree
Showing 31 changed files with 703 additions and 307 deletions.
25 changes: 14 additions & 11 deletions .github/actions/godot-cache-restore/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ description: Restore Godot build cache.
inputs:
cache-name:
description: The cache base name (job name by default).
default: "${{github.job}}"
default: ${{ github.job }}
scons-cache:
description: The scons cache path.
default: "${{github.workspace}}/.scons-cache/"
description: The SCons cache path.
default: ${{ github.workspace }}/.scons-cache/

runs:
using: "composite"
using: composite
steps:
- name: Restore .scons_cache directory
uses: actions/cache/restore@v3
- 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}}
path: ${{ inputs.scons-cache }}
key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}

restore-keys: |
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-refs/heads/${{ env.GODOT_BASE_BRANCH }}
${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}
11 changes: 6 additions & 5 deletions .github/actions/godot-cache-save/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ description: Save Godot build cache.
inputs:
cache-name:
description: The cache base name (job name by default).
default: "${{github.job}}"
default: ${{ github.job }}
scons-cache:
description: The SCons cache path.
default: "${{github.workspace}}/.scons-cache/"
default: ${{ github.workspace }}/.scons-cache/

runs:
using: "composite"
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}}
path: ${{ inputs.scons-cache }}
key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
62 changes: 62 additions & 0 deletions .github/actions/setup-godot-cpp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Setup godot-cpp
description: Setup build dependencies for godot-cpp.

inputs:
platform:
required: true
description: Target platform.
em-version:
default: 3.1.62
description: Emscripten version.
windows-compiler:
required: true
description: The compiler toolchain to use on Windows ('mingw' or 'msvc').
type: choice
options:
- mingw
- msvc
default: mingw
mingw-version:
default: 12.2.0
description: MinGW version.
ndk-version:
default: r23c
description: Android NDK version.
scons-version:
default: 4.4.0
description: SCons version.

runs:
using: composite
steps:
- name: Setup Python (for SCons)
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Setup Android dependencies
if: inputs.platform == 'android'
uses: nttld/setup-ndk@v1
with:
ndk-version: ${{ inputs.ndk-version }}
link-to-sdk: true

- name: Setup Web dependencies
if: inputs.platform == 'web'
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ inputs.em-version }}
no-cache: true

- name: Setup MinGW for Windows/MinGW build
if: inputs.platform == 'windows' && inputs.windows-compiler == 'mingw'
uses: egor-tensin/setup-mingw@v2
with:
version: ${{ inputs.mingw-version }}

- name: Setup SCons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==${{ inputs.scons-version }}
scons --version
47 changes: 12 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: Continuous integration
on: [push, pull_request]
on:
workflow_call:

env:
# Only used for the cache key. Increment version to force clean build.
GODOT_BASE_BRANCH: master
# Used to select the version of Godot to run the tests with.
GODOT_TEST_VERSION: master
GODOT_TEST_VERSION: 4.3-stable

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -91,7 +92,6 @@ jobs:
env:
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
EM_VERSION: 3.1.39
EM_CACHE_FOLDER: "emsdk-cache"

steps:
- name: Checkout
Expand All @@ -105,34 +105,11 @@ jobs:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

- name: Set up Python (for SCons)
uses: actions/setup-python@v5
- name: Setup godot-cpp
uses: ./.github/actions/setup-godot-cpp
with:
python-version: '3.x'

- name: Android dependencies
if: ${{ matrix.platform == 'android' }}
uses: nttld/setup-ndk@v1
with:
ndk-version: r23c
link-to-sdk: true

- name: Web dependencies
if: ${{ matrix.platform == 'web' }}
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}

- name: Setup MinGW for Windows/MinGW build
if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
uses: egor-tensin/setup-mingw@v2
with:
version: 12.2.0

- name: Install scons
run: |
python -m pip install scons==4.0.0
platform: ${{ matrix.platform }}
windows-compiler: ${{ contains(matrix.flags, 'use_mingw=yes') && 'mingw' || 'msvc' }}

- name: Generate godot-cpp sources only
run: |
Expand Down Expand Up @@ -161,7 +138,7 @@ jobs:

- name: Download latest Godot artifacts
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
with:
repo: godotengine/godot
branch: master
Expand All @@ -175,21 +152,21 @@ jobs:
path: godot-artifacts

- name: Prepare Godot artifacts for testing
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
run: |
chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
echo "GODOT=$(pwd)/godot-artifacts/godot.linuxbsd.editor.x86_64.mono" >> $GITHUB_ENV
- name: Download requested Godot version for testing
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION != 'master' }}
if: matrix.run-tests && env.GODOT_TEST_VERSION != 'master'
run: |
wget "https://github.com/godotengine/godot-builds/releases/download/${GODOT_TEST_VERSION}/Godot_v${GODOT_TEST_VERSION}_linux.x86_64.zip" -O Godot.zip
unzip -a Godot.zip
chmod +x "Godot_v${GODOT_TEST_VERSION}_linux.x86_64"
echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV
- name: Run tests
if: ${{ matrix.run-tests }}
if: matrix.run-tests
run: |
$GODOT --headless --version
cd test
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 🔗 GHA
on: [push, pull_request, merge_group]

concurrency:
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-runner
cancel-in-progress: true

jobs:
# First stage: Only static checks, fast and prevent expensive builds from running.

static-checks:
if: '!vars.DISABLE_GODOT_CI'
name: 📊 Static Checks
uses: ./.github/workflows/static_checks.yml

# Second stage: Run all the builds and some of the tests.

ci:
name: 🛠️ Continuous Integration
needs: static-checks
uses: ./.github/workflows/ci.yml
9 changes: 7 additions & 2 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: 📊 Static Checks
on: [push, pull_request]
on:
workflow_call:

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-static
group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-static
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -31,3 +32,7 @@ jobs:
uses: pre-commit/[email protected]
with:
extra_args: --verbose --hook-stage manual --files ${{ env.CHANGED_FILES }}

- name: Check generated files consistency
run:
python misc/scripts/check_get_file_list.py
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ wish to help out, ensure you have an account on GitHub and create a "fork" of
this repository. See [Pull request workflow](https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html)
for instructions.

Please install clang-format and copy the files in `misc/hooks` into `.git/hooks`
so formatting is done before your changes are submitted.
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.

## Getting started

Expand Down
Loading

0 comments on commit f3a1a2f

Please sign in to comment.