Skip to content

Commit f37c32d

Browse files
committed
Add new CI jobs with safeguard Cargo features
1 parent 2b9bdde commit f37c32d

File tree

3 files changed

+74
-9
lines changed

3 files changed

+74
-9
lines changed

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ inputs:
5656
default: ''
5757
description: "If provided, acts as an argument for '--target', and results in output files written to ./target/{target}"
5858

59+
rust-target-dir:
60+
required: false
61+
default: ''
62+
description: "If provided, determines where to find the generated dylib. Example: 'release' if Godot editor build would look for debug otherwise."
63+
5964
rust-cache-key:
6065
required: false
6166
default: ''
@@ -151,6 +156,7 @@ runs:
151156
env:
152157
RUSTFLAGS: ${{ inputs.rust-env-rustflags }}
153158
TARGET: ${{ inputs.rust-target }}
159+
OUTPUT_DIR: ${{ inputs.rust-target-dir || 'debug' }}
154160
run: |
155161
targetArgs=""
156162
if [[ -n "$TARGET" ]]; then
@@ -162,8 +168,23 @@ runs:
162168
163169
# Instead of modifying .gdextension, rename the output directory.
164170
if [[ -n "$TARGET" ]]; then
165-
rm -rf target/debug
166-
mv target/$TARGET/debug target
171+
rm -rf target/debug target/release
172+
echo "Build output (tree -L 2 target/$TARGET/$OUTPUT_DIR):"
173+
tree -L 2 target/$TARGET/$OUTPUT_DIR || echo "(tree not installed)"
174+
mv target/$TARGET/$OUTPUT_DIR target/ || {
175+
echo "::error::Output dir $TARGET/$OUTPUT_DIR not found"
176+
exit 1
177+
}
178+
# echo "Intermediate dir (tree -L 2 target):"
179+
# tree -L 2 target || echo "(tree not installed)"
180+
if [[ "$OUTPUT_DIR" != "debug" ]]; then
181+
mv target/$OUTPUT_DIR target/debug
182+
fi
183+
echo "Resulting dir (tree -L 2 target):"
184+
tree -L 2 target || echo "(tree not installed)"
185+
# echo "itest.gdextension contents:"
186+
# cat itest/godot/itest.gdextension
187+
# echo "----------------------------------------------------"
167188
fi
168189
shell: bash
169190

.github/workflows/full-ci.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,14 @@ jobs:
378378
godot-prebuilt-patch: '4.2.2'
379379
hot-reload: api-4-2
380380

381-
# Memory checks: special Godot binaries compiled with AddressSanitizer/LeakSanitizer to detect UB/leaks.
381+
# Memory checks: special Godot binaries compiled with AddressSanitizer/LeakSanitizer to detect UB/leaks. Always Linux.
382382
# See also https://rustc-dev-guide.rust-lang.org/sanitizers.html.
383383
#
384384
# Additionally, the Godot source is patched to make dlclose() a no-op, as unloading dynamic libraries loses stacktrace and
385385
# cause false positives like println!. See https://github.com/google/sanitizers/issues/89.
386386
#
387387
# There is also a gcc variant besides clang, which is currently not used.
388-
- name: linux-memcheck-nightly
388+
- name: memcheck-nightly
389389
os: ubuntu-22.04
390390
artifact-name: linux-memcheck-nightly
391391
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
@@ -395,7 +395,28 @@ jobs:
395395
# Sanitizers can't build proc-macros and build scripts; with --target, cargo ignores RUSTFLAGS for those two.
396396
rust-target: x86_64-unknown-linux-gnu
397397

398-
- name: linux-memcheck-4.2
398+
- name: memcheck-release-disengaged
399+
os: ubuntu-22.04
400+
artifact-name: linux-memcheck-nightly
401+
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
402+
rust-toolchain: nightly
403+
rust-env-rustflags: -Zrandomize-layout -Zsanitizer=address
404+
# Currently without itest/codegen-full-experimental.
405+
rust-extra-args: --release --features godot/safeguards-release-disengaged
406+
rust-target: x86_64-unknown-linux-gnu
407+
rust-target-dir: release # We're running Godot debug build with Rust release dylib.
408+
409+
- name: memcheck-dev-balanced
410+
os: ubuntu-22.04
411+
artifact-name: linux-memcheck-nightly
412+
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
413+
rust-toolchain: nightly
414+
rust-env-rustflags: -Zrandomize-layout -Zsanitizer=address
415+
# Currently without itest/codegen-full-experimental.
416+
rust-extra-args: --features godot/safeguards-dev-balanced
417+
rust-target: x86_64-unknown-linux-gnu
418+
419+
- name: memcheck-4.2
399420
os: ubuntu-22.04
400421
artifact-name: linux-memcheck-4.2
401422
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
@@ -419,6 +440,7 @@ jobs:
419440
rust-toolchain: ${{ matrix.rust-toolchain || 'stable' }}
420441
rust-env-rustflags: ${{ matrix.rust-env-rustflags }}
421442
rust-target: ${{ matrix.rust-target }}
443+
rust-target-dir: ${{ matrix.rust-target-dir }}
422444
rust-cache-key: ${{ matrix.rust-cache-key }}
423445
with-llvm: ${{ contains(matrix.name, 'macos') && contains(matrix.rust-extra-args, 'api-custom') }}
424446
godot-check-header: ${{ matrix.godot-check-header }}
@@ -500,7 +522,7 @@ jobs:
500522
- name: "Determine success or failure"
501523
run: |
502524
DEPENDENCIES='${{ toJson(needs) }}'
503-
525+
504526
echo "Dependency jobs:"
505527
all_success=true
506528
for job in $(echo "$DEPENDENCIES" | jq -r 'keys[]'); do
@@ -510,7 +532,7 @@ jobs:
510532
all_success=false
511533
fi
512534
done
513-
535+
514536
if [[ "$all_success" == "false" ]]; then
515537
echo "One or more dependency jobs failed or were cancelled."
516538
exit 1

.github/workflows/minimal-ci.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ jobs:
210210
godot-binary: godot.linuxbsd.editor.dev.x86_64
211211
godot-prebuilt-patch: '4.2.2'
212212

213-
# Memory checkers
213+
# Memory checkers (always Linux).
214214

215-
- name: linux-memcheck
215+
- name: memcheck
216216
os: ubuntu-22.04
217217
artifact-name: linux-memcheck-nightly
218218
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
@@ -222,6 +222,27 @@ jobs:
222222
# Sanitizers can't build proc-macros and build scripts; with --target, cargo ignores RUSTFLAGS for those two.
223223
rust-target: x86_64-unknown-linux-gnu
224224

225+
- name: memcheck-release-disengaged
226+
os: ubuntu-22.04
227+
artifact-name: linux-memcheck-nightly
228+
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
229+
rust-toolchain: nightly
230+
rust-env-rustflags: -Zrandomize-layout -Zsanitizer=address
231+
# Currently without itest/codegen-full-experimental.
232+
rust-extra-args: --release --features godot/safeguards-release-disengaged
233+
rust-target: x86_64-unknown-linux-gnu
234+
rust-target-dir: release # We're running Godot debug build with Rust release dylib.
235+
236+
- name: memcheck-dev-balanced
237+
os: ubuntu-22.04
238+
artifact-name: linux-memcheck-nightly
239+
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
240+
rust-toolchain: nightly
241+
rust-env-rustflags: -Zrandomize-layout -Zsanitizer=address
242+
# Currently without itest/codegen-full-experimental.
243+
rust-extra-args: --features godot/safeguards-dev-balanced
244+
rust-target: x86_64-unknown-linux-gnu
245+
225246
steps:
226247
- uses: actions/checkout@v4
227248

@@ -236,6 +257,7 @@ jobs:
236257
rust-toolchain: ${{ matrix.rust-toolchain || 'stable' }}
237258
rust-env-rustflags: ${{ matrix.rust-env-rustflags }}
238259
rust-target: ${{ matrix.rust-target }}
260+
rust-target-dir: ${{ matrix.rust-target-dir }}
239261
with-llvm: ${{ contains(matrix.name, 'macos') && contains(matrix.rust-extra-args, 'api-custom') }}
240262
godot-check-header: ${{ matrix.godot-check-header }}
241263
godot-indirect-json: ${{ matrix.godot-indirect-json }}

0 commit comments

Comments
 (0)