Skip to content

Commit 000d056

Browse files
author
RealAstolfo
committed
Merge branch 'master' into astolfo-feature/builtin-quaternion
Removed a function called "get_euler" from the set. since it requires a "Basis" from godot to be implemented
2 parents 5b5d522 + a2b57de commit 000d056

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+6219
-1926
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
5+
name: godot
6+
description: "Run Godot integration tests"
7+
8+
inputs:
9+
artifact-name:
10+
required: true
11+
description: "Name of the compiled Godot artifact to download"
12+
13+
binary-filename:
14+
required: true
15+
description: "Filename of the Godot executable"
16+
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
# Replaces also backspaces on Windows, since they cause problems in Bash
24+
- name: "Store variable to Godot binary"
25+
run: |
26+
runnerDir=$(echo "${{ runner.temp }}" | sed "s!\\\\!/!")
27+
echo "RUNNER_DIR=$runnerDir" >> $GITHUB_ENV
28+
echo "GODOT4_BIN=$runnerDir/godot_bin/${{ inputs.binary-filename }}" >> $GITHUB_ENV
29+
shell: bash
30+
31+
# - name: "Check cache for installed Godot version"
32+
# id: "cache-godot"
33+
# uses: actions/cache@v3
34+
# with:
35+
# path: ${{ runner.temp }}/godot_bin
36+
# key: ${{ inputs.artifact-name }}-v${{ inputs.godot-ver }}
37+
# shell: bash
38+
39+
- name: "Download Godot artifact"
40+
# if: steps.cache-godot.outputs.cache-hit != 'true'
41+
run: |
42+
curl https://nightly.link/Bromeon/godot4-nightly/workflows/compile-godot/master/${{ inputs.artifact-name }}.zip \
43+
-Lo artifact.zip \
44+
--retry 3
45+
unzip artifact.zip -d $RUNNER_DIR/godot_bin
46+
shell: bash
47+
48+
- name: "Prepare Godot executable"
49+
run: |
50+
chmod +x $GODOT4_BIN
51+
shell: bash

.github/composite/godot/action.yml renamed to .github/composite/godot-itest/action.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,27 @@ inputs:
2424
default: ''
2525
description: "Extra command line arguments for 'cargo build', e.g. features"
2626

27+
with-llvm:
28+
required: false
29+
description: "Set to 'true' if LLVM should be installed"
30+
default: ''
31+
2732

2833
runs:
2934
using: "composite"
3035
steps:
3136
- uses: actions/checkout@v3
3237

33-
# Replaces also backspaces on Windows, since they cause problems in Bash
34-
- name: "Store variable to Godot binary"
35-
run: |
36-
runnerDir=$(echo "${{ runner.temp }}" | sed "s!\\\\!/!")
37-
echo "RUNNER_DIR=$runnerDir" >> $GITHUB_ENV
38-
echo "GODOT4_BIN=$runnerDir/godot_bin/${{ inputs.binary-filename }}" >> $GITHUB_ENV
39-
shell: bash
40-
41-
# - name: "Check cache for installed Godot version"
42-
# id: "cache-godot"
43-
# uses: actions/cache@v3
44-
# with:
45-
# path: ${{ runner.temp }}/godot_bin
46-
# key: ${{ inputs.artifact-name }}-v${{ inputs.godot-ver }}
47-
48-
- name: "Download Godot artifact"
49-
# if: steps.cache-godot.outputs.cache-hit != 'true'
50-
run: |
51-
curl https://nightly.link/Bromeon/godot4-nightly/workflows/compile-godot/master/${{ inputs.artifact-name }}.zip -Lo artifact.zip
52-
unzip artifact.zip -d $RUNNER_DIR/godot_bin
53-
shell: bash
38+
- name: "Install Godot"
39+
uses: ./.github/composite/godot-install
40+
with:
41+
artifact-name: ${{ inputs.artifact-name }}
42+
binary-filename: ${{ inputs.binary-filename }}
5443

5544
# The chmod seems still necessary, although applied before uploading artifact. Possibly modes are not preserved.
5645
# The `| xargs` pattern trims the output, since printed version may contain extra newline, which causes problems in env vars.
5746
- name: "Inspect Godot version"
5847
run: |
59-
chmod +x $GODOT4_BIN
6048
godotVer=$($GODOT4_BIN --version | xargs || true)
6149
gitSha=$(echo $godotVer | sed -E "s/.+custom_build\.//")
6250
echo "GODOT_BUILT_FROM=_Built from [\`$godotVer\`](https://github.com/godotengine/godot/commit/$gitSha)._" >> $GITHUB_ENV
@@ -89,10 +77,7 @@ runs:
8977
uses: ./.github/composite/rust
9078
with:
9179
rust: ${{ inputs.rust-toolchain }}
92-
93-
- name: "Install LLVM"
94-
uses: ./.github/composite/llvm
95-
# TODO only run it on systems needed
80+
with-llvm: ${{ inputs.with-llvm }}
9681

9782
- name: "Build godot-rust"
9883
run: |
@@ -109,7 +94,7 @@ runs:
10994
run: |
11095
cd itest/godot
11196
echo "OUTCOME=itest" >> $GITHUB_ENV
112-
$GODOT4_BIN --headless 2>&1 | tee >(grep "SCRIPT ERROR:" -q && {
97+
$GODOT4_BIN --headless 2>&1 | tee "${{ runner.temp }}/log.txt" | tee >(grep "SCRIPT ERROR:" -q && {
11398
printf "\n -- Godot engine encountered error, abort...\n";
11499
pkill godot
115100
echo "OUTCOME=godot-runtime" >> $GITHUB_ENV
@@ -119,6 +104,14 @@ runs:
119104
echo "OUTCOME=success" >> $GITHUB_ENV
120105
shell: bash
121106

107+
- name: "Check for memory leaks"
108+
run: |
109+
if grep -q "ObjectDB instances leaked at exit" "${{ runner.temp }}/log.txt"; then
110+
echo "OUTCOME=godot-leak" >> $GITHUB_ENV
111+
exit 2
112+
fi
113+
shell: bash
114+
122115
- name: "Conclusion"
123116
if: always()
124117
run: |
@@ -137,10 +130,17 @@ runs:
137130
exit 2
138131
;;
139132
133+
"godot-leak")
134+
echo "### :x: Memory leak" > $GITHUB_STEP_SUMMARY
135+
echo "$GODOT_BUILT_FROM" >> $GITHUB_STEP_SUMMARY
136+
echo "Integration tests cause memory leaks." >> $GITHUB_STEP_SUMMARY
137+
exit 3
138+
;;
139+
140140
"itest")
141141
echo "### :x: Godot integration tests failed" > $GITHUB_STEP_SUMMARY
142142
echo "$GODOT_BUILT_FROM" >> $GITHUB_STEP_SUMMARY
143-
exit 3
143+
exit 4
144144
;;
145145
146146
"header-diff")
@@ -150,7 +150,7 @@ runs:
150150
*)
151151
echo "### :x: Unknown error occurred" > $GITHUB_STEP_SUMMARY
152152
echo "$GODOT_BUILT_FROM" >> $GITHUB_STEP_SUMMARY
153-
exit 4
153+
exit 5
154154
;;
155155
esac
156156
shell: bash

.github/composite/rust/action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,22 @@ inputs:
1010
required: false
1111
description: "Rust toolchain, e.g. 'stable' or 'nightly'"
1212
default: stable
13+
1314
components:
1415
required: false
1516
description: "Components array"
1617
default: ''
18+
1719
cache-key:
1820
required: false
1921
description: "Extra key to resolve cache"
2022
default: ''
2123

24+
with-llvm:
25+
required: false
26+
description: "Set to 'true' if LLVM should be installed"
27+
default: ''
28+
2229
runs:
2330
using: "composite"
2431
steps:
@@ -41,6 +48,10 @@ runs:
4148
with:
4249
shared-key: ${{ inputs.cache-key }}
4350

51+
- name: "Install LLVM"
52+
uses: ./.github/composite/llvm
53+
if: ${{ inputs.with-llvm == 'true' }}
54+
4455
- name: "Set environment variables used by toolchain"
4556
run: |
4657
echo CARGO_TERM_COLOR=always >> $GITHUB_ENV

.github/external-config/licenserc.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ header:
1111
paths:
1212
- '**/*.rs'
1313
- '**/*.gd'
14+
- '**/*.sh'
1415
- '.github/**/*.yml'
1516

1617
paths-ignore:
@@ -20,7 +21,7 @@ header:
2021

2122
language:
2223
GDScript:
23-
extensions: ['.gd']
24+
extensions: ['.gd', '.sh']
2425
comment_style_id: 'Hashtag'
2526
Rust:
2627
extensions: ['.rs']

.github/workflows/full-ci.yml

Lines changed: 63 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ on:
1414
- trying
1515

1616
env:
17-
GDEXT_FEATURES: 'godot-core/convenience'
18-
GDEXT_CRATE_ARGS: '-p godot-codegen -p godot-ffi -p godot-core -p godot-macros -p godot'
17+
GDEXT_FEATURES: '--features godot-core/convenience'
18+
# GDEXT_CRATE_ARGS: '-p godot-codegen -p godot-ffi -p godot-core -p godot-macros -p godot'
1919

2020
defaults:
2121
run:
@@ -31,17 +31,41 @@ jobs:
3131
runs-on: ubuntu-20.04
3232
steps:
3333
- uses: actions/checkout@v3
34+
3435
- name: "Install Rust"
3536
uses: ./.github/composite/rust
3637
with:
3738
rust: stable
3839
components: rustfmt
40+
3941
- name: "Check rustfmt"
4042
run: cargo fmt --all -- --check
4143

4244

45+
clippy:
46+
runs-on: ubuntu-20.04
47+
steps:
48+
- uses: actions/checkout@v3
49+
50+
- name: "Install Rust"
51+
uses: ./.github/composite/rust
52+
53+
# TODO get rid of Godot binary, once the JSON is either versioned or fetched from somewhere
54+
# Replaces also backspaces on Windows, since they cause problems in Bash
55+
- name: "Install Godot"
56+
uses: ./.github/composite/godot-install
57+
with:
58+
artifact-name: godot-linux
59+
binary-filename: godot.linuxbsd.editor.dev.x86_64
60+
61+
- name: "Check clippy"
62+
run: |
63+
cargo clippy --all-targets $GDEXT_FEATURES -- -D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
64+
-D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented -D warnings
65+
66+
4367
unit-test:
44-
name: unit-test (${{ matrix.name }})
68+
name: unit-test (${{ matrix.name }}${{ matrix.rust-special }})
4569
runs-on: ${{ matrix.os }}
4670
continue-on-error: false
4771
strategy:
@@ -54,21 +78,25 @@ jobs:
5478
- name: macos
5579
os: macos-11
5680
rust-toolchain: stable
81+
godot-binary: godot.macos.editor.dev.x86_64
5782

5883
- name: windows
5984
os: windows-latest
6085
rust-toolchain: stable-x86_64-pc-windows-msvc
86+
godot-binary: godot.windows.editor.dev.x86_64.exe
6187

6288
# Don't use latest Ubuntu (22.04) as it breaks lots of ecosystem compatibility.
6389
# If ever moving to ubuntu-latest, need to manually install libtinfo5 for LLVM.
6490
- name: linux
6591
os: ubuntu-20.04
6692
rust-toolchain: stable
93+
godot-binary: godot.linuxbsd.editor.dev.x86_64
6794

68-
- name: linux-minimal-deps
95+
- name: linux
6996
os: ubuntu-20.04
7097
rust-toolchain: stable
71-
rust-special: minimal-deps
98+
rust-special: -minimal-deps
99+
godot-binary: godot.linuxbsd.editor.dev.x86_64
72100

73101
steps:
74102
- uses: actions/checkout@v3
@@ -78,33 +106,39 @@ jobs:
78106
with:
79107
rust: stable
80108
cache-key: ${{ matrix.rust-special }} # 'minimal-deps' or empty/not defined
109+
with-llvm: ${{ matrix.name == 'macos' }}
81110

82111
- name: "Install Rust nightly (minimal deps)"
83112
uses: ./.github/composite/rust
84113
with:
85114
rust: nightly
86115
cache-key: minimal-deps-nightly
87-
if: ${{ matrix.rust-special == 'minimal-deps' }}
116+
if: ${{ matrix.rust-special == '-minimal-deps' }}
88117

89118
- name: "Install minimal dependency versions from Cargo"
90119
run: cargo +nightly update -Z minimal-versions
91-
if: ${{ matrix.rust-special == 'minimal-deps' }}
120+
if: ${{ matrix.rust-special == '-minimal-deps' }}
92121

93-
- name: "Install LLVM"
94-
uses: ./.github/composite/llvm
95-
if: matrix.name == 'macos'
122+
# TODO get rid of Godot binary, once the JSON is either versioned or fetched from somewhere
123+
# Replaces also backspaces on Windows, since they cause problems in Bash
124+
- name: "Install Godot"
125+
uses: ./.github/composite/godot-install
126+
with:
127+
artifact-name: godot-${{ matrix.name }}
128+
binary-filename: ${{ matrix.godot-binary }}
96129

97130
- name: "Compile tests"
98-
run: cargo test $GDEXT_CRATE_ARGS --features unit-test,$GDEXT_FEATURES --no-run
131+
run: cargo test $GDEXT_FEATURES --no-run
99132

100133
- name: "Test"
101-
run: cargo test $GDEXT_CRATE_ARGS --features unit-test,$GDEXT_FEATURES ${{ matrix.testflags }}
134+
run: cargo test $GDEXT_FEATURES
102135

103136

104-
itest-godot:
105-
name: itest-godot (${{ matrix.name }})
137+
godot-itest:
138+
name: godot-itest (${{ matrix.name }})
106139
runs-on: ${{ matrix.os }}
107-
continue-on-error: false
140+
# TODO: continue-on-error: false, as soon as memory errors are fixed
141+
continue-on-error: ${{ contains(matrix.name, 'memcheck') }}
108142
timeout-minutes: 24
109143
strategy:
110144
fail-fast: false # cancel all jobs as soon as one fails?
@@ -130,15 +164,25 @@ jobs:
130164
rust-toolchain: stable
131165
godot-binary: godot.linuxbsd.editor.dev.x86_64
132166

167+
- name: linux-memcheck-gcc
168+
os: ubuntu-20.04
169+
rust-toolchain: stable
170+
godot-binary: godot.linuxbsd.editor.dev.x86_64.san
171+
172+
- name: linux-memcheck-clang
173+
os: ubuntu-20.04
174+
rust-toolchain: stable
175+
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
176+
133177
steps:
134178
- uses: actions/checkout@v3
135179

136180
- name: "Run Godot integration test"
137-
uses: ./.github/composite/godot
181+
uses: ./.github/composite/godot-itest
138182
with:
139183
artifact-name: godot-${{ matrix.name }}
140184
binary-filename: ${{ matrix.godot-binary }}
141-
#godot_ver: ${{ matrix.godot }}
185+
with-llvm: ${{ matrix.name == 'macos' }}
142186

143187

144188
license-guard:
@@ -161,8 +205,9 @@ jobs:
161205
if: github.event_name == 'push' && success()
162206
needs:
163207
- rustfmt
208+
- clippy
164209
- unit-test
165-
- itest-godot
210+
- godot-itest
166211
- license-guard
167212
runs-on: ubuntu-20.04
168213
steps:

0 commit comments

Comments
 (0)