Skip to content
Merged

ci #1

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
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

env:
# Reduce compile time and cache size.
RUSTFLAGS: -Dwarnings -Zshare-generics=y -Zthreads=0
RUSTDOCFLAGS: -Dwarnings -Zshare-generics=y -Zthreads=0
# Use the same Rust toolchain across jobs so they can share a cache.
toolchain: nightly-2025-04-03

jobs:
# Check formatting.
format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.toolchain }}
components: rustfmt

- name: Check formatting
run: cargo fmt --all -- --check

# Run Clippy lints.
clippy-lints:
name: Clippy lints
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.toolchain }}
components: clippy

- name: Restore Rust cache
id: cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ci
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Install build dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev

- name: Run Clippy lints
run: cargo clippy --locked --all-targets --all-features

# Run Bevy lints.
bevy-lints:
name: Bevy lints
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain (plus bevy_lint)
uses: TheBevyFlock/bevy_cli/bevy_lint@lint-v0.3.0

- name: Restore Rust cache
id: cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ci
save-if: false

- name: Install build dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev

- name: Run Bevy lints
run: bevy_lint --locked --all-targets --all-features
2 changes: 1 addition & 1 deletion examples/config_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bevy::prelude::{
App, AppExtStates, Camera3d, Commands, NextState, OnEnter, PointLight, Reflect, Res, ResMut,
States, Transform, Vec3, default,
};
use bevy_runtime_gltf_loader::{RuntimeGlftLoaderPlugin, PartsMap};
use bevy_runtime_gltf_loader::{PartsMap, RuntimeGlftLoaderPlugin};
use serde::Deserialize;

#[derive(States, Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]
Expand Down
2 changes: 1 addition & 1 deletion examples/load_part.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bevy::prelude::{
App, AppExtStates, Camera3d, Commands, NextState, OnEnter, PointLight, Res, ResMut, States,
Transform, Vec3, default,
};
use bevy_runtime_gltf_loader::{SimpleRuntimeGltfLoaderPlugin, SimplePartsMap};
use bevy_runtime_gltf_loader::{SimplePartsMap, SimpleRuntimeGltfLoaderPlugin};

#[derive(States, Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]
enum RuntimeState {
Expand Down
2 changes: 1 addition & 1 deletion examples/replace_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy::prelude::{
Reflect, Res, ResMut, StandardMaterial, States, Transform, Vec3, default,
};
use bevy::render::render_resource::{AsBindGroup, ShaderRef};
use bevy_runtime_gltf_loader::{SimpleRuntimeGltfLoaderPlugin, SimplePartsMap};
use bevy_runtime_gltf_loader::{SimplePartsMap, SimpleRuntimeGltfLoaderPlugin};

#[derive(States, Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]
enum RuntimeState {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod plugin;

pub use config_singleton::*;
pub use extend_gltf_material::*;
pub use part_path::*;
pub use part_loader::*;
pub use part_path::*;
pub use parts_map::*;
pub use plugin::*;
4 changes: 3 additions & 1 deletion src/part_loader.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use crate::{EmptyMaterialExtension, WithMaterialExtension};
use bevy::asset::AssetServer;
use bevy::pbr::MaterialExtension;
use bevy::prelude::{BuildChildrenTransformExt, Commands, Entity, GltfAssetLabel, Res, SceneRoot, Transform};
use bevy::prelude::{
BuildChildrenTransformExt, Commands, Entity, GltfAssetLabel, Res, SceneRoot, Transform,
};
use std::marker::PhantomData;

pub struct PartLoader<'a, EXTENSION, MATERIAL = EmptyMaterialExtension> {
Expand Down
8 changes: 4 additions & 4 deletions src/part_path.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::error::Error;
use std::fmt::Display;
use bevy::prelude::BevyError;
use crate::part_loader::PartLoader;
use bevy::prelude::BevyError;
use serde::{Deserialize, Serialize};
use std::error::Error;
use std::fmt::Display;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PartPath<EXTENSION> {
Expand All @@ -29,4 +29,4 @@ impl Display for MissingData {
}
}

impl Error for MissingData {}
impl Error for MissingData {}
3 changes: 2 additions & 1 deletion src/parts_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ impl<EXTENSION: Asset> Default for PartsMap<EXTENSION> {

impl<EXTENSION: Asset> PartsMap<EXTENSION> {
pub fn load_part(&self, name: &str) -> Result<&PartPath<EXTENSION>, BevyError> {
self.get(name).ok_or(BevyError::from(PartNotFoundError::new(name)))
self.get(name)
.ok_or(BevyError::from(PartNotFoundError::new(name)))
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use std::marker::PhantomData;

pub type SimpleRuntimeGltfLoaderPlugin = RuntimeGlftLoaderPlugin<EmptyExtension>;

pub struct RuntimeGlftLoaderPlugin<EXTENSION, STATE = EmptyState, MATERIAL = EmptyMaterialExtension> {
pub struct RuntimeGlftLoaderPlugin<EXTENSION, STATE = EmptyState, MATERIAL = EmptyMaterialExtension>
{
file_ending: &'static str,
// Load a single config as a resource
load_single: Option<LoadSingleConfig<STATE>>,
Expand Down
Loading