Skip to content

chore: enable tests in pipeline #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ on:

# Global Settings
env:
SCONSFLAGS: strict_checks=yes debug_symbols=no module_text_server_fb_enabled=yes
SCONSFLAGS: >-
strict_checks=yes
debug_symbols=no
module_text_server_fb_enabled=yes
swappy=yes

# We only build template release - most developers will use a desktop device for editor
jobs:
Expand All @@ -24,14 +28,20 @@ jobs:
cache-name: android-template-release-v8
target: template_release
tests: false
sconsflags: arch=arm64 swappy=yes deprecated=no ndk_platform=android-24 generate_apk=yes
sconsflags: >-
arch=arm64
deprecated=no
ndk_platform=android-24
generate_apk=yes
cache-limit: 1

- name: Template (target=template_release, arch=arm64, qjs_ng)
cache-name: android-template-release-qjs-ng
target: template_release
tests: false
sconsflags: arch=arm64 swappy=yes use_quickjs_ng=yes
sconsflags: >-
arch=arm64
use_quickjs_ng=yes
cache-limit: 1

steps:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ios_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ on:

# Global Settings
env:
SCONSFLAGS: debug_symbols=no module_text_server_fb_enabled=yes
SCONSFLAGS: >-
strict_checks=yes
debug_symbols=no
module_text_server_fb_enabled=yes

jobs:
ios-template:
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ on:
version:
required: true
type: string
tests:
type: boolean
default: true

# Global Settings
env:
SCONSFLAGS: module_text_server_fb_enabled=yes strict_checks=yes
SCONSFLAGS: >-
module_text_server_fb_enabled=yes
strict_checks=yes
TSAN_OPTIONS: suppressions=misc/error_suppressions/tsan.txt
UBSAN_OPTIONS: suppressions=misc/error_suppressions/ubsan.txt

Expand Down Expand Up @@ -37,7 +42,6 @@ jobs:
cache-name: linux-template-debug-v8
sconsflags: debug_symbols=no
target: template_debug
bin: ./bin/godot.linuxbsd.template_debug.x86_64.v8
cache-limit: 1

- name: Editor (target=editor, qjs_ng)
Expand Down Expand Up @@ -114,6 +118,7 @@ jobs:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: linuxbsd
target: ${{ matrix.target }}
tests: ${{ inputs.tests && matrix.target == 'editor' }}
scons-cache-limit: ${{ matrix.cache-limit }}


Expand All @@ -132,3 +137,12 @@ jobs:
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}

- name: Unit tests
if: ${{ inputs.tests && matrix.target == 'editor' }}
env:
BIN: ./bin/godot.linuxbsd.editor.x86_64
run: |
${{ env.BIN }} --version
${{ env.BIN }} --help
${{ env.BIN }} --headless --test --test-case="[jsb]*" --force-colors
17 changes: 16 additions & 1 deletion .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ on:
version:
required: true
type: string
tests:
type: boolean
default: true

# Global Settings
env:
SCONSFLAGS: module_text_server_fb_enabled=yes strict_checks=yes
SCONSFLAGS: >-
module_text_server_fb_enabled=yes
strict_checks=yes

jobs:
build-macos:
Expand Down Expand Up @@ -103,6 +108,7 @@ jobs:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} arch=arm64
platform: macos
target: ${{ matrix.target }}
tests: ${{ inputs.tests && matrix.target == 'editor' }}
scons-cache-limit: ${{ matrix.cache-limit }}

- name: Save Godot build cache
Expand All @@ -128,6 +134,15 @@ jobs:
with:
name: ${{ matrix.cache-name }}

- name: Unit tests
if: ${{ inputs.tests && matrix.target == 'editor' }}
env:
BIN: ./bin/godot.macos.editor.universal
run: |
${{ env.BIN }} --version
${{ env.BIN }} --help
${{ env.BIN }} --headless --test --test-case="[jsb]*" --force-colors

build-macos-apps:
needs:
- build-macos
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
mkdir -p "${{github.workspace}}/modules/GodotJS/"
mv "/tmp/$V8/v8" "${{github.workspace}}/modules/GodotJS/v8"
ls "${{github.workspace}}/modules/GodotJS/v8"


- name: ⬆️ Upload artifact
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -70,20 +70,23 @@ jobs:
needs: environment
with:
version: ${{ needs.environment.outputs.version }}
tests: ${{ github.event_name != 'release' }}

macos-build:
name: 🍎 macOS
uses: ./.github/workflows/macos_builds.yml
needs: environment
with:
version: ${{ needs.environment.outputs.version }}
tests: ${{ github.event_name != 'release' }}

windows-build:
name: 🏁 Windows
uses: ./.github/workflows/windows_builds.yml
needs: environment
with:
version: ${{ needs.environment.outputs.version }}
tests: ${{ github.event_name != 'release' }}

web-build:
name: 🌐 Web
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/web_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ on:

# Global Settings
env:
SCONSFLAGS: debug_symbols=no use_closure_compiler=yes strict_checks=yes deprecated=no lto=none use_assertions=no use_safe_heap=yes
SCONSFLAGS: >-
debug_symbols=no
use_closure_compiler=yes
strict_checks=yes
deprecated=no
lto=none
use_assertions=no
use_safe_heap=yes
EM_VERSION: 3.1.64

jobs:
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ on:
version:
required: true
type: string
tests:
type: boolean
default: true

# Global Settings
# SCONS_CACHE for windows must be set in the build environment
env:
SCONSFLAGS: module_text_server_fb_enabled=yes d3d12=yes strict_checks=yes "angle_libs=${{ github.workspace }}/"
SCONSFLAGS: >-
module_text_server_fb_enabled=yes
d3d12=yes
strict_checks=yes
"angle_libs=${{ github.workspace }}/"
SCONS_CACHE_MSVC_CONFIG: true

jobs:
Expand All @@ -26,7 +33,11 @@ jobs:
cache-name: windows-editor-v8
target: editor
# Skip debug symbols, they're way too big with MSVC.
sconsflags: debug_symbols=no vsproj=yes vsproj_gen_only=no windows_subsystem=console
sconsflags: >-
debug_symbols=no
vsproj=yes
vsproj_gen_only=no
windows_subsystem=console
cache-limit: 2

- name: Template (target=template_debug, v8)
Expand All @@ -45,7 +56,12 @@ jobs:
cache-name: windows-editor-qjs-ng
target: editor
# Skip debug symbols, they're way too big with MSVC.
sconsflags: debug_symbols=no vsproj=yes vsproj_gen_only=no windows_subsystem=console use_quickjs_ng=yes
sconsflags: >-
debug_symbols=no
vsproj=yes
vsproj_gen_only=no
windows_subsystem=console
use_quickjs_ng=yes
cache-limit: 2
engine: qjs_ng

Expand Down Expand Up @@ -114,6 +130,7 @@ jobs:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: windows
target: ${{ matrix.target }}
tests: ${{ inputs.tests && matrix.target == 'editor' }}
scons-cache-limit: ${{ matrix.cache-limit }}

- name: Save Godot build cache
Expand All @@ -130,3 +147,12 @@ jobs:
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}

- name: Unit tests
if: ${{ inputs.tests && matrix.target == 'editor' }}
env:
BIN: ./bin/godot.windows.editor.x86_64.exe
run: |
${{ env.BIN }} --version
${{ env.BIN }} --help
${{ env.BIN }} --headless --test --test-case="[jsb]*" --force-colors
9 changes: 8 additions & 1 deletion tests/jsb_test_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include "../weaver/jsb_script_language.h"
#include "tests/test_macros.h"

#include <chrono>
#include <thread>

#define JSB_TESTS_EXECUTION_SCOPE(env) const jsb::tests::V8ContextScope JSB_CONCAT(unique_, __COUNTER__)(env)

namespace jsb::tests
Expand Down Expand Up @@ -110,7 +113,9 @@ namespace jsb::tests
CHECK(FileAccess::exists("project.godot"));
// MESSAGE("init GodotJSScriptLanguage on thread ", Thread::get_caller_id());

install_npm();
install_npm();
// Wait for 1 second until ./node_modules has been created
std::this_thread::sleep_for(std::chrono::seconds(1));
compile_scripts();
ignore_directories();
GodotJSScriptLanguage::get_singleton()->init();
Expand Down Expand Up @@ -143,6 +148,8 @@ namespace jsb::tests
const String exe_path = OS::get_singleton()->get_name() != "Windows" ? "node" : "node.exe";
const Error err = OS::get_singleton()->create_process(exe_path, args);
CHECK(err == OK);
// Wait for 1 second until ./.godot has been created
std::this_thread::sleep_for(std::chrono::seconds(1));
CHECK(FileAccess::exists("./.godot/GodotJS/test_01.js"));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_jsb_any_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ console.assert(!gd.is_instance_valid(node));
Error err;
GodotJSScriptLanguage::get_singleton()->eval_source(R"--(
let gd = require("godot");
let mod = require("test_01");
let mod = require(".godot/GodotJS/test_01");
console.assert(typeof mod === "object");
console.assert(mod.call_me() == 123);
console.assert(typeof mod.default === "function");
Expand Down
Loading