Skip to content

Commit 7a0415f

Browse files
bors[bot]Bromeon
andauthored
Merge #174
174: CI improvements (cache, random layout, #jobs) r=Bromeon a=Bromeon bors r+ Co-authored-by: Jan Haller <[email protected]>
2 parents 54cb201 + eced44c commit 7a0415f

File tree

5 files changed

+40
-105
lines changed

5 files changed

+40
-105
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ inputs:
2929
default: ''
3030
description: "Extra command line arguments for 'cargo build', e.g. features"
3131

32+
rust-env-rustflags:
33+
required: false
34+
default: ''
35+
description: "Extra values for the RUSTFLAGS env var"
36+
3237
with-llvm:
3338
required: false
3439
default: ''
@@ -88,6 +93,8 @@ runs:
8893
run: |
8994
cargo build -p itest ${{ inputs.rust-extra-args }}
9095
shell: bash
96+
env:
97+
RUSTFLAGS: ${{ inputs.rust-env-rustflags }}
9198

9299
- name: "Run Godot integration tests"
93100
# Aborts immediately if Godot outputs certain keywords (would otherwise stall until CI runner times out).

.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: 20 additions & 27 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
@@ -96,22 +102,11 @@ jobs:
96102
godot-binary: godot.macos.editor.dev.x86_64
97103
with-llvm: true
98104

99-
- name: macos-double
100-
os: macos-11
101-
rust-toolchain: stable
102-
godot-binary: godot.macos.editor.dev.double.x86_64
103-
with-llvm: true
104-
105105
- name: windows
106106
os: windows-latest
107107
rust-toolchain: stable-x86_64-pc-windows-msvc
108108
godot-binary: godot.windows.editor.dev.x86_64.exe
109109

110-
- name: windows-double
111-
os: windows-latest
112-
rust-toolchain: stable-x86_64-pc-windows-msvc
113-
godot-binary: godot.windows.editor.dev.double.x86_64.exe
114-
115110
# Don't use latest Ubuntu (22.04) as it breaks lots of ecosystem compatibility.
116111
# If ever moving to ubuntu-latest, need to manually install libtinfo5 for LLVM.
117112
- name: linux
@@ -125,20 +120,14 @@ jobs:
125120
rust-special: -minimal-deps
126121
godot-binary: godot.linuxbsd.editor.dev.x86_64
127122

128-
- name: linux-double
129-
os: ubuntu-20.04
130-
rust-toolchain: stable
131-
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
132-
rust-extra-args: --features double-precision
133-
134123
steps:
135124
- uses: actions/checkout@v3
136125

137126
- name: "Install Rust"
138127
uses: ./.github/composite/rust
139128
with:
140129
rust: stable
141-
cache-key: ${{ matrix.rust-special }} # 'minimal-deps' or empty/not defined
130+
cache-key: ${{ matrix.rust-special }} # '-minimal-deps' or empty/not defined
142131
with-llvm: ${{ matrix.with-llvm }}
143132

144133
- name: "Install Rust nightly (minimal deps)"
@@ -210,6 +199,12 @@ jobs:
210199
rust-toolchain: stable
211200
godot-binary: godot.linuxbsd.editor.dev.x86_64
212201

202+
- name: linux-double
203+
os: ubuntu-20.04
204+
rust-toolchain: stable
205+
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
206+
rust-extra-args: --features double-precision
207+
213208
# Special Godot binaries compiled with AddressSanitizer/LeakSanitizer to detect UB/leaks.
214209
# Additionally, the Godot source is patched to make dlclose() a no-op, as unloading dynamic libraries loses stacktrace and
215210
# cause false positives like println!. See https://github.com/google/sanitizers/issues/89.
@@ -218,21 +213,17 @@ jobs:
218213
# --disallow-focus: fail if #[itest(focus)] is encountered, to prevent running only a few tests for full CI
219214
- name: linux-memcheck-gcc
220215
os: ubuntu-20.04
221-
rust-toolchain: stable
222216
godot-binary: godot.linuxbsd.editor.dev.x86_64.san
223217
godot-args: -- --disallow-focus
218+
rust-toolchain: nightly
219+
rust-env-rustflags: -Zrandomize-layout
224220

225221
- name: linux-memcheck-clang
226222
os: ubuntu-20.04
227-
rust-toolchain: stable
228223
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
229224
godot-args: -- --disallow-focus
230-
231-
- name: linux-double
232-
os: ubuntu-20.04
233-
rust-toolchain: stable
234-
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
235-
rust-extra-args: --features double-precision
225+
rust-toolchain: nightly
226+
rust-env-rustflags: -Zrandomize-layout
236227

237228
steps:
238229
- uses: actions/checkout@v3
@@ -243,8 +234,10 @@ jobs:
243234
artifact-name: godot-${{ matrix.name }}
244235
godot-binary: ${{ matrix.godot-binary }}
245236
godot-args: ${{ matrix.godot-args }}
246-
with-llvm: ${{ matrix.with-llvm }}
247237
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 }}
248241

249242

250243
license-guard:

godot-ffi/src/global_registry.rs

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

godot-ffi/src/lib.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
)]
2020
pub(crate) mod gen;
2121

22-
mod global_registry;
2322
mod godot_ffi;
2423
mod opaque;
2524
mod plugins;
@@ -33,16 +32,12 @@ pub use crate::godot_ffi::{GodotFfi, GodotFuncMarshal};
3332
pub use gen::central::*;
3433
pub use gen::gdextension_interface::*;
3534

36-
use crate::global_registry::GlobalRegistry; // needs `crate::`
37-
3835
// ----------------------------------------------------------------------------------------------------------------------------------------------
39-
// Real implementation, when Godot engine is running
4036

4137
struct GodotBinding {
4238
interface: GDExtensionInterface,
4339
library: GDExtensionClassLibraryPtr,
4440
method_table: GlobalMethodTable,
45-
registry: GlobalRegistry,
4641
}
4742

4843
/// Late-init globals
@@ -69,7 +64,6 @@ pub unsafe fn initialize(
6964
BINDING = Some(GodotBinding {
7065
interface: *interface,
7166
method_table: GlobalMethodTable::new(&*interface),
72-
registry: GlobalRegistry::default(),
7367
library,
7468
});
7569
}
@@ -98,17 +92,6 @@ pub unsafe fn method_table() -> &'static GlobalMethodTable {
9892
&unwrap_ref_unchecked(&BINDING).method_table
9993
}
10094

101-
/// # Safety
102-
///
103-
/// The interface must have been initialised with [`initialize`] before calling this function.
104-
///
105-
/// Calling this while another place holds a reference (threads, re-entrancy, iteration, etc) is immediate undefined behavior.
106-
// note: could potentially avoid &mut aliasing, using UnsafeCell/RefCell
107-
#[inline(always)]
108-
pub unsafe fn get_registry() -> &'static mut GlobalRegistry {
109-
&mut unwrap_ref_unchecked_mut(&mut BINDING).registry
110-
}
111-
11295
/// Makes sure that Godot is running, or panics. Debug mode only!
11396
macro_rules! debug_assert_godot {
11497
($expr:expr) => {
@@ -130,15 +113,6 @@ unsafe fn unwrap_ref_unchecked<T>(opt: &Option<T>) -> &T {
130113
}
131114
}
132115

133-
unsafe fn unwrap_ref_unchecked_mut<T>(opt: &mut Option<T>) -> &mut T {
134-
debug_assert_godot!(opt.is_some());
135-
136-
match opt {
137-
Some(ref mut val) => val,
138-
None => std::hint::unreachable_unchecked(),
139-
}
140-
}
141-
142116
// ----------------------------------------------------------------------------------------------------------------------------------------------
143117

144118
#[macro_export]

0 commit comments

Comments
 (0)