Rust-side Variant marshalling
#5241
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) godot-rust; Bromeon and contributors. | |
| # This Source Code Form is subject to the terms of the Mozilla Public | |
| # License, v. 2.0. If a copy of the MPL was not distributed with this | |
| # file, You can obtain one at https://mozilla.org/MPL/2.0/. | |
| name: Minimal CI | |
| # | |
| # Runs when someone opens a PR and pushes commits to the PR. | |
| # Includes basic checks to catch most common errors, but is followed by merge queue (full-ci). | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| #- ready_for_review # could be enabled if we don't run certain checks in draft mode | |
| env: | |
| # Applies to all 'register-docs' features across crates. | |
| CLIPPY_FEATURES: '--features register-docs,godot/experimental-godot-api,godot/serde' | |
| TEST_FEATURES: '' | |
| # GDEXT_CRATE_ARGS: '-p godot-codegen -p godot-ffi -p godot-core -p godot-macros -p godot' | |
| RETRY: ${{ github.workspace }}/.github/other/retry.sh | |
| defaults: | |
| run: | |
| shell: bash | |
| # If a new commit is pushed before the old one's CI has completed (on the same branch), abort previous run | |
| concurrency: | |
| group: ${{ github.head_ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| rustfmt: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Install Rust" | |
| uses: ./.github/composite/rust | |
| with: | |
| rust: nightly | |
| components: rustfmt | |
| - name: "Check rustfmt" | |
| run: cargo fmt --all -- --check | |
| - name: "Run custom repo checks" | |
| run: | | |
| cargo run -p repo-tweak | |
| git diff --quiet --exit-code || { | |
| echo "::error::Godot versions out of sync; update with `cargo run -p repo-tweak`." | |
| echo "Differences:" | |
| echo "----------------------------------------------------" | |
| git diff | |
| echo "----------------------------------------------------" | |
| exit 1 | |
| } | |
| # Needs to be its own job (apart from sync-doc), because lints don't work with --no-deps, and because it contributes to ci-status. | |
| doc-lints: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # rustdoc is included as component. | |
| - name: "Install Rust" | |
| uses: ./.github/composite/rust | |
| - name: "Check rustdoc" | |
| env: | |
| RUSTDOCFLAGS: > | |
| -D rustdoc::broken-intra-doc-links -D rustdoc::private-intra-doc-links -D rustdoc::invalid-codeblock-attributes | |
| -D rustdoc::invalid-rust-codeblocks -D rustdoc::invalid-html-tags -D rustdoc::bare-urls -D rustdoc::unescaped-backticks | |
| run: cargo doc -p godot --ignore-rust-version | |
| clippy: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Patch Cargo.toml to use nightly extension API" | |
| run: .github/other/patch-prebuilt.sh nightly | |
| - name: "Install Rust" | |
| uses: ./.github/composite/rust | |
| with: | |
| components: clippy | |
| - name: "Check clippy" | |
| run: | | |
| cargo clippy --all-targets $CLIPPY_FEATURES -- \ | |
| -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 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Patch Cargo.toml to use nightly extension API" | |
| run: .github/other/patch-prebuilt.sh nightly | |
| - name: "Install Rust" | |
| uses: ./.github/composite/rust | |
| - name: "Compile tests" | |
| run: cargo test $TEST_FEATURES --no-run | |
| - name: "Test" | |
| run: cargo test $TEST_FEATURES | |
| - name: "Run doctest in minimal feature set" | |
| run: cargo test --doc --no-default-features | |
| unit-test-web: | |
| name: unit-test-web (${{ matrix.name }}) | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Threads | |
| command: test-web-t | |
| - name: No threads | |
| command: test-web-nt | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Patch Cargo.toml to use nightly extension API" | |
| run: .github/other/patch-prebuilt.sh nightly | |
| - name: "Install Rust" | |
| uses: ./.github/composite/rust | |
| with: | |
| rust: nightly | |
| components: rust-src | |
| - name: "Install emscripten" | |
| env: | |
| EMSCRIPTEN_SRC_REF: 4.0.13 | |
| EMSCRIPTEN_VERSION: 3.1.74 | |
| run: | | |
| git clone https://github.com/emscripten-core/emsdk.git --depth 1 --branch "$EMSCRIPTEN_SRC_REF" --single-branch | |
| ./emsdk/emsdk install "$EMSCRIPTEN_VERSION" | |
| ./emsdk/emsdk activate "$EMSCRIPTEN_VERSION" | |
| source ./emsdk/emsdk_env.sh | |
| echo "$PATH" >> "$GITHUB_PATH" | |
| - name: "Test (Wasm)" | |
| run: ./check.sh ${{ matrix.command }} | |
| # For complex matrix workflow, see https://stackoverflow.com/a/65434401 | |
| godot-itest: | |
| name: godot-itest (${{ matrix.name }}) | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: false | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false # cancel all jobs as soon as one fails? | |
| matrix: | |
| include: | |
| # macOS (use arm64 for minimal CI) | |
| - name: macos | |
| os: macos-15 | |
| artifact-name: macos-arm-nightly | |
| godot-binary: godot.macos.editor.dev.arm64 | |
| rust-extra-args: --features itest/upcoming-editor-placeholders | |
| # Windows | |
| - name: windows | |
| os: windows-2025 | |
| artifact-name: windows-nightly | |
| godot-binary: godot.windows.editor.dev.x86_64.exe | |
| rust-extra-args: --features itest/upcoming-editor-placeholders | |
| # Linux | |
| - name: linux-full | |
| os: ubuntu-24.04 | |
| artifact-name: linux-nightly | |
| godot-binary: godot.linuxbsd.editor.dev.x86_64 | |
| rust-extra-args: --features itest/codegen-full,itest/test-gdextension-dependency | |
| rust-extra-env: GDRUST_MAIN_EXTENSION=IntegrationTests | |
| hot-reload: stable signal-test | |
| # JSON-based codegen path is kept in minimal CI, as it has surfaced config errors several times in the past. | |
| - name: linux-custom-api-json | |
| os: ubuntu-24.04 | |
| artifact-name: linux-nightly | |
| godot-binary: godot.linuxbsd.editor.dev.x86_64 | |
| rust-extra-args: --features godot/api-custom-json | |
| godot-indirect-json: true | |
| # Linux compat. Minimal CI only checks the ends (min supported, max supported - 1, max supported). Full CI tests all. | |
| # Latest stable release (above default API level), thus needs explicit api-4-7. | |
| - name: linux-4.7 | |
| os: ubuntu-24.04 | |
| artifact-name: linux-4.7 | |
| godot-binary: godot.linuxbsd.editor.dev.x86_64 | |
| godot-prebuilt-patch: '4.7' | |
| # Default API level (no api-* feature); runs against its matching stable binary. | |
| - name: linux-4.6 | |
| os: ubuntu-24.04 | |
| artifact-name: linux-4.6 | |
| godot-binary: godot.linuxbsd.editor.dev.x86_64 | |
| #godot-prebuilt-patch: '4.6' | |
| # Minimum supported version. | |
| - name: linux-4.2 | |
| os: ubuntu-24.04 | |
| artifact-name: linux-4.2 | |
| godot-binary: godot.linuxbsd.editor.dev.x86_64 | |
| godot-prebuilt-patch: '4.2' | |
| rust-extra-args: --features itest/upcoming-editor-placeholders # enabled before 4.3 boundary | |
| # Memory checker (always Linux). One representative sanitizer run; the safeguard-level variants run in full-ci. | |
| - name: memcheck | |
| os: ubuntu-24.04 | |
| artifact-name: linux-memcheck-nightly | |
| godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san | |
| rust-toolchain: nightly | |
| rust-env-rustflags: -Zrandomize-layout -Zsanitizer=address | |
| rust-extra-args: --features godot/api-custom | |
| # Sanitizers can't build proc-macros and build scripts; with --target, cargo ignores RUSTFLAGS for those two. | |
| rust-target: x86_64-unknown-linux-gnu | |
| run-editor-itest: 'false' # editor has memory leaks; https://github.com/godot-rust/gdext/pull/1591. | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Run Godot integration test" | |
| uses: ./.github/composite/godot-itest | |
| with: | |
| artifact-name: godot-${{ matrix.artifact-name }} | |
| godot-binary: ${{ matrix.godot-binary }} | |
| godot-args: ${{ matrix.godot-args }} # currently unused | |
| godot-prebuilt-patch: ${{ matrix.godot-prebuilt-patch }} | |
| rust-extra-args: ${{ matrix.rust-extra-args }} | |
| rust-toolchain: ${{ matrix.rust-toolchain || 'stable' }} | |
| rust-env-rustflags: ${{ matrix.rust-env-rustflags }} | |
| rust-extra-env: ${{ matrix.rust-extra-env }} | |
| rust-target: ${{ matrix.rust-target }} | |
| rust-target-dir: ${{ matrix.rust-target-dir }} | |
| godot-check-header: ${{ matrix.godot-check-header }} | |
| godot-indirect-json: ${{ matrix.godot-indirect-json }} | |
| run-editor-itest: ${{ matrix.run-editor-itest || 'true' }} # opt-out. | |
| - name: "Build and test hot-reload" | |
| if: ${{ matrix.hot-reload }} | |
| working-directory: itest/hot-reload/godot | |
| run: ./run-test.sh ${{ matrix.hot-reload }} | |
| shell: bash | |
| license-guard: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Check and fix license headers" | |
| uses: 'apache/skywalking-eyes/header@v0.8.0' | |
| with: | |
| # log: debug # optional: set the log level. The default value is `info`. | |
| config: .github/other/licenserc.yml | |
| # token: # optional: the token that license eye uses when it needs to comment on the pull request. | |
| # Set to empty ("") to disable commenting on pull request. The default value is ${{ github.token }} | |
| # mode: # optional: Which mode License-Eye should be run in. Choices are `check` or `fix`. The default value is `check`. | |
| mode: check | |
| # --------------------------------------------------------------------------------------------------------------------------------------------- | |
| # CI status report | |
| # Job to notify merge queue about success/failure | |
| ci-status: | |
| if: always() | |
| needs: | |
| - rustfmt | |
| - doc-lints | |
| - clippy | |
| - unit-test | |
| - godot-itest | |
| - license-guard | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: "Determine success or failure" | |
| run: | | |
| DEPENDENCIES='${{ toJson(needs) }}' | |
| echo "Dependency jobs:" | |
| all_success=true | |
| for job in $(echo "$DEPENDENCIES" | jq -r 'keys[]'); do | |
| status=$(echo "$DEPENDENCIES" | jq -r ".[\"$job\"].result") | |
| echo "* $job -> $status" | |
| if [[ "$status" != "success" ]]; then | |
| all_success=false | |
| fi | |
| done | |
| if [[ "$all_success" == "false" ]]; then | |
| echo "One or more dependency jobs failed or were cancelled." | |
| exit 1 | |
| fi |