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

Add doc tests to CI #267

Merged
merged 7 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
75 changes: 46 additions & 29 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,60 @@ on:
push:
branches:
- main

name: CI

jobs:
ci:
name: CI
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Update Packages
run: sudo apt-get update -yq

- name: Install dependencies
run: sudo apt-get install -yq --no-install-recommends libudev-dev libasound2-dev libxcb-composite0-dev

- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Cache Dependencies
uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
format:
runs-on: ubuntu-latest
needs: [setup]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2.7.0
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check

- name: Install fmt
run: rustup component add rustfmt

- name: fmt
run: cargo fmt --all -- --check
check:
runs-on: ubuntu-latest
needs: [setup]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2.7.0
- run: cargo check

- name: check
run: cargo check
clippy:
runs-on: ubuntu-latest
needs: [setup]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2.7.0
- run: rustup component add clippy
- run: cargo clippy -- -D warnings

- name: Install clippy
run: rustup component add clippy

- name: run clippy
run: cargo clippy -- -D warnings

- name: test
run: cargo test
doc:
runs-on: ubuntu-latest
needs: [setup]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2.7.0
- run: cargo doc --no-deps --workspace
env:
RUSTDOCFLAGS: -D warnings

test:
runs-on: ubuntu-latest
needs: [setup]
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2.7.0
- run: cargo test
2 changes: 1 addition & 1 deletion backends/bevy_picking_rapier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! [`RapierPickCamera`]. If a pointer passes through this camera's render target, it will
//! automatically shoot rays into the rapier scene and will be able to pick things.
//!
//! To ignore an entity, you can add [`Pickable::ignore`] to it, and it will be ignored during
//! To ignore an entity, you can add [`Pickable::IGNORE`] to it, and it will be ignored during
//! raycasting.
//!
//! ## Limitations
Expand Down
4 changes: 2 additions & 2 deletions backends/bevy_picking_sprite/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! A raycasting backend for [`bevy_sprite`](bevy::sprite).
//! A raycasting backend for [`bevy_sprite`].

#![allow(clippy::type_complexity)]
#![allow(clippy::too_many_arguments)]
Expand All @@ -22,7 +22,7 @@ pub mod prelude {
pub use crate::SpriteBackend;
}

/// Adds picking support for [`bevy_sprite`](bevy::sprite)
/// Adds picking support for [`bevy_sprite`].
#[derive(Clone)]
pub struct SpriteBackend;
impl Plugin for SpriteBackend {
Expand Down
6 changes: 3 additions & 3 deletions backends/bevy_picking_ui/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! A picking backend for [`bevy_ui`](bevy::ui).
//! A picking backend for [`bevy_ui`].
//!
//! # Usage
//!
Expand All @@ -7,7 +7,7 @@
//!
//! ## Important Note
//!
//! This backend completely ignores [`FocusPolicy`](bevy::ui::FocusPolicy). The design of bevy ui's
//! This backend completely ignores [`FocusPolicy`](bevy_ui::FocusPolicy). The design of bevy ui's
//! focus systems and the picking plugin are not compatible. Instead, use the [`Pickable`] component
//! to customize how an entity responds to picking focus.
//!
Expand Down Expand Up @@ -37,7 +37,7 @@ pub mod prelude {
pub use crate::BevyUiBackend;
}

/// Adds picking support for [`bevy_ui`](bevy::ui)
/// Adds picking support for [`bevy_ui`].
#[derive(Clone)]
pub struct BevyUiBackend;
impl Plugin for BevyUiBackend {
Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_picking_core/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ pub struct PointerHits {
pub pointer: prelude::PointerId,
/// An unordered collection of entities and their distance (depth) from the cursor.
pub picks: Vec<(Entity, HitData)>,
/// Set the order of this group of picks. Normally, this is the [`Camera::order`].
/// Set the order of this group of picks. Normally, this is the
/// [`bevy_render::camera::Camera::order`].
///
/// Used to allow multiple `PointerHits` submitted for the same pointer to be ordered.
/// `PointerHits` with a higher `order` will be checked before those with a lower `order`,
Expand Down Expand Up @@ -80,7 +81,7 @@ impl PointerHits {
/// Holds data from a successful pointer hit test.
///
/// `depth` only needs to be self-consistent with other [`PointerHits`]s using the same
/// [`RenderTarget`](bevy::render::camera::RenderTarget).
/// [`RenderTarget`](bevy_render::camera::RenderTarget).
#[derive(Clone, Debug, PartialEq, Reflect)]
pub struct HitData {
/// The camera entity used to detect this hit. Useful when you need to find the ray that was
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_picking_highlight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Default for HighlightPluginSettings {
}
}

/// Adds the [`StandardMaterial`] and [`ColorMaterial`] highlighting plugins.
/// Adds the `StandardMaterial` and `ColorMaterial` highlighting plugins.
///
/// To use another asset type `T` for highlighting, add [`HighlightPlugin<T>`].
///
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! A flexible set of plugins that add picking functionality to your [`bevy`] app, with a focus on
//! A flexible set of plugins that add picking functionality to your `bevy` app, with a focus on
//! modularity, expressiveness, and robustness. Want to drag a UI entity and drop it onto a 3D mesh
//! entity? This plugin allows you to add event listeners to **any** entity, and works with mouse,
//! touch, or even gamepads. Includes optional integrations for `rapier` and `egui`, but is agnostic
Expand Down