Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync to latest changes #2

Merged
merged 24 commits into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1b32155
Make `get` and `set` arguments take identifiers instead of strings
ttencate Mar 26, 2023
c1c2d60
Merge #203
bors[bot] Mar 27, 2023
2a201f5
Implement #[init(default = ...)] annotation
ttencate Mar 27, 2023
c6ebd3d
Merge #205
bors[bot] Mar 27, 2023
c9af2f3
Add separate crate which handles command-line interaction with Godot …
Bromeon Mar 26, 2023
00de6ac
Add basic impls of `Rect2`, `Rect2i`, `Aabb`, `Plane`
lilizoey Mar 14, 2023
08c6594
Merge #180
bors[bot] Mar 28, 2023
8b2ca91
Reuse artifacts; apply Git patch; change C Tag* types to __Gdext* (pr…
Bromeon Mar 27, 2023
091b9a7
Rename godot-input -> godot-bindings
Bromeon Mar 27, 2023
0a2085b
Use target/godot-gen for generated files; streamline godot-bindings API
Bromeon Mar 27, 2023
fa58910
Patch gdextension_interface.h with Rust regex instead of `git patch`
Bromeon Mar 29, 2023
c639f9a
Add godot-nightly (bindgen) jobs to CI
Bromeon Mar 30, 2023
120a0dd
Move /target/godot-gen -> /$crate/src/gen (the former breaks IDE stat…
Bromeon Mar 31, 2023
c20197f
Always write both .h/.rs headers; check header diff on single `linux`…
Bromeon Apr 1, 2023
0493907
Remove Godot from CI where possible (clippy, test)
Bromeon Apr 1, 2023
22e0288
No longer build dependencies in release mode
Bromeon Apr 1, 2023
e0d45a3
Merge #211
bors[bot] Apr 2, 2023
e81d5d1
Add return values when generating virtual methods
jbarnoud Mar 27, 2023
04c2323
Merge #207
bors[bot] Apr 5, 2023
39d54b5
Add `macos.release.arm64` config in all .gdextension files
Bromeon Apr 5, 2023
a8a1084
check.sh: find Godot 4 executable when available as `godot`
yannick-was-taken Apr 6, 2023
77ca78d
Merge #217
bors[bot] Apr 6, 2023
11f070b
Contribution guidelines
Bromeon Apr 5, 2023
e3b9ad1
Merge #215
bors[bot] Apr 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 37 additions & 28 deletions .github/composite/godot-itest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ inputs:
default: ''
description: "Command-line arguments passed to Godot"

godot-check-header:
required: false
default: 'false'
description: "Should the job check against latest gdextension_interface.h, and warn on difference"

rust-toolchain:
required: false
default: 'stable'
Expand Down Expand Up @@ -60,42 +65,45 @@ runs:
echo "GODOT_BUILT_FROM=_Built from [\`$godotVer\`](https://github.com/godotengine/godot/commit/$gitSha)._" >> $GITHUB_ENV
shell: bash

# Note: if this fails, run `git diff -R > tweaks.patch` after updating the file manually
- name: "Copy and compare GDExtension header"
if: inputs.artifact-name == 'godot-linux'
run: |
mkdir -p godot-codegen/input
cp $RUNNER_DIR/godot_bin/gdextension_interface.h godot-codegen/input/gdextension_interface.h
git apply godot-codegen/input/tweak.patch -v
git diff --exit-code --quiet || {
echo "OUTCOME=header-diff" >> $GITHUB_ENV
echo "gdextension_interface.h is not up-to-date; abort."
echo ""

echo "### :x: Outdated GDExtension API header" >> $GITHUB_STEP_SUMMARY
echo "gdextension_interface.h contains the following differences:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
git diff >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "After manually updating file, run: \`git diff -R > tweak.patch\`." >> $GITHUB_STEP_SUMMARY

exit 1
}
shell: bash

- name: "Install Rust"
uses: ./.github/composite/rust
with:
rust: ${{ inputs.rust-toolchain }}
with-llvm: ${{ inputs.with-llvm }}

- name: "Build godot-rust"
- name: "Build gdext (itest)"
run: |
cargo build -p itest ${{ inputs.rust-extra-args }}
shell: bash
env:
RUSTFLAGS: ${{ inputs.rust-env-rustflags }}

# Note: no longer fails, as we expect header to be forward-compatible; instead issues a warning
- name: "Copy and compare GDExtension header"
if: inputs.godot-check-header == 'true'
run: |
mv godot-ffi/src/gen/gdextension_interface.h godot-ffi/src/gen/gdextension_interface_prebuilt.h
mv $RUNNER_DIR/godot_bin/gdextension_interface.h godot-ffi/src/gen/gdextension_interface.h
git apply godot-bindings/res/tweak.patch
cd godot-ffi/src/gen
git diff --no-index --exit-code --quiet gdextension_interface_prebuilt.h gdextension_interface.h || {
echo "OUTCOME=header-diff" >> $GITHUB_ENV
echo "::warning::gdextension_interface.h is not up-to-date."
echo ""

echo "### :warning: Outdated GDExtension API header" >> $GITHUB_STEP_SUMMARY
echo "gdextension_interface.h contains the following differences:" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
git diff --no-index gdextension_interface_prebuilt.h gdextension_interface.h >> $GITHUB_STEP_SUMMARY || true
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "After manually updating file, run: \`git diff -R > tweak.patch\`." >> $GITHUB_STEP_SUMMARY

# Undo modifications
mv gdextension_interface_prebuilt.h gdextension_interface.h
#exit 1
}
shell: bash

- name: "Run Godot integration tests"
# Aborts immediately if Godot outputs certain keywords (would otherwise stall until CI runner times out).
# Explanation:
Expand All @@ -120,19 +128,20 @@ runs:
run: |
if grep -q "ObjectDB instances leaked at exit" "${{ runner.temp }}/log.txt"; then
echo "OUTCOME=godot-leak" >> $GITHUB_ENV
exit 2
exit 3
fi
shell: bash

- name: "Conclusion"
if: always()
run: |
echo "Evaluate conclusion ($OUTCOME)"
echo "Evaluate conclusion: $OUTCOME"

case $OUTCOME in
"success")
echo "### :heavy_check_mark: Godot integration tests passed" > $GITHUB_STEP_SUMMARY
echo "$GODOT_BUILT_FROM" >> $GITHUB_STEP_SUMMARY
# Do not output success for now, to keep summary focused on warnings/errors
#echo "### :heavy_check_mark: Godot integration tests passed" > $GITHUB_STEP_SUMMARY
#echo "$GODOT_BUILT_FROM" >> $GITHUB_STEP_SUMMARY
;;

"godot-runtime")
Expand Down
4 changes: 2 additions & 2 deletions .github/composite/llvm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:
- name: "Cache LLVM and clang"
id: cache-llvm
# Note: conditionals not yet supported; see https://github.com/actions/runner/issues/834
# if: ${{ inputs.llvm == 'true' }}
# if: inputs.llvm == 'true'
uses: actions/cache@v3
with:
# path: |
Expand All @@ -34,7 +34,7 @@ runs:
key: llvm-10.0

- uses: KyleMayes/install-llvm-action@v1
# if: ${{ inputs.llvm == 'true' }}
# if: inputs.llvm == 'true'
with:
version: "10.0"
directory: ${{ env.LLVM_INSTALL_DIR }}
Expand Down
2 changes: 1 addition & 1 deletion .github/composite/rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ runs:
cache-on-failure: true

- name: "Install LLVM"
if: inputs.with-llvm == 'true'
uses: ./.github/composite/llvm
if: ${{ inputs.with-llvm == 'true' }}

- name: "Set environment variables used by toolchain"
run: |
Expand Down
81 changes: 27 additions & 54 deletions .github/workflows/full-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

# Full CI workflow
# Run before merging. Rebases on master to make sure CI passes for latest integration, not only for the PR at the time of creation.
# Runs before merging. Rebases on master to make sure CI passes for latest integration, not only for the PR at the time of creation.

name: Full CI

Expand Down Expand Up @@ -42,49 +42,28 @@ jobs:
- name: "Install Rust"
uses: ./.github/composite/rust
with:
rust: stable
components: rustfmt

- name: "Check rustfmt"
run: cargo fmt --all -- --check


clippy:
name: clippy (${{ matrix.name }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- name: linux
rust-toolchain: stable
godot-binary: godot.linuxbsd.editor.dev.x86_64

- name: linux-double
rust-toolchain: stable
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
rust-extra-args: --features double-precision
steps:
- uses: actions/checkout@v3

- name: "Install Rust"
uses: ./.github/composite/rust

# TODO get rid of Godot binary, once the JSON is either versioned or fetched from somewhere
# Replaces also backspaces on Windows, since they cause problems in Bash
- name: "Install Godot"
uses: ./.github/composite/godot-install
with:
artifact-name: godot-${{ matrix.name }}
godot-binary: ${{ matrix.godot-binary }}
components: clippy

- name: "Check clippy"
run: |
cargo clippy --all-targets $GDEXT_FEATURES ${{ matrix.rust-extra-args }} -- \
-D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
-D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented -D warnings


unit-test:
name: unit-test (${{ matrix.name }}${{ matrix.rust-special }})
runs-on: ${{ matrix.os }}
Expand All @@ -98,28 +77,19 @@ jobs:
include:
- name: macos
os: macos-11
rust-toolchain: stable
godot-binary: godot.macos.editor.dev.x86_64
with-llvm: true

- name: windows
os: windows-latest
rust-toolchain: stable-x86_64-pc-windows-msvc
godot-binary: godot.windows.editor.dev.x86_64.exe

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

- name: linux
os: ubuntu-20.04
rust-toolchain: stable
rust-special: -minimal-deps
godot-binary: godot.linuxbsd.editor.dev.x86_64


steps:
- uses: actions/checkout@v3

Expand All @@ -128,26 +98,17 @@ jobs:
with:
rust: stable
cache-key: ${{ matrix.rust-special }} # '-minimal-deps' or empty/not defined
with-llvm: ${{ matrix.with-llvm }}

- name: "Install Rust nightly (minimal deps)"
if: matrix.rust-special == '-minimal-deps'
uses: ./.github/composite/rust
with:
rust: nightly
cache-key: minimal-deps-nightly
if: ${{ matrix.rust-special == '-minimal-deps' }}

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

# TODO get rid of Godot binary, once the JSON is either versioned or fetched from somewhere
# Replaces also backspaces on Windows, since they cause problems in Bash
- name: "Install Godot"
uses: ./.github/composite/godot-install
with:
artifact-name: godot-${{ matrix.name }}
godot-binary: ${{ matrix.godot-binary }}

- name: "Compile tests"
run: cargo test $GDEXT_FEATURES --no-run ${{ matrix.rust-extra-args }}
Expand All @@ -170,41 +131,52 @@ jobs:
include:
- name: macos
os: macos-12
rust-toolchain: stable
godot-binary: godot.macos.editor.dev.x86_64
with-llvm: true


- name: macos-double
os: macos-12
rust-toolchain: stable
godot-binary: godot.macos.editor.dev.double.x86_64
rust-extra-args: --features double-precision

- name: macos-nightly
os: macos-12
artifact-name: macos
godot-binary: godot.macos.editor.dev.x86_64
rust-extra-args: --features godot/custom-godot
with-llvm: true

- name: windows
os: windows-latest
rust-toolchain: stable-x86_64-pc-windows-msvc
godot-binary: godot.windows.editor.dev.x86_64.exe

- name: windows-double
os: windows-latest
rust-toolchain: stable-x86_64-pc-windows-msvc
godot-binary: godot.windows.editor.dev.double.x86_64.exe
rust-extra-args: --features double-precision

- name: windows-nightly
os: windows-latest
artifact-name: windows
godot-binary: godot.windows.editor.dev.x86_64.exe
rust-extra-args: --features godot/custom-godot

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

- name: linux-double
os: ubuntu-20.04
rust-toolchain: stable
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
rust-extra-args: --features double-precision

- name: linux-nightly
os: ubuntu-20.04
artifact-name: linux
godot-binary: godot.linuxbsd.editor.dev.x86_64
rust-extra-args: --features godot/custom-godot

# Special Godot binaries compiled with AddressSanitizer/LeakSanitizer to detect UB/leaks.
# Additionally, the Godot source is patched to make dlclose() a no-op, as unloading dynamic libraries loses stacktrace and
# cause false positives like println!. See https://github.com/google/sanitizers/issues/89.
Expand All @@ -231,13 +203,14 @@ jobs:
- name: "Run Godot integration test"
uses: ./.github/composite/godot-itest
with:
artifact-name: godot-${{ matrix.name }}
artifact-name: godot-${{ matrix.artifact-name || matrix.name }}
godot-binary: ${{ matrix.godot-binary }}
godot-args: ${{ matrix.godot-args }}
rust-extra-args: ${{ matrix.rust-extra-args }}
rust-toolchain: ${{ matrix.rust-toolchain }}
rust-toolchain: ${{ matrix.rust-toolchain || 'stable' }}
rust-env-rustflags: ${{ matrix.rust-env-rustflags }}
with-llvm: ${{ matrix.with-llvm }}
godot-check-header: ${{ matrix.name == 'linux' }}


license-guard:
Expand Down
30 changes: 2 additions & 28 deletions .github/workflows/minimal-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,40 +44,21 @@ jobs:


clippy:
name: clippy (${{ matrix.name }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- name: linux
rust-toolchain: stable
godot-binary: godot.linuxbsd.editor.dev.x86_64

- name: linux-double
rust-toolchain: stable
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
rust-extra-args: --features double-precision
steps:
- uses: actions/checkout@v3

- name: "Install Rust"
uses: ./.github/composite/rust

# TODO get rid of Godot binary, once the JSON is either versioned or fetched from somewhere
# Replaces also backspaces on Windows, since they cause problems in Bash
- name: "Install Godot"
uses: ./.github/composite/godot-install
with:
artifact-name: godot-${{ matrix.name }}
godot-binary: ${{ matrix.godot-binary }}
components: clippy

- name: "Check clippy"
run: |
cargo clippy --all-targets $GDEXT_FEATURES ${{ matrix.rust-extra-args }} -- \
-D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
-D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented -D warnings


unit-test:
name: unit-test
Expand All @@ -88,12 +69,6 @@ jobs:
- name: "Install Rust"
uses: ./.github/composite/rust

- name: "Install Godot"
uses: ./.github/composite/godot-install
with:
artifact-name: godot-linux
godot-binary: godot.linuxbsd.editor.dev.x86_64

- name: "Compile tests"
run: cargo test $GDEXT_FEATURES --no-run

Expand All @@ -113,7 +88,6 @@ jobs:
with:
artifact-name: godot-linux
godot-binary: godot.linuxbsd.editor.dev.x86_64
#godot_ver: ${{ matrix.godot }}


license-guard:
Expand Down
Loading