1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

CI: Sync configuration with 4.4 branch

Includes cherry-picks of warning fixes from 8d1462c748
and template builds unit tests fixes from 17929a3443
and 832695eb2c.
This commit is contained in:
Rémi Verschelde
2025-04-24 18:14:03 +02:00
parent a175d81064
commit 0841c7af0b
34 changed files with 395 additions and 278 deletions

View File

@@ -1,15 +1,17 @@
name: Download Godot artifact name: Download Godot artifact
description: Download the Godot artifact. description: Download the Godot artifact.
inputs: inputs:
name: name:
description: The artifact name. description: The artifact name.
default: "${{ github.job }}" default: ${{ github.job }}
path: path:
description: The path to download and extract to. description: The path to download and extract to.
required: true required: true
default: "./" default: ./
runs: runs:
using: "composite" using: composite
steps: steps:
- name: Download Godot Artifact - name: Download Godot Artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4

View File

@@ -1,24 +0,0 @@
name: Dump Godot API
description: Dump Godot API for GDExtension
inputs:
bin:
description: The path to the Godot executable
required: true
runs:
using: "composite"
steps:
# Dump GDExtension interface and API
- name: Dump GDExtension interface and API for godot-cpp build
shell: sh
run: |
${{ inputs.bin }} --headless --dump-gdextension-interface --dump-extension-api
mkdir godot-api
cp -f gdextension_interface.h godot-api/
cp -f extension_api.json godot-api/
- name: Upload API dump
uses: ./.github/actions/upload-artifact
with:
name: 'godot-api-dump'
path: './godot-api/*'

View File

@@ -1,36 +1,52 @@
name: Build Godot name: Build Godot
description: Build Godot with the provided options. description: Build Godot with the provided options.
inputs: inputs:
target: target:
description: Build target (editor, template_release, template_debug). description: Build target (editor, template_release, template_debug).
default: "editor" default: editor
tests: tests:
description: Unit tests. description: Unit tests.
default: false default: false
required: false
platform: platform:
description: Target platform. description: Target platform.
required: false required: false
sconsflags: sconsflags:
description: Additional SCons flags.
default: "" default: ""
required: false
scons-cache: scons-cache:
description: The scons cache path. description: The SCons cache path.
default: "${{ github.workspace }}/.scons-cache/" default: ${{ github.workspace }}/.scons_cache/
scons-cache-limit: scons-cache-limit:
description: The scons cache size limit. description: The SCons cache size limit.
# actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk. # actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk.
# Limit to 7 GiB to avoid having the extracted cache fill the disk. # Limit to 7 GiB to avoid having the extracted cache fill the disk.
default: 7168 default: 7168
runs: runs:
using: "composite" using: composite
steps: steps:
- name: Scons Build - name: SCons Build
shell: sh shell: sh
env: env:
SCONSFLAGS: ${{ inputs.sconsflags }} SCONSFLAGS: ${{ inputs.sconsflags }}
SCONS_CACHE: ${{ inputs.scons-cache }} SCONS_CACHE: ${{ inputs.scons-cache }}
SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }} SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
run: | run: |
echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }} echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
if [ "${{ inputs.target }}" != "editor" ]; then rm -rf editor; fi # Ensure we don't include editor code.
if [ "${{ inputs.target }}" != "editor" ]; then
# Ensure we don't include editor code in export template builds.
rm -rf editor
fi
if [ "${{ github.event.number }}" != "" ]; then
# Set build identifier with pull request number if available. This is displayed throughout the editor.
export BUILD_NAME="gh-${{ github.event.number }}"
else
export BUILD_NAME="gh"
fi
scons platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }} scons platform=${{ inputs.platform }} target=${{ inputs.target }} tests=${{ inputs.tests }} ${{ env.SCONSFLAGS }}
ls -l bin/ ls -l bin/

View File

@@ -3,18 +3,19 @@ description: Restore Godot build cache.
inputs: inputs:
cache-name: cache-name:
description: The cache base name (job name by default). description: The cache base name (job name by default).
default: "${{github.job}}" default: ${{ github.job }}
scons-cache: scons-cache:
description: The SCons cache path. description: The SCons cache path.
default: "${{github.workspace}}/.scons-cache/" default: ${{ github.workspace }}/.scons_cache/
runs: runs:
using: "composite" using: composite
steps: steps:
- name: Restore SCons cache directory - name: Restore SCons cache directory
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
path: ${{inputs.scons-cache}} path: ${{ inputs.scons-cache }}
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}
# We try to match an existing cache to restore from it. Each potential key is checked against # We try to match an existing cache to restore from it. Each potential key is checked against
# all existing caches as a prefix. E.g. 'linux-template-minimal' would match any cache that # all existing caches as a prefix. E.g. 'linux-template-minimal' would match any cache that
@@ -28,7 +29,7 @@ runs:
# 4. A partial match for the same base branch only (not ideal, matches any PR with the same base branch). # 4. A partial match for the same base branch only (not ideal, matches any PR with the same base branch).
restore-keys: | restore-keys: |
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} ${{ 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 }}-${{ github.ref }}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-refs/heads/${{env.GODOT_BASE_BRANCH}} ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-refs/heads/${{ env.GODOT_BASE_BRANCH }}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}} ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}

View File

@@ -3,15 +3,16 @@ description: Save Godot build cache.
inputs: inputs:
cache-name: cache-name:
description: The cache base name (job name by default). description: The cache base name (job name by default).
default: "${{github.job}}" default: ${{ github.job }}
scons-cache: scons-cache:
description: The SCons cache path. description: The SCons cache path.
default: "${{github.workspace}}/.scons-cache/" default: ${{ github.workspace }}/.scons_cache/
runs: runs:
using: "composite" using: composite
steps: steps:
- name: Save SCons cache directory - name: Save SCons cache directory
uses: actions/cache/save@v4 uses: actions/cache/save@v4
with: with:
path: ${{inputs.scons-cache}} path: ${{ inputs.scons-cache }}
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} key: ${{ inputs.cache-name }}-${{ env.GODOT_BASE_BRANCH }}-${{ github.ref }}-${{ github.sha }}

View File

@@ -1,11 +1,13 @@
name: Test Godot project converter name: Test Godot project converter
description: Test the Godot project converter. description: Test the Godot project converter.
inputs: inputs:
bin: bin:
description: The path to the Godot executable description: The path to the Godot executable
required: true required: true
runs: runs:
using: "composite" using: composite
steps: steps:
- name: Test 3-to-4 conversion - name: Test 3-to-4 conversion
shell: sh shell: sh

View File

@@ -0,0 +1,40 @@
name: Build godot-cpp
description: Build godot-cpp with the provided options.
inputs:
bin:
description: Path to the Godot binary.
required: true
type: string
scons-flags:
description: Additional SCons flags.
type: string
scons-cache:
description: The SCons cache path.
default: ${{ github.workspace }}/.scons_cache/
type: string
godot-cpp-branch:
description: The godot-cpp branch.
default: master
type: string
runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
repository: godotengine/godot-cpp
ref: ${{ inputs.godot-cpp-branch }}
path: godot-cpp
- name: Extract API
shell: sh
run: ${{ inputs.bin }} --headless --dump-gdextension-interface --dump-extension-api
- name: SCons Build
shell: sh
env:
SCONS_CACHE: ${{ inputs.scons-cache }}
run: scons --directory=./godot-cpp/test "gdextension_dir=${{ github.workspace }}" ${{ inputs.scons-flags }}

View File

@@ -1,27 +1,31 @@
name: Setup python and scons name: Setup Python and SCons
description: Setup python, install the pip version of scons. description: Setup Python, install the pip version of SCons.
inputs: inputs:
python-version: python-version:
description: The python version to use. description: The Python version to use.
default: "3.x" default: 3.x
python-arch: python-arch:
description: The python architecture. description: The Python architecture.
default: "x64" default: x64
scons-version:
description: The SCons version to use.
default: 4.8.1
runs: runs:
using: "composite" using: composite
steps: steps:
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x - name: Set up Python 3.x
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
# Semantic version range syntax or exact version of a Python version # Semantic version range syntax or exact version of a Python version.
python-version: ${{ inputs.python-version }} python-version: ${{ inputs.python-version }}
# Optional - x64 or x86 architecture, defaults to x64 # Optional - x64 or x86 architecture, defaults to x64.
architecture: ${{ inputs.python-arch }} architecture: ${{ inputs.python-arch }}
- name: Setup scons - name: Setup SCons
shell: bash shell: bash
run: | run: |
python -c "import sys; print(sys.version)" python -c "import sys; print(sys.version)"
python -m pip install scons==4.4.0 python -m pip install scons==${{ inputs.scons-version }}
scons --version scons --version

View File

@@ -1,11 +1,13 @@
name: Test Godot project name: Test Godot project
description: Run the test Godot project. description: Run the test Godot project.
inputs: inputs:
bin: bin:
description: The path to the Godot executable description: The path to the Godot executable
required: true required: true
runs: runs:
using: "composite" using: composite
steps: steps:
# Download and extract zip archive with project, folder is renamed to be able to easy change used project # Download and extract zip archive with project, folder is renamed to be able to easy change used project
- name: Download test project - name: Download test project

View File

@@ -1,19 +1,22 @@
name: Upload Godot artifact name: Upload Godot artifact
description: Upload the Godot artifact. description: Upload the Godot artifact.
inputs: inputs:
name: name:
description: The artifact name. description: The artifact name.
default: "${{ github.job }}" default: ${{ github.job }}
path: path:
description: The path to upload. description: The path to upload.
required: true required: true
default: "bin/*" default: bin/*
runs: runs:
using: "composite" using: composite
steps: steps:
- name: Upload Godot Artifact - name: Upload Godot Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ inputs.name }} name: ${{ inputs.name }}
path: ${{ inputs.path }} path: ${{ inputs.path }}
retention-days: 14 # Default is 90 days.
retention-days: 60

View File

@@ -8,17 +8,38 @@ env:
GODOT_BASE_BRANCH: 4.2 GODOT_BASE_BRANCH: 4.2
SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-android
cancel-in-progress: true
jobs: jobs:
android-template: build-android:
runs-on: "ubuntu-20.04" runs-on: ubuntu-24.04
name: Template (target=template_release) name: ${{ matrix.name }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- name: Editor (target=editor)
cache-name: android-editor
target: editor
tests: false
sconsflags: arch=arm64 production=yes
- name: Template arm32 (target=template_release, arch=arm32)
cache-name: android-template-arm32
target: template_release
tests: false
sconsflags: arch=arm32
- name: Template arm64 (target=template_release, arch=arm64)
cache-name: android-template-arm64
target: template_release
tests: false
sconsflags: arch=arm64
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Java 17 - name: Set up Java 17
uses: actions/setup-java@v4 uses: actions/setup-java@v4
@@ -28,37 +49,44 @@ jobs:
- name: Restore Godot build cache - name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore uses: ./.github/actions/godot-cache-restore
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true continue-on-error: true
- name: Setup python and scons - name: Setup Python and SCons
uses: ./.github/actions/godot-deps uses: ./.github/actions/godot-deps
- name: Compilation (arm32) - name: Compilation
uses: ./.github/actions/godot-build uses: ./.github/actions/godot-build
with: with:
sconsflags: ${{ env.SCONSFLAGS }} arch=arm32 sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: android platform: android
target: template_release target: ${{ matrix.target }}
tests: false tests: ${{ matrix.tests }}
- name: Compilation (arm64)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} arch=arm64
platform: android
target: template_release
tests: false
- name: Save Godot build cache - name: Save Godot build cache
uses: ./.github/actions/godot-cache-save uses: ./.github/actions/godot-cache-save
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true continue-on-error: true
- name: Generate Godot templates - name: Generate Godot templates
if: matrix.target == 'template_release'
run: | run: |
cd platform/android/java cd platform/android/java
./gradlew generateGodotTemplates ./gradlew generateGodotTemplates
cd ../../.. cd ../../..
ls -l bin/ ls -l bin/
- name: Generate Godot editor
if: matrix.target == 'editor'
run: |
cd platform/android/java
./gradlew generateGodotEditor
cd ../../..
ls -l bin/android_editor_builds/
- name: Upload artifact - name: Upload artifact
uses: ./.github/actions/upload-artifact uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}

View File

@@ -1,56 +0,0 @@
name: 🪲 Godot CPP
on:
workflow_call:
# Global Settings
env:
# Used for the cache key. Add version suffix to force clean build.
GODOT_BASE_BRANCH: 4.2
# Used for the godot-cpp checkout.
GODOT_CPP_BRANCH: '4.1'
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-cpp-tests
cancel-in-progress: true
jobs:
godot-cpp-tests:
runs-on: "ubuntu-20.04"
name: "Build and test Godot CPP"
steps:
- uses: actions/checkout@v4
- name: Setup python and scons
uses: ./.github/actions/godot-deps
# Checkout godot-cpp
- name: Checkout godot-cpp
uses: actions/checkout@v4
with:
repository: godotengine/godot-cpp
ref: ${{ env.GODOT_CPP_BRANCH }}
submodules: 'recursive'
path: 'godot-cpp'
# Download generated API dump
- name: Download GDExtension interface and API dump
uses: ./.github/actions/download-artifact
with:
name: 'godot-api-dump'
path: './godot-api'
# Extract and override existing files with generated files
- name: Extract GDExtension interface and API dump
run: |
cp -f godot-api/gdextension_interface.h godot-cpp/gdextension/
cp -f godot-api/extension_api.json godot-cpp/gdextension/
# TODO: Add caching to the scons build and store it for CI via the godot-cache
# action.
# Build godot-cpp test extension
- name: Build godot-cpp test extension
run: |
cd godot-cpp/test
scons target=template_debug dev_build=yes
cd ../..

View File

@@ -8,23 +8,23 @@ env:
GODOT_BASE_BRANCH: 4.2 GODOT_BASE_BRANCH: 4.2
SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-ios
cancel-in-progress: true
jobs: jobs:
ios-template: ios-template:
runs-on: "macos-latest" runs-on: macos-latest
name: Template (target=template_release) name: Template (target=template_release)
timeout-minutes: 60
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore Godot build cache - name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore uses: ./.github/actions/godot-cache-restore
continue-on-error: true continue-on-error: true
- name: Setup python and scons - name: Setup Python and SCons
uses: ./.github/actions/godot-deps uses: ./.github/actions/godot-deps
- name: Compilation (arm64) - name: Compilation (arm64)

View File

@@ -6,19 +6,18 @@ on:
env: env:
# Used for the cache key. Add version suffix to force clean build. # Used for the cache key. Add version suffix to force clean build.
GODOT_BASE_BRANCH: 4.2 GODOT_BASE_BRANCH: 4.2
GODOT_CPP_BRANCH: 4.2
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
DOTNET_NOLOGO: true DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_CLI_TELEMETRY_OPTOUT: true
TSAN_OPTIONS: suppressions=misc/error_suppressions/tsan.txt TSAN_OPTIONS: suppressions=misc/error_suppressions/tsan.txt
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-linux
cancel-in-progress: true
jobs: jobs:
build-linux: build-linux:
runs-on: "ubuntu-20.04" # Stay one LTS before latest to increase portability of Linux artifacts.
runs-on: ubuntu-22.04
name: ${{ matrix.name }} name: ${{ matrix.name }}
timeout-minutes: 120
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -27,25 +26,25 @@ jobs:
cache-name: linux-editor-mono cache-name: linux-editor-mono
target: editor target: editor
sconsflags: module_mono_enabled=yes sconsflags: module_mono_enabled=yes
bin: "./bin/godot.linuxbsd.editor.x86_64.mono" bin: ./bin/godot.linuxbsd.editor.x86_64.mono
build-mono: true build-mono: true
tests: false # Disabled due freeze caused by mix Mono build and CI tests: false # Disabled due freeze caused by mix Mono build and CI
doc-test: true doc-test: true
proj-conv: true proj-conv: true
api-compat: true api-compat: true
artifact: true artifact: true
# Validate godot-cpp compatibility on one arbitrary editor build.
godot-cpp: true
- name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold) - name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold)
cache-name: linux-editor-double-sanitizers cache-name: linux-editor-double-sanitizers
target: editor target: editor
# Debug symbols disabled as they're huge on this build and we hit the 14 GB limit for runners. # Debug symbols disabled as they're huge on this build and we hit the 14 GB limit for runners.
sconsflags: dev_build=yes scu_build=yes debug_symbols=no precision=double use_asan=yes use_ubsan=yes linker=gold sconsflags: dev_build=yes scu_build=yes debug_symbols=no precision=double use_asan=yes use_ubsan=yes linker=gold
bin: "./bin/godot.linuxbsd.editor.dev.double.x86_64.san" bin: ./bin/godot.linuxbsd.editor.dev.double.x86_64.san
build-mono: false build-mono: false
tests: true tests: true
proj-test: true proj-test: true
# Generate an API dump for godot-cpp tests.
api-dump: true
# Skip 2GiB artifact speeding up action. # Skip 2GiB artifact speeding up action.
artifact: false artifact: false
@@ -53,47 +52,63 @@ jobs:
cache-name: linux-editor-llvm-sanitizers cache-name: linux-editor-llvm-sanitizers
target: editor target: editor
sconsflags: dev_build=yes use_asan=yes use_ubsan=yes use_llvm=yes linker=lld sconsflags: dev_build=yes use_asan=yes use_ubsan=yes use_llvm=yes linker=lld
bin: "./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san" bin: ./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san
build-mono: false build-mono: false
tests: true tests: true
# Skip 2GiB artifact speeding up action. # Skip 2GiB artifact speeding up action.
artifact: false artifact: false
# Test our oldest supported SCons/Python versions on one arbitrary editor build.
legacy-scons: true
- name: Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld) - name: Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)
cache-name: linux-editor-thread-sanitizer cache-name: linux-editor-thread-sanitizer
target: editor target: editor
tests: true tests: true
sconsflags: dev_build=yes use_tsan=yes use_llvm=yes linker=lld sconsflags: dev_build=yes use_tsan=yes use_llvm=yes linker=lld
bin: "./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san" bin: ./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san
build-mono: false build-mono: false
# Skip 2GiB artifact speeding up action. # Skip 2GiB artifact speeding up action.
artifact: false artifact: false
- name: Template w/ Mono (target=template_release) - name: Template w/ Mono, release (target=template_release, tests=yes)
cache-name: linux-template-mono cache-name: linux-template-mono
target: template_release target: template_release
sconsflags: module_mono_enabled=yes sconsflags: module_mono_enabled=yes
bin: ./bin/godot.linuxbsd.template_release.x86_64.mono
build-mono: false build-mono: false
tests: false tests: true
artifact: true artifact: true
- name: Minimal template (target=template_release, everything disabled) - name: Template w/ Mono, debug (target=template_debug, tests=yes)
cache-name: linux-template-mono-debug
target: template_debug
sconsflags: module_mono_enabled=yes
bin: ./bin/godot.linuxbsd.template_debug.x86_64.mono
build-mono: false
tests: true
artifact: true
- name: Minimal template (target=template_release, tests=yes, everything disabled)
cache-name: linux-template-minimal cache-name: linux-template-minimal
target: template_release target: template_release
sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no
tests: false bin: ./bin/godot.linuxbsd.template_release.x86_64
tests: true
artifact: true artifact: true
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# Need newer mesa for lavapipe to work properly. # Need newer mesa for lavapipe to work properly.
- name: Linux dependencies for tests - name: Linux dependencies for tests
if: ${{ matrix.proj-test }} if: matrix.proj-test
run: | run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB8B81E14DA65431D7504EA8F63F0F2B90935439 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB8B81E14DA65431D7504EA8F63F0F2B90935439
sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu focal main" sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu jammy main"
sudo apt-get install -qq mesa-vulkan-drivers sudo apt-get install -qq mesa-vulkan-drivers
- name: Free disk space on runner - name: Free disk space on runner
@@ -108,17 +123,29 @@ jobs:
cache-name: ${{ matrix.cache-name }} cache-name: ${{ matrix.cache-name }}
continue-on-error: true continue-on-error: true
- name: Setup python and scons - name: Setup Python and SCons
if: "!matrix.legacy-scons"
uses: ./.github/actions/godot-deps uses: ./.github/actions/godot-deps
- name: Set up .NET Sdk - name: Setup Python and SCons (legacy versions)
uses: actions/setup-dotnet@v3 if: matrix.legacy-scons
if: ${{ matrix.build-mono }} uses: ./.github/actions/godot-deps
with: with:
dotnet-version: '6.0.x' # Sync with Ensure*Version in SConstruct.
python-version: 3.8 # No Python < 3.8 available for Ubuntu 22.04.
scons-version: 3.1.2
- name: Setup GCC problem matcher - name: Force remove preinstalled .NET SDKs
uses: ammaraskar/gcc-problem-matcher@master if: matrix.build-mono
run: |
sudo rm -rf /usr/share/dotnet/sdk/*
- name: Setup older .NET SDK as baseline
if: matrix.build-mono
uses: actions/setup-dotnet@v4
with:
# Targeting the oldest version we want to support to ensure it still builds.
dotnet-version: 6.0.100
- name: Compilation - name: Compilation
uses: ./.github/actions/godot-build uses: ./.github/actions/godot-build
@@ -128,6 +155,14 @@ jobs:
target: ${{ matrix.target }} target: ${{ matrix.target }}
tests: ${{ matrix.tests }} tests: ${{ matrix.tests }}
- name: Compilation (godot-cpp)
uses: ./.github/actions/godot-cpp-build
if: matrix.godot-cpp
with:
bin: ${{ matrix.bin }}
scons-flags: target=template_debug dev_build=yes verbose=yes
godot-cpp-branch: ${{ env.GODOT_CPP_BRANCH }}
- name: Save Godot build cache - name: Save Godot build cache
uses: ./.github/actions/godot-cache-save uses: ./.github/actions/godot-cache-save
with: with:
@@ -135,36 +170,30 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Generate C# glue - name: Generate C# glue
if: ${{ matrix.build-mono }} if: matrix.build-mono
run: | run: |
${{ matrix.bin }} --headless --generate-mono-glue ./modules/mono/glue ${{ matrix.bin }} --headless --generate-mono-glue ./modules/mono/glue
- name: Build .NET solutions - name: Build .NET solutions
if: ${{ matrix.build-mono }} if: matrix.build-mono
run: | run: |
dotnet --info
./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd
- name: Prepare artifact - name: Prepare artifact
if: ${{ matrix.artifact }} if: matrix.artifact
run: | run: |
strip bin/godot.* strip bin/godot.*
chmod +x bin/godot.* chmod +x bin/godot.*
- name: Upload artifact - name: Upload artifact
uses: ./.github/actions/upload-artifact uses: ./.github/actions/upload-artifact
if: ${{ matrix.artifact }} if: matrix.artifact
with: with:
name: ${{ matrix.cache-name }} name: ${{ matrix.cache-name }}
- name: Dump Godot API
uses: ./.github/actions/godot-api-dump
if: ${{ matrix.api-dump }}
with:
bin: ${{ matrix.bin }}
# Execute unit tests for the editor
- name: Unit tests - name: Unit tests
if: ${{ matrix.tests }} if: matrix.tests
run: | run: |
${{ matrix.bin }} --version ${{ matrix.bin }} --version
${{ matrix.bin }} --help ${{ matrix.bin }} --help
@@ -172,7 +201,7 @@ jobs:
# Check class reference # Check class reference
- name: Check for class reference updates - name: Check for class reference updates
if: ${{ matrix.doc-test }} if: matrix.doc-test
run: | run: |
echo "Running --doctool to see if this changes the public API without updating the documentation." echo "Running --doctool to see if this changes the public API without updating the documentation."
echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n" echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n"
@@ -181,20 +210,20 @@ jobs:
# Check API backwards compatibility # Check API backwards compatibility
- name: Check for GDExtension compatibility - name: Check for GDExtension compatibility
if: ${{ matrix.api-compat }} if: matrix.api-compat
run: | run: |
./misc/scripts/validate_extension_api.sh "${{ matrix.bin }}" ./misc/scripts/validate_extension_api.sh "${{ matrix.bin }}"
# Download and run the test project # Download and run the test project
- name: Test Godot project - name: Test Godot project
uses: ./.github/actions/godot-project-test uses: ./.github/actions/godot-project-test
if: ${{ matrix.proj-test }} if: matrix.proj-test
with: with:
bin: ${{ matrix.bin }} bin: ${{ matrix.bin }}
# Test the project converter # Test the project converter
- name: Test project converter - name: Test project converter
uses: ./.github/actions/godot-converter-test uses: ./.github/actions/godot-converter-test
if: ${{ matrix.proj-conv }} if: matrix.proj-conv
with: with:
bin: ${{ matrix.bin }} bin: ${{ matrix.bin }}

View File

@@ -8,14 +8,11 @@ env:
GODOT_BASE_BRANCH: 4.2 GODOT_BASE_BRANCH: 4.2
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-macos
cancel-in-progress: true
jobs: jobs:
build-macos: build-macos:
runs-on: "macos-latest" runs-on: macos-latest
name: ${{ matrix.name }} name: ${{ matrix.name }}
timeout-minutes: 120
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -24,16 +21,20 @@ jobs:
cache-name: macos-editor cache-name: macos-editor
target: editor target: editor
tests: true tests: true
bin: "./bin/godot.macos.editor.universal" bin: ./bin/godot.macos.editor.universal
- name: Template (target=template_release) - name: Template (target=template_release, tests=yes)
cache-name: macos-template cache-name: macos-template
target: template_release target: template_release
tests: false tests: true
sconsflags: debug_symbols=no sconsflags: debug_symbols=no
bin: ./bin/godot.macos.template_release.universal
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore Godot build cache - name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore uses: ./.github/actions/godot-cache-restore
@@ -41,7 +42,7 @@ jobs:
cache-name: ${{ matrix.cache-name }} cache-name: ${{ matrix.cache-name }}
continue-on-error: true continue-on-error: true
- name: Setup python and scons - name: Setup Python and SCons
uses: ./.github/actions/godot-deps uses: ./.github/actions/godot-deps
- name: Setup Vulkan SDK - name: Setup Vulkan SDK
@@ -82,9 +83,8 @@ jobs:
with: with:
name: ${{ matrix.cache-name }} name: ${{ matrix.cache-name }}
# Execute unit tests for the editor
- name: Unit tests - name: Unit tests
if: ${{ matrix.tests }} if: matrix.tests
run: | run: |
${{ matrix.bin }} --version ${{ matrix.bin }} --version
${{ matrix.bin }} --help ${{ matrix.bin }} --help

View File

@@ -1,65 +1,46 @@
name: 🔗 GHA name: 🔗 GHA
on: [push, pull_request] on: [push, pull_request, merge_group]
concurrency: concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-runner group: ${{ github.workflow }}|${{ github.ref_name }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
# First stage: Only static checks, fast and prevent expensive builds from running. # First stage: Only static checks, fast and prevent expensive builds from running.
static-checks: static-checks:
if: ${{ vars.DISABLE_GODOT_CI == '' }} if: "!vars.DISABLE_GODOT_CI"
name: 📊 Static checks name: 📊 Static checks
uses: ./.github/workflows/static_checks.yml uses: ./.github/workflows/static_checks.yml
# Second stage: Run all the builds and some of the tests. # Second stage: Run all the builds and some of the tests.
android-build: android-build:
if: ${{ vars.DISABLE_GODOT_CI == '' }}
name: 🤖 Android name: 🤖 Android
needs: static-checks needs: static-checks
uses: ./.github/workflows/android_builds.yml uses: ./.github/workflows/android_builds.yml
ios-build: ios-build:
if: ${{ vars.DISABLE_GODOT_CI == '' }}
name: 🍏 iOS name: 🍏 iOS
needs: static-checks needs: static-checks
uses: ./.github/workflows/ios_builds.yml uses: ./.github/workflows/ios_builds.yml
linux-build: linux-build:
if: ${{ vars.DISABLE_GODOT_CI == '' }}
name: 🐧 Linux name: 🐧 Linux
needs: static-checks needs: static-checks
uses: ./.github/workflows/linux_builds.yml uses: ./.github/workflows/linux_builds.yml
macos-build: macos-build:
if: ${{ vars.DISABLE_GODOT_CI == '' }}
name: 🍎 macOS name: 🍎 macOS
needs: static-checks needs: static-checks
uses: ./.github/workflows/macos_builds.yml uses: ./.github/workflows/macos_builds.yml
windows-build: windows-build:
if: ${{ vars.DISABLE_GODOT_CI == '' }}
name: 🏁 Windows name: 🏁 Windows
needs: static-checks needs: static-checks
uses: ./.github/workflows/windows_builds.yml uses: ./.github/workflows/windows_builds.yml
web-build: web-build:
if: ${{ vars.DISABLE_GODOT_CI == '' }}
name: 🌐 Web name: 🌐 Web
needs: static-checks needs: static-checks
uses: ./.github/workflows/web_builds.yml uses: ./.github/workflows/web_builds.yml
# Third stage: Run auxiliary tests using build artifacts from previous jobs.
# Can be turned off for PRs that intentionally break compat with godot-cpp,
# until both the upstream PR and the matching godot-cpp changes are merged.
godot-cpp-test:
if: ${{ vars.DISABLE_GODOT_CI == '' }}
name: 🪲 Godot CPP
# This can be changed to depend on another platform, if we decide to use it for
# godot-cpp instead. Make sure to move the .github/actions/godot-api-dump step
# appropriately.
needs: linux-build
uses: ./.github/workflows/godot_cpp_test.yml

View File

@@ -2,14 +2,11 @@ name: 📊 Static Checks
on: on:
workflow_call: workflow_call:
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-static
cancel-in-progress: true
jobs: jobs:
static-checks: static-checks:
name: Code style, file formatting, and docs name: Code style, file formatting, and docs
runs-on: ubuntu-22.04 runs-on: ubuntu-24.04
timeout-minutes: 30
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -17,9 +14,9 @@ jobs:
fetch-depth: 2 fetch-depth: 2
- name: Install APT dependencies - name: Install APT dependencies
uses: awalsh128/cache-apt-pkgs-action@latest run: |
with: sudo apt update
packages: dos2unix libxml2-utils moreutils sudo apt install -y dos2unix libxml2-utils moreutils
- name: Install Python dependencies and general setup - name: Install Python dependencies and general setup
run: | run: |
@@ -38,7 +35,7 @@ jobs:
fi fi
echo "$files" >> changed.txt echo "$files" >> changed.txt
cat changed.txt cat changed.txt
files=$(echo "$files" | grep -v 'thirdparty' | xargs -I {} sh -c 'echo "./{}"' | tr '\n' ' ') files=$(echo "$files" | grep -v 'thirdparty' | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ')
echo "CHANGED_FILES=$files" >> $GITHUB_ENV echo "CHANGED_FILES=$files" >> $GITHUB_ENV
# This needs to happen before Python and npm execution; it must happen before any extra files are written. # This needs to happen before Python and npm execution; it must happen before any extra files are written.
@@ -114,3 +111,7 @@ jobs:
skip: "./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json" skip: "./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json"
ignore_words_list: "breaked,checkin,curvelinear,doubleclick,expct,findn,gird,hel,inout,labelin,lod,mis,nd,numer,ot,pointin,requestor,te,textin,thirdparty,vai" ignore_words_list: "breaked,checkin,curvelinear,doubleclick,expct,findn,gird,hel,inout,labelin,lod,mis,nd,numer,ot,pointin,requestor,te,textin,thirdparty,vai"
path: ${{ env.CHANGED_FILES }} path: ${{ env.CHANGED_FILES }}
- name: Run C compiler on `gdextension_interface.h`
run: |
gcc -c core/extension/gdextension_interface.h

View File

@@ -8,26 +8,34 @@ env:
GODOT_BASE_BRANCH: 4.2 GODOT_BASE_BRANCH: 4.2
SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no
EM_VERSION: 3.1.39 EM_VERSION: 3.1.39
EM_CACHE_FOLDER: "emsdk-cache"
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-web
cancel-in-progress: true
jobs: jobs:
web-template: web-template:
runs-on: "ubuntu-22.04" runs-on: ubuntu-24.04
name: Template (target=template_release) name: ${{ matrix.name }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- name: Template (target=template_release)
cache-name: web-template
target: template_release
sconsflags:
tests: false
artifact: true
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Emscripten latest - name: Set up Emscripten latest
uses: mymindstorm/setup-emsdk@v14 uses: mymindstorm/setup-emsdk@v14
with: with:
version: ${{env.EM_VERSION}} version: ${{ env.EM_VERSION }}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} no-cache: true
cache-key: emsdk-${{ matrix.cache-name }}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
- name: Verify Emscripten setup - name: Verify Emscripten setup
run: | run: |
@@ -35,22 +43,29 @@ jobs:
- name: Restore Godot build cache - name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore uses: ./.github/actions/godot-cache-restore
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true continue-on-error: true
- name: Setup python and scons - name: Setup Python and SCons
uses: ./.github/actions/godot-deps uses: ./.github/actions/godot-deps
- name: Compilation - name: Compilation
uses: ./.github/actions/godot-build uses: ./.github/actions/godot-build
with: with:
sconsflags: ${{ env.SCONSFLAGS }} sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: web platform: web
target: template_release target: ${{ matrix.target }}
tests: false tests: ${{ matrix.tests }}
- name: Save Godot build cache - name: Save Godot build cache
uses: ./.github/actions/godot-cache-save uses: ./.github/actions/godot-cache-save
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true continue-on-error: true
- name: Upload artifact - name: Upload artifact
uses: ./.github/actions/upload-artifact uses: ./.github/actions/upload-artifact
if: matrix.artifact
with:
name: ${{ matrix.cache-name }}

View File

@@ -10,15 +10,12 @@ env:
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
SCONS_CACHE_MSVC_CONFIG: true SCONS_CACHE_MSVC_CONFIG: true
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-windows
cancel-in-progress: true
jobs: jobs:
build-windows: build-windows:
# Windows 10 with latest image # Windows 10 with latest image
runs-on: "windows-latest" runs-on: windows-latest
name: ${{ matrix.name }} name: ${{ matrix.name }}
timeout-minutes: 120
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -29,16 +26,31 @@ jobs:
tests: true tests: true
# Skip debug symbols, they're way too big with MSVC. # Skip debug symbols, they're way too big with MSVC.
sconsflags: debug_symbols=no vsproj=yes windows_subsystem=console sconsflags: debug_symbols=no vsproj=yes windows_subsystem=console
bin: "./bin/godot.windows.editor.x86_64.exe" bin: ./bin/godot.windows.editor.x86_64.exe
compiler: msvc
- name: Template (target=template_release) - name: Template (target=template_release, tests=yes)
cache-name: windows-template cache-name: windows-template
target: template_release target: template_release
tests: false tests: true
sconsflags: debug_symbols=no sconsflags: debug_symbols=no
bin: ./bin/godot.windows.template_release.x86_64.console.exe
compiler: msvc
- name: Template w/ GCC (target=template_release, tests=yes, use_mingw=yes)
cache-name: windows-template-gcc
# MinGW takes MUCH longer to compile; save time by only targeting Template.
target: template_release
tests: true
sconsflags: debug_symbols=no use_mingw=yes
bin: ./bin/godot.windows.template_release.x86_64.console.exe
compiler: gcc
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore Godot build cache - name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore uses: ./.github/actions/godot-cache-restore
@@ -46,7 +58,7 @@ jobs:
cache-name: ${{ matrix.cache-name }} cache-name: ${{ matrix.cache-name }}
continue-on-error: true continue-on-error: true
- name: Setup python and scons - name: Setup Python and SCons
uses: ./.github/actions/godot-deps uses: ./.github/actions/godot-deps
- name: Setup MSVC problem matcher - name: Setup MSVC problem matcher
@@ -67,17 +79,18 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Prepare artifact - name: Prepare artifact
if: matrix.compiler == 'msvc'
run: | run: |
Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force
- name: Upload artifact - name: Upload artifact
if: matrix.compiler == 'msvc'
uses: ./.github/actions/upload-artifact uses: ./.github/actions/upload-artifact
with: with:
name: ${{ matrix.cache-name }} name: ${{ matrix.cache-name }}
# Execute unit tests for the editor
- name: Unit tests - name: Unit tests
if: ${{ matrix.tests }} if: matrix.tests
run: | run: |
${{ matrix.bin }} --version ${{ matrix.bin }} --version
${{ matrix.bin }} --help ${{ matrix.bin }} --help

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
EnsureSConsVersion(3, 0, 0) EnsureSConsVersion(3, 1, 2)
EnsurePythonVersion(3, 6) EnsurePythonVersion(3, 6)
# System # System

View File

@@ -662,15 +662,16 @@ PackedByteArray HTTPClientTCP::read_response_body_chunk() {
chunk_left -= rec; chunk_left -= rec;
if (chunk_left == 0) { if (chunk_left == 0) {
if (chunk[chunk.size() - 2] != '\r' || chunk[chunk.size() - 1] != '\n') { const int chunk_size = chunk.size();
if (chunk[chunk_size - 2] != '\r' || chunk[chunk_size - 1] != '\n') {
ERR_PRINT("HTTP Invalid chunk terminator (not \\r\\n)"); ERR_PRINT("HTTP Invalid chunk terminator (not \\r\\n)");
status = STATUS_CONNECTION_ERROR; status = STATUS_CONNECTION_ERROR;
break; break;
} }
ret.resize(chunk.size() - 2); ret.resize(chunk_size - 2);
uint8_t *w = ret.ptrw(); uint8_t *w = ret.ptrw();
memcpy(w, chunk.ptr(), chunk.size() - 2); memcpy(w, chunk.ptr(), chunk_size - 2);
chunk.clear(); chunk.clear();
} }

View File

@@ -105,6 +105,19 @@ Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
return ERR_UNAVAILABLE; return ERR_UNAVAILABLE;
} }
/* Bogus GCC warning here:
* In member function 'int RingBuffer<T>::read(T*, int, bool) [with T = unsigned char]',
* inlined from 'virtual Error PacketPeerUDP::get_packet(const uint8_t**, int&)' at core/io/packet_peer_udp.cpp:112:9,
* inlined from 'virtual Error PacketPeerUDP::get_packet(const uint8_t**, int&)' at core/io/packet_peer_udp.cpp:99:7:
* Error: ./core/ring_buffer.h:68:46: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
* 68 | p_buf[dst++] = read[pos + i];
* | ~~~~~~~~~~~~~^~~~~~~
*/
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wstringop-overflow=0"
#endif
uint32_t size = 0; uint32_t size = 0;
uint8_t ipv6[16]; uint8_t ipv6[16];
rb.read(ipv6, 16, true); rb.read(ipv6, 16, true);
@@ -115,6 +128,11 @@ Error PacketPeerUDP::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
--queue_count; --queue_count;
*r_buffer = packet_buffer; *r_buffer = packet_buffer;
r_buffer_size = size; r_buffer_size = size;
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
return OK; return OK;
} }

View File

@@ -223,13 +223,13 @@ void StreamPeer::put_var(const Variant &p_variant, bool p_full_objects) {
} }
uint8_t StreamPeer::get_u8() { uint8_t StreamPeer::get_u8() {
uint8_t buf[1]; uint8_t buf[1] = {};
get_data(buf, 1); get_data(buf, 1);
return buf[0]; return buf[0];
} }
int8_t StreamPeer::get_8() { int8_t StreamPeer::get_8() {
uint8_t buf[1]; uint8_t buf[1] = {};
get_data(buf, 1); get_data(buf, 1);
return buf[0]; return buf[0];
} }

View File

@@ -2561,7 +2561,10 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_secret_character", "character"), &LineEdit::set_secret_character); ClassDB::bind_method(D_METHOD("set_secret_character", "character"), &LineEdit::set_secret_character);
ClassDB::bind_method(D_METHOD("get_secret_character"), &LineEdit::get_secret_character); ClassDB::bind_method(D_METHOD("get_secret_character"), &LineEdit::get_secret_character);
ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option); ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option);
// TODO: Properly handle popups when advanced GUI is disabled.
#ifndef ADVANCED_GUI_DISABLED
ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu); ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu);
#endif // ADVANCED_GUI_DISABLED
ClassDB::bind_method(D_METHOD("is_menu_visible"), &LineEdit::is_menu_visible); ClassDB::bind_method(D_METHOD("is_menu_visible"), &LineEdit::is_menu_visible);
ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled); ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled);
ClassDB::bind_method(D_METHOD("is_context_menu_enabled"), &LineEdit::is_context_menu_enabled); ClassDB::bind_method(D_METHOD("is_context_menu_enabled"), &LineEdit::is_context_menu_enabled);

View File

@@ -640,7 +640,10 @@ void MenuBar::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_menu_hidden", "menu", "hidden"), &MenuBar::set_menu_hidden); ClassDB::bind_method(D_METHOD("set_menu_hidden", "menu", "hidden"), &MenuBar::set_menu_hidden);
ClassDB::bind_method(D_METHOD("is_menu_hidden", "menu"), &MenuBar::is_menu_hidden); ClassDB::bind_method(D_METHOD("is_menu_hidden", "menu"), &MenuBar::is_menu_hidden);
// TODO: Properly handle popups when advanced GUI is disabled.
#ifndef ADVANCED_GUI_DISABLED
ClassDB::bind_method(D_METHOD("get_menu_popup", "menu"), &MenuBar::get_menu_popup); ClassDB::bind_method(D_METHOD("get_menu_popup", "menu"), &MenuBar::get_menu_popup);
#endif // ADVANCED_GUI_DISABLED
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat");
ADD_PROPERTY(PropertyInfo(Variant::INT, "start_index"), "set_start_index", "get_start_index"); ADD_PROPERTY(PropertyInfo(Variant::INT, "start_index"), "set_start_index", "get_start_index");

View File

@@ -206,7 +206,10 @@ void MenuButton::_get_property_list(List<PropertyInfo> *p_list) const {
} }
void MenuButton::_bind_methods() { void MenuButton::_bind_methods() {
// TODO: Properly handle popups when advanced GUI is disabled.
#ifndef ADVANCED_GUI_DISABLED
ClassDB::bind_method(D_METHOD("get_popup"), &MenuButton::get_popup); ClassDB::bind_method(D_METHOD("get_popup"), &MenuButton::get_popup);
#endif // ADVANCED_GUI_DISABLED
ClassDB::bind_method(D_METHOD("show_popup"), &MenuButton::show_popup); ClassDB::bind_method(D_METHOD("show_popup"), &MenuButton::show_popup);
ClassDB::bind_method(D_METHOD("set_switch_on_hover", "enable"), &MenuButton::set_switch_on_hover); ClassDB::bind_method(D_METHOD("set_switch_on_hover", "enable"), &MenuButton::set_switch_on_hover);
ClassDB::bind_method(D_METHOD("is_switch_on_hover"), &MenuButton::is_switch_on_hover); ClassDB::bind_method(D_METHOD("is_switch_on_hover"), &MenuButton::is_switch_on_hover);

View File

@@ -35,6 +35,8 @@
#include "tests/test_macros.h" #include "tests/test_macros.h"
#include "modules/modules_enabled.gen.h"
namespace TestHTTPClient { namespace TestHTTPClient {
TEST_CASE("[HTTPClient] Instantiation") { TEST_CASE("[HTTPClient] Instantiation") {
@@ -90,6 +92,7 @@ TEST_CASE("[HTTPClient] verify_headers") {
ERR_PRINT_ON; ERR_PRINT_ON;
} }
#if defined(MODULE_MBEDTLS_ENABLED) || defined(WEB_ENABLED)
TEST_CASE("[HTTPClient] connect_to_host") { TEST_CASE("[HTTPClient] connect_to_host") {
Ref<HTTPClient> client = HTTPClient::create(); Ref<HTTPClient> client = HTTPClient::create();
String host = "https://www.example.com"; String host = "https://www.example.com";
@@ -100,6 +103,7 @@ TEST_CASE("[HTTPClient] connect_to_host") {
Error err = client->connect_to_host(host, port, tls_options); Error err = client->connect_to_host(host, port, tls_options);
CHECK_MESSAGE(err == OK, "Expected OK for successful connection"); CHECK_MESSAGE(err == OK, "Expected OK for successful connection");
} }
#endif // MODULE_MBEDTLS_ENABLED || WEB_ENABLED
} // namespace TestHTTPClient } // namespace TestHTTPClient

View File

@@ -37,6 +37,8 @@
#include "tests/test_utils.h" #include "tests/test_utils.h"
#include "thirdparty/doctest/doctest.h" #include "thirdparty/doctest/doctest.h"
#include "modules/modules_enabled.gen.h"
namespace TestImage { namespace TestImage {
TEST_CASE("[Image] Instantiation") { TEST_CASE("[Image] Instantiation") {
@@ -107,6 +109,7 @@ TEST_CASE("[Image] Saving and loading") {
image->get_data() == image_load->get_data(), image->get_data() == image_load->get_data(),
"The loaded image should have the same data as the one that got saved."); "The loaded image should have the same data as the one that got saved.");
#ifdef MODULE_BMP_ENABLED
// Load BMP // Load BMP
Ref<Image> image_bmp = memnew(Image()); Ref<Image> image_bmp = memnew(Image());
Ref<FileAccess> f_bmp = FileAccess::open(TestUtils::get_data_path("images/icon.bmp"), FileAccess::READ, &err); Ref<FileAccess> f_bmp = FileAccess::open(TestUtils::get_data_path("images/icon.bmp"), FileAccess::READ, &err);
@@ -117,7 +120,9 @@ TEST_CASE("[Image] Saving and loading") {
CHECK_MESSAGE( CHECK_MESSAGE(
image_bmp->load_bmp_from_buffer(data_bmp) == OK, image_bmp->load_bmp_from_buffer(data_bmp) == OK,
"The BMP image should load successfully."); "The BMP image should load successfully.");
#endif // MODULE_BMP_ENABLED
#ifdef MODULE_JPG_ENABLED
// Load JPG // Load JPG
Ref<Image> image_jpg = memnew(Image()); Ref<Image> image_jpg = memnew(Image());
Ref<FileAccess> f_jpg = FileAccess::open(TestUtils::get_data_path("images/icon.jpg"), FileAccess::READ, &err); Ref<FileAccess> f_jpg = FileAccess::open(TestUtils::get_data_path("images/icon.jpg"), FileAccess::READ, &err);
@@ -128,7 +133,9 @@ TEST_CASE("[Image] Saving and loading") {
CHECK_MESSAGE( CHECK_MESSAGE(
image_jpg->load_jpg_from_buffer(data_jpg) == OK, image_jpg->load_jpg_from_buffer(data_jpg) == OK,
"The JPG image should load successfully."); "The JPG image should load successfully.");
#endif // MODULE_JPG_ENABLED
#ifdef MODULE_WEBP_ENABLED
// Load WebP // Load WebP
Ref<Image> image_webp = memnew(Image()); Ref<Image> image_webp = memnew(Image());
Ref<FileAccess> f_webp = FileAccess::open(TestUtils::get_data_path("images/icon.webp"), FileAccess::READ, &err); Ref<FileAccess> f_webp = FileAccess::open(TestUtils::get_data_path("images/icon.webp"), FileAccess::READ, &err);
@@ -139,6 +146,7 @@ TEST_CASE("[Image] Saving and loading") {
CHECK_MESSAGE( CHECK_MESSAGE(
image_webp->load_webp_from_buffer(data_webp) == OK, image_webp->load_webp_from_buffer(data_webp) == OK,
"The WebP image should load successfully."); "The WebP image should load successfully.");
#endif // MODULE_WEBP_ENABLED
// Load PNG // Load PNG
Ref<Image> image_png = memnew(Image()); Ref<Image> image_png = memnew(Image());
@@ -151,6 +159,7 @@ TEST_CASE("[Image] Saving and loading") {
image_png->load_png_from_buffer(data_png) == OK, image_png->load_png_from_buffer(data_png) == OK,
"The PNG image should load successfully."); "The PNG image should load successfully.");
#ifdef MODULE_TGA_ENABLED
// Load TGA // Load TGA
Ref<Image> image_tga = memnew(Image()); Ref<Image> image_tga = memnew(Image());
Ref<FileAccess> f_tga = FileAccess::open(TestUtils::get_data_path("images/icon.tga"), FileAccess::READ, &err); Ref<FileAccess> f_tga = FileAccess::open(TestUtils::get_data_path("images/icon.tga"), FileAccess::READ, &err);
@@ -161,6 +170,7 @@ TEST_CASE("[Image] Saving and loading") {
CHECK_MESSAGE( CHECK_MESSAGE(
image_tga->load_tga_from_buffer(data_tga) == OK, image_tga->load_tga_from_buffer(data_tga) == OK,
"The TGA image should load successfully."); "The TGA image should load successfully.");
#endif // MODULE_TGA_ENABLED
} }
TEST_CASE("[Image] Basic getters") { TEST_CASE("[Image] Basic getters") {

View File

@@ -353,7 +353,6 @@ TEST_CASE("[Vector2] Plane methods") {
const Vector2 vector = Vector2(1.2, 3.4); const Vector2 vector = Vector2(1.2, 3.4);
const Vector2 vector_y = Vector2(0, 1); const Vector2 vector_y = Vector2(0, 1);
const Vector2 vector_normal = Vector2(0.95879811270838721622267, 0.2840883296913739899919); const Vector2 vector_normal = Vector2(0.95879811270838721622267, 0.2840883296913739899919);
const Vector2 vector_non_normal = Vector2(5.4, 1.6);
CHECK_MESSAGE( CHECK_MESSAGE(
vector.bounce(vector_y) == Vector2(1.2, -3.4), vector.bounce(vector_y) == Vector2(1.2, -3.4),
"Vector2 bounce on a plane with normal of the Y axis should."); "Vector2 bounce on a plane with normal of the Y axis should.");
@@ -379,6 +378,8 @@ TEST_CASE("[Vector2] Plane methods") {
vector.slide(vector_normal).is_equal_approx(Vector2(-0.8292559899117276166456, 2.798738965952080706179)), vector.slide(vector_normal).is_equal_approx(Vector2(-0.8292559899117276166456, 2.798738965952080706179)),
"Vector2 slide with normal should return expected value."); "Vector2 slide with normal should return expected value.");
// There's probably a better way to test these ones? // There's probably a better way to test these ones?
#ifdef MATH_CHECKS
const Vector2 vector_non_normal = Vector2(5.4, 1.6);
ERR_PRINT_OFF; ERR_PRINT_OFF;
CHECK_MESSAGE( CHECK_MESSAGE(
vector.bounce(vector_non_normal).is_equal_approx(Vector2()), vector.bounce(vector_non_normal).is_equal_approx(Vector2()),
@@ -390,6 +391,7 @@ TEST_CASE("[Vector2] Plane methods") {
vector.slide(vector_non_normal).is_equal_approx(Vector2()), vector.slide(vector_non_normal).is_equal_approx(Vector2()),
"Vector2 slide should return empty Vector2 with non-normalized input."); "Vector2 slide should return empty Vector2 with non-normalized input.");
ERR_PRINT_ON; ERR_PRINT_ON;
#endif // MATH_CHECKS
} }
TEST_CASE("[Vector2] Rounding methods") { TEST_CASE("[Vector2] Rounding methods") {

View File

@@ -368,7 +368,6 @@ TEST_CASE("[Vector3] Plane methods") {
const Vector3 vector = Vector3(1.2, 3.4, 5.6); const Vector3 vector = Vector3(1.2, 3.4, 5.6);
const Vector3 vector_y = Vector3(0, 1, 0); const Vector3 vector_y = Vector3(0, 1, 0);
const Vector3 vector_normal = Vector3(0.88763458893247992491, 0.26300284116517923701, 0.37806658417494515320); const Vector3 vector_normal = Vector3(0.88763458893247992491, 0.26300284116517923701, 0.37806658417494515320);
const Vector3 vector_non_normal = Vector3(5.4, 1.6, 2.3);
CHECK_MESSAGE( CHECK_MESSAGE(
vector.bounce(vector_y) == Vector3(1.2, -3.4, 5.6), vector.bounce(vector_y) == Vector3(1.2, -3.4, 5.6),
"Vector3 bounce on a plane with normal of the Y axis should."); "Vector3 bounce on a plane with normal of the Y axis should.");
@@ -394,6 +393,8 @@ TEST_CASE("[Vector3] Plane methods") {
vector.slide(vector_normal).is_equal_approx(Vector3(-2.41848149148878681437, 2.32785733585517427722237, 4.0587949202918130235)), vector.slide(vector_normal).is_equal_approx(Vector3(-2.41848149148878681437, 2.32785733585517427722237, 4.0587949202918130235)),
"Vector3 slide with normal should return expected value."); "Vector3 slide with normal should return expected value.");
// There's probably a better way to test these ones? // There's probably a better way to test these ones?
#ifdef MATH_CHECKS
const Vector3 vector_non_normal = Vector3(5.4, 1.6, 2.3);
ERR_PRINT_OFF; ERR_PRINT_OFF;
CHECK_MESSAGE( CHECK_MESSAGE(
vector.bounce(vector_non_normal).is_equal_approx(Vector3()), vector.bounce(vector_non_normal).is_equal_approx(Vector3()),
@@ -405,6 +406,7 @@ TEST_CASE("[Vector3] Plane methods") {
vector.slide(vector_non_normal).is_equal_approx(Vector3()), vector.slide(vector_non_normal).is_equal_approx(Vector3()),
"Vector3 slide should return empty Vector3 with non-normalized input."); "Vector3 slide should return empty Vector3 with non-normalized input.");
ERR_PRINT_ON; ERR_PRINT_ON;
#endif // MATH_CHECKS
} }
TEST_CASE("[Vector3] Rounding methods") { TEST_CASE("[Vector3] Rounding methods") {

View File

@@ -373,8 +373,10 @@ void validate_property(const Context &p_context, const ExposedClass &p_class, co
} }
void validate_argument(const Context &p_context, const ExposedClass &p_class, const String &p_owner_name, const String &p_owner_type, const ArgumentData &p_arg) { void validate_argument(const Context &p_context, const ExposedClass &p_class, const String &p_owner_name, const String &p_owner_type, const ArgumentData &p_arg) {
#ifdef DEBUG_METHODS_ENABLED
TEST_COND((p_arg.name.is_empty() || p_arg.name.begins_with("_unnamed_arg")), TEST_COND((p_arg.name.is_empty() || p_arg.name.begins_with("_unnamed_arg")),
vformat("Unnamed argument in position %d of %s '%s.%s'.", p_arg.position, p_owner_type, p_class.name, p_owner_name)); vformat("Unnamed argument in position %d of %s '%s.%s'.", p_arg.position, p_owner_type, p_class.name, p_owner_name));
#endif // DEBUG_METHODS_ENABLED
const ExposedClass *arg_class = p_context.find_exposed_class(p_arg.type); const ExposedClass *arg_class = p_context.find_exposed_class(p_arg.type);
if (arg_class) { if (arg_class) {

View File

@@ -141,12 +141,14 @@ TEST_CASE("[OS] Processor count and memory information") {
CHECK_MESSAGE( CHECK_MESSAGE(
OS::get_singleton()->get_processor_count() >= 1, OS::get_singleton()->get_processor_count() >= 1,
"The returned processor count should be greater than zero."); "The returned processor count should be greater than zero.");
#ifdef DEBUG_ENABLED
CHECK_MESSAGE( CHECK_MESSAGE(
OS::get_singleton()->get_static_memory_usage() >= 1, OS::get_singleton()->get_static_memory_usage() >= 1,
"The returned static memory usage should be greater than zero."); "The returned static memory usage should be greater than zero.");
CHECK_MESSAGE( CHECK_MESSAGE(
OS::get_singleton()->get_static_memory_peak_usage() >= 1, OS::get_singleton()->get_static_memory_peak_usage() >= 1,
"The returned static memory peak usage should be greater than zero."); "The returned static memory peak usage should be greater than zero.");
#endif // DEBUG_ENABLED
} }
TEST_CASE("[OS] Execute") { TEST_CASE("[OS] Execute") {

View File

@@ -32,6 +32,7 @@
#define TEST_NODE_H #define TEST_NODE_H
#include "scene/main/node.h" #include "scene/main/node.h"
#include "scene/main/window.h"
#include "tests/test_macros.h" #include "tests/test_macros.h"

View File

@@ -30,6 +30,8 @@
#include "test_main.h" #include "test_main.h"
#include "modules/modules_enabled.gen.h"
#include "tests/core/config/test_project_settings.h" #include "tests/core/config/test_project_settings.h"
#include "tests/core/input/test_input_event.h" #include "tests/core/input/test_input_event.h"
#include "tests/core/input/test_input_event_key.h" #include "tests/core/input/test_input_event_key.h"
@@ -91,11 +93,8 @@
#include "tests/core/variant/test_variant.h" #include "tests/core/variant/test_variant.h"
#include "tests/core/variant/test_variant_utility.h" #include "tests/core/variant/test_variant_utility.h"
#include "tests/scene/test_animation.h" #include "tests/scene/test_animation.h"
#include "tests/scene/test_arraymesh.h"
#include "tests/scene/test_audio_stream_wav.h" #include "tests/scene/test_audio_stream_wav.h"
#include "tests/scene/test_bit_map.h" #include "tests/scene/test_bit_map.h"
#include "tests/scene/test_code_edit.h"
#include "tests/scene/test_color_picker.h"
#include "tests/scene/test_control.h" #include "tests/scene/test_control.h"
#include "tests/scene/test_curve.h" #include "tests/scene/test_curve.h"
#include "tests/scene/test_curve_2d.h" #include "tests/scene/test_curve_2d.h"
@@ -106,7 +105,6 @@
#include "tests/scene/test_packed_scene.h" #include "tests/scene/test_packed_scene.h"
#include "tests/scene/test_path_2d.h" #include "tests/scene/test_path_2d.h"
#include "tests/scene/test_sprite_frames.h" #include "tests/scene/test_sprite_frames.h"
#include "tests/scene/test_text_edit.h"
#include "tests/scene/test_theme.h" #include "tests/scene/test_theme.h"
#include "tests/scene/test_viewport.h" #include "tests/scene/test_viewport.h"
#include "tests/scene/test_visual_shader.h" #include "tests/scene/test_visual_shader.h"
@@ -115,17 +113,27 @@
#include "tests/servers/test_text_server.h" #include "tests/servers/test_text_server.h"
#include "tests/test_validate_testing.h" #include "tests/test_validate_testing.h"
#ifndef ADVANCED_GUI_DISABLED
#include "tests/scene/test_code_edit.h"
#include "tests/scene/test_color_picker.h"
#include "tests/scene/test_text_edit.h"
#endif // ADVANCED_GUI_DISABLED
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
#ifdef MODULE_NAVIGATION_ENABLED
#include "tests/scene/test_navigation_agent_2d.h" #include "tests/scene/test_navigation_agent_2d.h"
#include "tests/scene/test_navigation_agent_3d.h" #include "tests/scene/test_navigation_agent_3d.h"
#include "tests/scene/test_navigation_obstacle_2d.h" #include "tests/scene/test_navigation_obstacle_2d.h"
#include "tests/scene/test_navigation_obstacle_3d.h" #include "tests/scene/test_navigation_obstacle_3d.h"
#include "tests/scene/test_navigation_region_2d.h" #include "tests/scene/test_navigation_region_2d.h"
#include "tests/scene/test_navigation_region_3d.h" #include "tests/scene/test_navigation_region_3d.h"
#include "tests/scene/test_path_3d.h"
#include "tests/scene/test_primitives.h"
#include "tests/servers/test_navigation_server_2d.h" #include "tests/servers/test_navigation_server_2d.h"
#include "tests/servers/test_navigation_server_3d.h" #include "tests/servers/test_navigation_server_3d.h"
#endif // MODULE_NAVIGATION_ENABLED
#include "tests/scene/test_arraymesh.h"
#include "tests/scene/test_path_3d.h"
#include "tests/scene/test_primitives.h"
#endif // _3D_DISABLED #endif // _3D_DISABLED
#include "modules/modules_tests.gen.h" #include "modules/modules_tests.gen.h"