Skip to content

Commit 1fd3f82

Browse files
committed
Add automated tests that run a GDExtension (rather than just building it)
1 parent 1c18413 commit 1fd3f82

File tree

17 files changed

+274
-120
lines changed

17 files changed

+274
-120
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
platform: linux
2323
artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
2424
artifact-path: bin/libgodot-cpp.linux.template_release.x86_64.a
25+
run-tests: true
2526
cache-name: linux-x86_64
2627

2728
- name: 🐧 Linux (GCC, Double Precision)
@@ -30,13 +31,15 @@ jobs:
3031
artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release
3132
artifact-path: bin/libgodot-cpp.linux.template_release.double.x86_64.a
3233
flags: precision=double
34+
run-tests: false
3335
cache-name: linux-x86_64-f64
3436

3537
- name: 🏁 Windows (x86_64, MSVC)
3638
os: windows-2019
3739
platform: windows
3840
artifact-name: godot-cpp-windows-msvc2019-x86_64-release
3941
artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.lib
42+
run-tests: false
4043
cache-name: windows-x86_64-msvc
4144

4245
- name: 🏁 Windows (x86_64, MinGW)
@@ -45,6 +48,7 @@ jobs:
4548
artifact-name: godot-cpp-linux-mingw-x86_64-release
4649
artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.a
4750
flags: use_mingw=yes
51+
run-tests: false
4852
cache-name: windows-x86_64-mingw
4953

5054
- name: 🍎 macOS (universal)
@@ -53,6 +57,7 @@ jobs:
5357
artifact-name: godot-cpp-macos-universal-release
5458
artifact-path: bin/libgodot-cpp.macos.template_release.universal.a
5559
flags: arch=universal
60+
run-tests: false
5661
cache-name: macos-universal
5762

5863
- name: 🤖 Android (arm64)
@@ -61,6 +66,7 @@ jobs:
6166
artifact-name: godot-cpp-android-arm64-release
6267
artifact-path: bin/libgodot-cpp.android.template_release.arm64.a
6368
flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME arch=arm64
69+
run-tests: false
6470
cache-name: android-arm64
6571

6672
- name: 🍏 iOS (arm64)
@@ -69,6 +75,7 @@ jobs:
6975
artifact-name: godot-cpp-ios-arm64-release
7076
artifact-path: bin/libgodot-cpp.ios.template_release.arm64.a
7177
flags: arch=arm64
78+
run-tests: false
7279
cache-name: ios-arm64
7380

7481
env:
@@ -124,6 +131,31 @@ jobs:
124131
cd test
125132
scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }}
126133
134+
- name: Download latest Godot artifacts
135+
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
136+
if: ${{ matrix.run-tests }}
137+
with:
138+
repo: godotengine/godot
139+
branch: master
140+
event: push
141+
workflow: linux_builds.yml
142+
workflow_conclusion: success
143+
name: linux-editor-mono
144+
search_artifacts: true
145+
check_artifacts: true
146+
ensure_latest: true
147+
path: godot-artifacts
148+
149+
- name: Run tests
150+
if: ${{ matrix.run-tests }}
151+
run: |
152+
chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
153+
./godot-artifacts/godot.linuxbsd.editor.x86_64.mono --headless --version
154+
cd test
155+
# Need to run the editor so .godot is generated... but it crashes! Ignore that :-)
156+
(cd project && (../../godot-artifacts/godot.linuxbsd.editor.x86_64.mono --editor --headless --quit >/dev/null 2>&1 || true))
157+
GODOT=../godot-artifacts/godot.linuxbsd.editor.x86_64.mono ./run-tests.sh
158+
127159
- name: Upload artifact
128160
uses: actions/upload-artifact@v3
129161
with:

test/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# godot-cpp example / integration test
1+
# godot-cpp integration test
22

33
This project is used to perform integration testing of the godot-cpp
44
extension, to validate PRs and implemented APIs.
55

6-
It can also be used as a quick example of how to set up a godot-cpp
7-
project, both on the C++ side and in the Godot project itself.
8-
96
## License
107

118
This is free and unencumbered software released into the public domain.

test/SConstruct

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ sources = Glob("src/*.cpp")
1818

1919
if env["platform"] == "macos":
2020
library = env.SharedLibrary(
21-
"demo/bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format(
21+
"project/bin/libgdexample.{}.{}.framework/libgdexample.{}.{}".format(
2222
env["platform"], env["target"], env["platform"], env["target"]
2323
),
2424
source=sources,
2525
)
2626
else:
2727
library = env.SharedLibrary(
28-
"demo/bin/libgdexample{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
28+
"project/bin/libgdexample{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
2929
source=sources,
3030
)
3131

test/demo/main.gd

Lines changed: 0 additions & 80 deletions
This file was deleted.

test/demo/default_env.tres renamed to test/project/default_env.tres

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
[resource]
66
background_mode = 2
7-
sky = SubResource( "1" )
7+
sky = SubResource("1")
File renamed without changes.
File renamed without changes.

test/demo/icon.png.import renamed to test/project/icon.png.import

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.cte
1616
[params]
1717

1818
compress/mode=0
19+
compress/high_quality=false
1920
compress/lossy_quality=0.7
2021
compress/hdr_compression=1
21-
compress/bptc_ldr=0
2222
compress/normal_map=0
2323
compress/channel_pack=0
2424
mipmaps/generate=false

0 commit comments

Comments
 (0)