Skip to content

Commit 0ea7a23

Browse files
authored
Merge pull request #1 from godot-rust/master
update
2 parents da04ee1 + afa2e59 commit 0ea7a23

File tree

109 files changed

+8177
-1663
lines changed

Some content is hidden

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

109 files changed

+8177
-1663
lines changed

.github/composite/godot-install/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
required: true
1111
description: "Name of the compiled Godot artifact to download"
1212

13-
binary-filename:
13+
godot-binary:
1414
required: true
1515
description: "Filename of the Godot executable"
1616

@@ -25,7 +25,7 @@ runs:
2525
run: |
2626
runnerDir=$(echo "${{ runner.temp }}" | sed "s!\\\\!/!")
2727
echo "RUNNER_DIR=$runnerDir" >> $GITHUB_ENV
28-
echo "GODOT4_BIN=$runnerDir/godot_bin/${{ inputs.binary-filename }}" >> $GITHUB_ENV
28+
echo "GODOT4_BIN=$runnerDir/godot_bin/${{ inputs.godot-binary }}" >> $GITHUB_ENV
2929
shell: bash
3030

3131
# - name: "Check cache for installed Godot version"

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ inputs:
1010
required: true
1111
description: "Name of the compiled Godot artifact to download"
1212

13-
binary-filename:
13+
godot-binary:
1414
required: true
1515
description: "Filename of the Godot executable"
1616

17+
godot-args:
18+
required: false
19+
default: ''
20+
description: "Command-line arguments passed to Godot"
21+
1722
rust-toolchain:
1823
required: false
1924
default: 'stable'
@@ -24,10 +29,15 @@ inputs:
2429
default: ''
2530
description: "Extra command line arguments for 'cargo build', e.g. features"
2631

32+
rust-env-rustflags:
33+
required: false
34+
default: ''
35+
description: "Extra values for the RUSTFLAGS env var"
36+
2737
with-llvm:
2838
required: false
29-
description: "Set to 'true' if LLVM should be installed"
3039
default: ''
40+
description: "Set to 'true' if LLVM should be installed"
3141

3242

3343
runs:
@@ -39,7 +49,7 @@ runs:
3949
uses: ./.github/composite/godot-install
4050
with:
4151
artifact-name: ${{ inputs.artifact-name }}
42-
binary-filename: ${{ inputs.binary-filename }}
52+
godot-binary: ${{ inputs.godot-binary }}
4353

4454
# The chmod seems still necessary, although applied before uploading artifact. Possibly modes are not preserved.
4555
# The `| xargs` pattern trims the output, since printed version may contain extra newline, which causes problems in env vars.
@@ -83,6 +93,8 @@ runs:
8393
run: |
8494
cargo build -p itest ${{ inputs.rust-extra-args }}
8595
shell: bash
96+
env:
97+
RUSTFLAGS: ${{ inputs.rust-env-rustflags }}
8698

8799
- name: "Run Godot integration tests"
88100
# Aborts immediately if Godot outputs certain keywords (would otherwise stall until CI runner times out).
@@ -94,7 +106,7 @@ runs:
94106
run: |
95107
cd itest/godot
96108
echo "OUTCOME=itest" >> $GITHUB_ENV
97-
$GODOT4_BIN --headless 2>&1 | tee "${{ runner.temp }}/log.txt" | tee >(grep "SCRIPT ERROR:" -q && {
109+
$GODOT4_BIN --headless ${{ inputs.godot-args }} 2>&1 | tee "${{ runner.temp }}/log.txt" | tee >(grep "SCRIPT ERROR:" -q && {
98110
printf "\n -- Godot engine encountered error, abort...\n";
99111
pkill godot
100112
echo "OUTCOME=godot-runtime" >> $GITHUB_ENV

.github/composite/rust/action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ runs:
3232
- name: "Configure"
3333
id: configure
3434
run: |
35+
echo "Rust cache shared-key: '${{ runner.os }}-${{ inputs.rust }}${{ inputs.cache-key }}'"
3536
echo "components=$( for c in ${cs//,/ }; do echo -n ' --component' $c; done )" >> $GITHUB_OUTPUT
3637
env:
3738
cs: ${{ inputs.components }}
@@ -46,7 +47,18 @@ runs:
4647
- name: "Reuse cached dependencies"
4748
uses: Swatinem/rust-cache@v2
4849
with:
49-
shared-key: ${{ inputs.cache-key }}
50+
# A cache key that is used instead of the automatic `job`-based key, and is stable over multiple jobs.
51+
# default: empty
52+
shared-key: "${{ runner.os }}-${{ inputs.rust }}${{ inputs.cache-key }}"
53+
54+
# An additional cache key that is added alongside the automatic `job`-based
55+
# cache key and can be used to further differentiate jobs.
56+
# default: empty
57+
key: ${{ inputs.cache-key }}
58+
59+
# Determines if the cache should be saved even when the workflow has failed.
60+
# default: "false"
61+
cache-on-failure: true
5062

5163
- name: "Install LLVM"
5264
uses: ./.github/composite/llvm

.github/workflows/full-ci.yml

Lines changed: 70 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ env:
1818
# GDEXT_FEATURES: '--features crate/feature'
1919
# GDEXT_CRATE_ARGS: '-p godot-codegen -p godot-ffi -p godot-core -p godot-macros -p godot'
2020

21+
# LSan options: https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer
22+
# * report_objects: list individual leaked objects when running LeakSanitizer
23+
LSAN_OPTIONS: report_objects=1
24+
25+
# ASan options: https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
26+
2127
defaults:
2228
run:
2329
shell: bash
@@ -44,7 +50,20 @@ jobs:
4450

4551

4652
clippy:
53+
name: clippy (${{ matrix.name }})
4754
runs-on: ubuntu-20.04
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
include:
59+
- name: linux
60+
rust-toolchain: stable
61+
godot-binary: godot.linuxbsd.editor.dev.x86_64
62+
63+
- name: linux-double
64+
rust-toolchain: stable
65+
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
66+
rust-extra-args: --features double-precision
4867
steps:
4968
- uses: actions/checkout@v3
5069

@@ -56,13 +75,14 @@ jobs:
5675
- name: "Install Godot"
5776
uses: ./.github/composite/godot-install
5877
with:
59-
artifact-name: godot-linux
60-
binary-filename: godot.linuxbsd.editor.dev.x86_64
78+
artifact-name: godot-${{ matrix.name }}
79+
godot-binary: ${{ matrix.godot-binary }}
6180

6281
- name: "Check clippy"
6382
run: |
64-
cargo clippy --all-targets $GDEXT_FEATURES -- -D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
65-
-D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented -D warnings
83+
cargo clippy --all-targets $GDEXT_FEATURES ${{ matrix.rust-extra-args }} -- \
84+
-D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
85+
-D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented -D warnings
6686
6787
6888
unit-test:
@@ -80,6 +100,7 @@ jobs:
80100
os: macos-11
81101
rust-toolchain: stable
82102
godot-binary: godot.macos.editor.dev.x86_64
103+
with-llvm: true
83104

84105
- name: windows
85106
os: windows-latest
@@ -98,16 +119,16 @@ jobs:
98119
rust-toolchain: stable
99120
rust-special: -minimal-deps
100121
godot-binary: godot.linuxbsd.editor.dev.x86_64
101-
122+
102123
steps:
103124
- uses: actions/checkout@v3
104125

105126
- name: "Install Rust"
106127
uses: ./.github/composite/rust
107128
with:
108129
rust: stable
109-
cache-key: ${{ matrix.rust-special }} # 'minimal-deps' or empty/not defined
110-
with-llvm: ${{ matrix.name == 'macos' }}
130+
cache-key: ${{ matrix.rust-special }} # '-minimal-deps' or empty/not defined
131+
with-llvm: ${{ matrix.with-llvm }}
111132

112133
- name: "Install Rust nightly (minimal deps)"
113134
uses: ./.github/composite/rust
@@ -126,20 +147,19 @@ jobs:
126147
uses: ./.github/composite/godot-install
127148
with:
128149
artifact-name: godot-${{ matrix.name }}
129-
binary-filename: ${{ matrix.godot-binary }}
150+
godot-binary: ${{ matrix.godot-binary }}
130151

131152
- name: "Compile tests"
132-
run: cargo test $GDEXT_FEATURES --no-run
153+
run: cargo test $GDEXT_FEATURES --no-run ${{ matrix.rust-extra-args }}
133154

134155
- name: "Test"
135-
run: cargo test $GDEXT_FEATURES
156+
run: cargo test $GDEXT_FEATURES ${{ matrix.rust-extra-args }}
136157

137158

138159
godot-itest:
139160
name: godot-itest (${{ matrix.name }})
140161
runs-on: ${{ matrix.os }}
141-
# TODO: continue-on-error: false, as soon as memory errors are fixed
142-
continue-on-error: ${{ contains(matrix.name, 'memcheck') }}
162+
continue-on-error: false
143163
timeout-minutes: 24
144164
strategy:
145165
fail-fast: false # cancel all jobs as soon as one fails?
@@ -152,28 +172,58 @@ jobs:
152172
os: macos-12
153173
rust-toolchain: stable
154174
godot-binary: godot.macos.editor.dev.x86_64
175+
with-llvm: true
176+
177+
- name: macos-double
178+
os: macos-12
179+
rust-toolchain: stable
180+
godot-binary: godot.macos.editor.dev.double.x86_64
181+
rust-extra-args: --features double-precision
182+
with-llvm: true
155183

156184
- name: windows
157185
os: windows-latest
158186
rust-toolchain: stable-x86_64-pc-windows-msvc
159187
godot-binary: godot.windows.editor.dev.x86_64.exe
160188

189+
- name: windows-double
190+
os: windows-latest
191+
rust-toolchain: stable-x86_64-pc-windows-msvc
192+
godot-binary: godot.windows.editor.dev.double.x86_64.exe
193+
rust-extra-args: --features double-precision
194+
161195
# Don't use latest Ubuntu (22.04) as it breaks lots of ecosystem compatibility.
162196
# If ever moving to ubuntu-latest, need to manually install libtinfo5 for LLVM.
163197
- name: linux
164198
os: ubuntu-20.04
165199
rust-toolchain: stable
166200
godot-binary: godot.linuxbsd.editor.dev.x86_64
167201

168-
- name: linux-memcheck-gcc
202+
- name: linux-double
169203
os: ubuntu-20.04
170204
rust-toolchain: stable
205+
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
206+
rust-extra-args: --features double-precision
207+
208+
# Special Godot binaries compiled with AddressSanitizer/LeakSanitizer to detect UB/leaks.
209+
# Additionally, the Godot source is patched to make dlclose() a no-op, as unloading dynamic libraries loses stacktrace and
210+
# cause false positives like println!. See https://github.com/google/sanitizers/issues/89.
211+
# The gcc version can possibly be removed later, as it is slower and needs a larger artifact than the clang one.
212+
213+
# --disallow-focus: fail if #[itest(focus)] is encountered, to prevent running only a few tests for full CI
214+
- name: linux-memcheck-gcc
215+
os: ubuntu-20.04
171216
godot-binary: godot.linuxbsd.editor.dev.x86_64.san
217+
godot-args: -- --disallow-focus
218+
rust-toolchain: nightly
219+
rust-env-rustflags: -Zrandomize-layout
172220

173221
- name: linux-memcheck-clang
174222
os: ubuntu-20.04
175-
rust-toolchain: stable
176223
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
224+
godot-args: -- --disallow-focus
225+
rust-toolchain: nightly
226+
rust-env-rustflags: -Zrandomize-layout
177227

178228
steps:
179229
- uses: actions/checkout@v3
@@ -182,8 +232,12 @@ jobs:
182232
uses: ./.github/composite/godot-itest
183233
with:
184234
artifact-name: godot-${{ matrix.name }}
185-
binary-filename: ${{ matrix.godot-binary }}
186-
with-llvm: ${{ matrix.name == 'macos' }}
235+
godot-binary: ${{ matrix.godot-binary }}
236+
godot-args: ${{ matrix.godot-args }}
237+
rust-extra-args: ${{ matrix.rust-extra-args }}
238+
rust-toolchain: ${{ matrix.rust-toolchain }}
239+
rust-env-rustflags: ${{ matrix.rust-env-rustflags }}
240+
with-llvm: ${{ matrix.with-llvm }}
187241

188242

189243
license-guard:

.github/workflows/minimal-ci.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,20 @@ jobs:
4444

4545

4646
clippy:
47+
name: clippy (${{ matrix.name }})
4748
runs-on: ubuntu-20.04
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
include:
53+
- name: linux
54+
rust-toolchain: stable
55+
godot-binary: godot.linuxbsd.editor.dev.x86_64
56+
57+
- name: linux-double
58+
rust-toolchain: stable
59+
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
60+
rust-extra-args: --features double-precision
4861
steps:
4962
- uses: actions/checkout@v3
5063

@@ -56,12 +69,13 @@ jobs:
5669
- name: "Install Godot"
5770
uses: ./.github/composite/godot-install
5871
with:
59-
artifact-name: godot-linux
60-
binary-filename: godot.linuxbsd.editor.dev.x86_64
72+
artifact-name: godot-${{ matrix.name }}
73+
godot-binary: ${{ matrix.godot-binary }}
6174

6275
- name: "Check clippy"
6376
run: |
64-
cargo clippy --all-targets $GDEXT_FEATURES -- -D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
77+
cargo clippy --all-targets $GDEXT_FEATURES ${{ matrix.rust-extra-args }} -- \
78+
-D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
6579
-D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented -D warnings
6680
6781
@@ -78,7 +92,7 @@ jobs:
7892
uses: ./.github/composite/godot-install
7993
with:
8094
artifact-name: godot-linux
81-
binary-filename: godot.linuxbsd.editor.dev.x86_64
95+
godot-binary: godot.linuxbsd.editor.dev.x86_64
8296

8397
- name: "Compile tests"
8498
run: cargo test $GDEXT_FEATURES --no-run
@@ -98,7 +112,7 @@ jobs:
98112
uses: ./.github/composite/godot-itest
99113
with:
100114
artifact-name: godot-linux
101-
binary-filename: godot.linuxbsd.editor.dev.x86_64
115+
godot-binary: godot.linuxbsd.editor.dev.x86_64
102116
#godot_ver: ${{ matrix.godot }}
103117

104118

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ target
88
Cargo.lock
99

1010
# Godot
11-
**/.import/
11+
# .godot needs to be a pattern like this and not a directory, otherwise the negative statements below don't apply
1212
**/.godot/**
13+
*.import
14+
1315
# Needed to run projects without having to open the editor first.
1416
!**/.godot/extension_list.cfg
1517
!**/.godot/global_script_class_cache.cfg

0 commit comments

Comments
 (0)