Repository navigation
add SpringJoint::rest_length and set_rest_length #1664
Workflow file for this run
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
| name: Rapier CI build | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| # A new push to a PR cancels the still-running build of the previous push. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # Incremental compilation only pays off for local rebuild loops; in CI it just | |
| # slows the build down and bloats the caches. | |
| CARGO_INCREMENTAL: 0 | |
| jobs: | |
| check-fmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check formatting | |
| run: cargo fmt -- --check | |
| doc: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTDOCFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Cargo doc | |
| run: cargo doc --features parallel,serde-serialize,debug-render -p rapier3d -p rapier2d -p rapier3d-meshloader -p rapier3d-urdf && cargo doc -p mjcf-rs --features msh && cargo doc -p rapier3d-mjcf --features stl,wavefront,msh | |
| # All the lints, plus the testbed/example feature-combination checks. This is the only | |
| # job (besides publish-dry-run) that compiles the graphical stack (kiss3d), so it owns | |
| # the cmake/xcb setup and the zune-core pin. | |
| clippy: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: sudo apt-get install -y cmake libxcb-composite0-dev | |
| # WORKAROUND: zune-core 0.5.2 made its `warn!` macro expand to nothing, which breaks | |
| # zune-jpeg (all 0.5.x), where it is called in expression position. Reached through the | |
| # testbeds' kiss3d -> gltf/image dependency. Remove once upstream is fixed. | |
| - name: Pin zune-core (0.5.2 breaks zune-jpeg) | |
| run: cargo update -p zune-core@0.5 --precise 0.5.1 | |
| # Bare clippy covers every default-member with default features: the rapier crates, | |
| # the testbeds, and the example crates (so no separate `cargo check` for those). | |
| - name: Clippy | |
| run: cargo clippy | |
| - name: Clippy rapier2d examples (parallel) | |
| run: cargo clippy -p rapier-examples-2d --features parallel | |
| - name: Clippy rapier3d examples (parallel) | |
| run: cargo clippy -p rapier-examples-3d --features parallel | |
| - name: Clippy mjcf-rs | |
| run: cargo clippy -p mjcf-rs --all-targets --features msh | |
| - name: Clippy rapier3d-mjcf | |
| run: cargo clippy -p rapier3d-mjcf --all-targets --features stl,wavefront,msh | |
| - name: Check rapier_testbed2d --features parallel | |
| run: cd crates/rapier_testbed2d; cargo check --features parallel; | |
| - name: Check rapier_testbed3d --features parallel | |
| run: cd crates/rapier_testbed3d; cargo check --features parallel; | |
| - name: Check rapier2d --features enhanced-determinism | |
| run: cd crates/rapier2d; cargo check --features enhanced-determinism; | |
| - name: Check rapier3d --features enhanced-determinism | |
| run: cd crates/rapier3d; cargo check --features enhanced-determinism; | |
| # Builds the core crates in their feature variants, and runs the debug test suites. | |
| # Scoped to the non-graphical crates: the testbeds/examples are compiled by `clippy`. | |
| build-native: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Build rapier2d | |
| run: cargo build -p rapier2d; | |
| - name: Build rapier3d | |
| run: cargo build -p rapier3d; | |
| - name: Build rapier2d Parallel | |
| run: cd crates/rapier2d; cargo build --features parallel; | |
| - name: Build rapier3d Parallel | |
| run: cd crates/rapier3d; cargo build --features parallel; | |
| - name: Build rapier3d 8-lanes SIMD | |
| run: cd crates/rapier3d; cargo build --features simd8; | |
| - name: Run tests | |
| run: cargo test -p rapier2d -p rapier2d-f64 -p rapier3d -p rapier3d-f64 -p rapier3d-urdf -p rapier3d-meshloader | |
| - name: Test mjcf-rs | |
| run: cargo test -p mjcf-rs --features msh | |
| - name: Test rapier3d-mjcf | |
| run: cargo test -p rapier3d-mjcf --features stl,wavefront,msh | |
| # The release-mode determinism suites. Grouped so that invocations sharing a feature | |
| # set reuse each other's build artifacts; kept apart from the other release tests so | |
| # both halves run in parallel. | |
| tests-determinism: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Test determinism (SIMD backend) | |
| run: cargo test -p rapier3d --release --features enhanced-determinism --test simd_backend_determinism | |
| - name: Test SIMD backend op-level parity | |
| run: cargo test -p rapier3d --release --features enhanced-determinism --test simd_backend_parity | |
| - name: Test parallel-path parity (feature off) | |
| run: cargo test -p rapier3d --release --features enhanced-determinism,serde-serialize --test parallel_path_parity | |
| - name: Test parallel-path parity (feature on) | |
| run: cargo test -p rapier3d --release --features enhanced-determinism,serde-serialize,parallel --test parallel_path_parity | |
| - name: Test parallel-path parity (unsync-callbacks) | |
| run: cargo test -p rapier3d --release --features enhanced-determinism,serde-serialize,parallel,unsync-callbacks --test parallel_path_parity | |
| # The native half of the cross-target check: the `wasm-determinism` job runs | |
| # these same two tests, against the same goldens, on 32-bit pointers. | |
| - name: Test snapshot portability (3D, native) | |
| run: cargo test -p rapier3d --release --features enhanced-determinism,serde-serialize --test snapshot_portability | |
| - name: Test snapshot portability (2D, native) | |
| run: cargo test -p rapier2d --release --features enhanced-determinism,serde-serialize --test snapshot_portability | |
| # The aarch64 leg of the cross-architecture determinism check: the same goldens the | |
| # x86_64 job (above) and the wasm32 job (below) verify must also hold on arm NEON. | |
| # This is what catches platform-split float semantics that are dynamically invisible — | |
| # e.g. the signed zero a min/max tie stores differs between SSE/wasm and NEON, which | |
| # diverged serialized snapshots on aarch64 for months without any x86-only job noticing. | |
| tests-determinism-arm64: | |
| runs-on: ubuntu-24.04-arm | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Test snapshot portability (3D, aarch64) | |
| run: cargo test -p rapier3d --release --features enhanced-determinism,serde-serialize --test snapshot_portability | |
| - name: Test snapshot portability (2D, aarch64) | |
| run: cargo test -p rapier2d --release --features enhanced-determinism,serde-serialize --test snapshot_portability | |
| - name: Test parallel-path parity (aarch64) | |
| run: cargo test -p rapier3d --release --features enhanced-determinism,serde-serialize --test parallel_path_parity | |
| - name: Test determinism (SIMD backend, aarch64) | |
| run: cargo test -p rapier3d --release --features enhanced-determinism --test simd_backend_determinism | |
| # The remaining release-mode suites (non-enhanced-determinism feature sets). | |
| tests-release: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Test thread-count determinism | |
| run: cargo test -p rapier3d --release --features parallel,serde-serialize --test thread_count_determinism | |
| - name: Test snapshot round-trip (3D) | |
| run: cargo test -p rapier3d --release --features serde-serialize --test snapshot_roundtrip | |
| - name: Test snapshot round-trip (2D) | |
| run: cargo test -p rapier2d --release --features serde-serialize --test snapshot_roundtrip | |
| - name: Test single-worker deferred BVH | |
| run: cargo test -p rapier3d --release --features parallel --test single_worker_deferred_bvh | |
| # `unsync-callbacks` drops the `Sync` bound off the hooks/event traits; the test's | |
| # callbacks hold a `Cell`, so it only compiles while that holds. | |
| - name: Test unsync callbacks | |
| run: cargo test -p rapier3d --release --features parallel,unsync-callbacks --test unsync_callbacks | |
| # The bound is keyed on `unsync-callbacks` alone, so the no-`parallel` build is its own | |
| # configuration rather than one that trivially has no bound. | |
| - name: Test unsync callbacks (no parallel) | |
| run: cargo test -p rapier3d --release --features unsync-callbacks --test unsync_callbacks | |
| build-no-std: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install stable Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: "x86_64-unknown-linux-gnu,thumbv7em-none-eabihf" | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Check rapier2d thumbv7em-none-eabihf (no alloc) | |
| run: cargo check --verbose -p rapier2d --no-default-features --features dim2,f32 --target=thumbv7em-none-eabihf | |
| - name: Check rapier3d thumbv7em-none-eabihf (no alloc) | |
| run: cargo check --verbose -p rapier3d --no-default-features --features dim3,f32 --target=thumbv7em-none-eabihf | |
| - name: Check rapier2d-f64 thumbv7em-none-eabihf (no alloc) | |
| run: cargo check --verbose -p rapier2d-f64 --no-default-features --features dim2,f64 --target=thumbv7em-none-eabihf | |
| - name: Check rapier3d-f64 thumbv7em-none-eabihf (no alloc) | |
| run: cargo check --verbose -p rapier3d-f64 --no-default-features --features dim3,f64 --target=thumbv7em-none-eabihf | |
| - name: Check rapier2d thumbv7em-none-eabihf + alloc | |
| run: cargo check --verbose -p rapier2d --no-default-features --features dim2,f32,alloc --target=thumbv7em-none-eabihf | |
| - name: Check rapier3d thumbv7em-none-eabihf + alloc | |
| run: cargo check --verbose -p rapier3d --no-default-features --features dim3,f32,alloc --target=thumbv7em-none-eabihf | |
| - name: Check rapier2d-f64 thumbv7em-none-eabihf + alloc | |
| run: cargo check --verbose -p rapier2d-f64 --no-default-features --features dim2,f64,alloc --target=thumbv7em-none-eabihf | |
| - name: Check rapier3d-f64 thumbv7em-none-eabihf + alloc | |
| run: cargo check --verbose -p rapier3d-f64 --no-default-features --features dim3,f64,alloc --target=thumbv7em-none-eabihf | |
| - name: Check rapier2d thumbv7em-none-eabihf + alloc + debug-render | |
| run: cargo check --verbose -p rapier2d --no-default-features --features dim2,f32,alloc,debug-render --target=thumbv7em-none-eabihf | |
| - name: Check rapier3d thumbv7em-none-eabihf + alloc + debug-render | |
| run: cargo check --verbose -p rapier3d --no-default-features --features dim3,f32,alloc,debug-render --target=thumbv7em-none-eabihf | |
| # Runs the tiny-scene tests under Miri to check the solver's unsafe hot paths | |
| # (manifold store, solver-graph buckets, raw color-mask slices) for UB. | |
| # x86_64 only: glam's aarch64 NEON backend hits foreign intrinsics Miri does | |
| # not implement (on Apple Silicon, use --target x86_64-unknown-linux-gnu). | |
| # | |
| # The SIMD solver paths lean harder on transmutes and raw slices; worth the | |
| # extra interpretation time (~3.5x the scalar run). `parallel` also passes, | |
| # but only manually (not in CI): crossbeam-epoch's container_of pattern | |
| # violates Stacked Borrows in rayon's steal path, so it needs | |
| # MIRIFLAGS="-Zmiri-tree-borrows -Zmiri-ignore-leaks" (ignore-leaks for | |
| # rayon's never-joined global pool) and RAYON_NUM_THREADS=2. | |
| miri: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install nightly Rust with Miri | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: nightly | |
| components: miri | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Miri test rapier3d (tiny scenes) | |
| run: cargo miri test -p rapier3d --test miri_scenes | |
| - name: Miri test rapier2d (tiny scenes) | |
| run: cargo miri test -p rapier2d --test miri_scenes | |
| build-wasm: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: rustup target add wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: build rapier2d | |
| run: cd crates/rapier2d && cargo build --verbose --target wasm32-unknown-unknown; | |
| - name: build rapier3d | |
| run: cd crates/rapier3d && cargo build --verbose --target wasm32-unknown-unknown; | |
| # A snapshot taken in a browser must be byte-identical to one taken on the server, so the | |
| # same golden the native jobs check is checked again on a 32-bit-pointer target with its | |
| # own libm and codegen backend. `wasm32-wasip1` rather than `wasm32-unknown-unknown` | |
| # because it can run a test binary; the arithmetic and the serialized layout are the same | |
| # for both wasm targets. | |
| wasm-determinism: | |
| runs-on: ubuntu-latest | |
| env: | |
| # Absolute: cargo runs a test binary from its own package directory, not the | |
| # workspace root. | |
| CARGO_TARGET_WASM32_WASIP1_RUNNER: node ${{ github.workspace }}/.github/scripts/run-wasi.mjs | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install stable Rust with wasm32-wasip1 | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: wasm32-wasip1 | |
| - uses: Swatinem/rust-cache@v2 | |
| # `node:wasi` needs no command-line flag from 22 on. | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Test snapshot portability (3D, wasm32) | |
| run: cargo test -p rapier3d --release --features enhanced-determinism,serde-serialize --target wasm32-wasip1 --test snapshot_portability | |
| - name: Test snapshot portability (2D, wasm32) | |
| run: cargo test -p rapier2d --release --features enhanced-determinism,serde-serialize --target wasm32-wasip1 --test snapshot_portability | |
| # If this fails, consider changing your text or adding something to .typos.toml | |
| # You can find typos here: https://crates.io/crates/typos' | |
| typos: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: check typos | |
| uses: crate-ci/typos@v1.23.2 | |
| publish-dry-run: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| - run: sudo apt-get install -y cmake libxcb-composite0-dev | |
| # See `clippy`: zune-core 0.5.2 breaks zune-jpeg, reached here through the | |
| # testbed crates' kiss3d dependency. Remove once upstream is fixed. | |
| - name: Pin zune-core (0.5.2 breaks zune-jpeg) | |
| run: cargo update -p zune-core@0.5 --precise 0.5.1 | |
| # Builds and verifies each crate the same way `cargo publish` does, | |
| # catching bugs hidden by workspace feature unification. | |
| - name: publish dry-run | |
| run: ./publish.sh --dry-run | |
| # Builds the docusaurus website (user guides + docs site). | |
| website-build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./website | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: User guides generation | |
| run: ./generate_user_guides.sh | |
| - name: yarn install | |
| run: corepack enable && yarn | |
| - name: yarn build | |
| run: PUBLISH_MODE=1 yarn build | |
| # Checks the Rust documentation snippets compile against the in-tree rapier. | |
| website-rust-snippets: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Linux dependencies | |
| uses: ./.github/actions/install-linux-deps | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: website/docs-examples | |
| - name: Tests injection + code snippets | |
| run: cd website/docs-examples && cargo test | |
| # Checks the JavaScript documentation snippets build against the in-tree bindings, so a | |
| # snippet may use an API before it is released on npm. The snippet package depends on | |
| # `bindings/typescript/builds/rapier{2,3}d/pkg` through a `file:` path, which this job builds first | |
| # (the same two steps a local checkout runs). | |
| website-javascript-snippets: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| dimension: [2d, 3d] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: bindings/typescript | |
| - name: Generate the binding crates | |
| working-directory: ./bindings/typescript | |
| run: | | |
| npm ci | |
| cargo run -p prepare_builds -- -d dim${{ matrix.dimension == '2d' && '2' || '3' }} -f non-deterministic | |
| - name: Build the in-tree bindings | |
| working-directory: ./bindings/typescript/builds/rapier${{ matrix.dimension }} | |
| run: | | |
| npm i | |
| npm run build:wasm | |
| npm run build:ts | |
| - name: Install dependencies | |
| working-directory: ./website/docs-examples/${{ matrix.dimension }}/javascript | |
| run: npm ci | |
| - name: Builds javascript snippets. | |
| working-directory: ./website/docs-examples/${{ matrix.dimension }}/javascript | |
| run: npm run build |