Skip to content

Commit 9cf35ab

Browse files
authored
Merge pull request #1 from Daemon-Computer/ci
ci
2 parents c05500e + 4196974 commit 9cf35ab

9 files changed

Lines changed: 106 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
env:
13+
# Reduce compile time and cache size.
14+
RUSTFLAGS: -Dwarnings -Zshare-generics=y -Zthreads=0
15+
RUSTDOCFLAGS: -Dwarnings -Zshare-generics=y -Zthreads=0
16+
# Use the same Rust toolchain across jobs so they can share a cache.
17+
toolchain: nightly-2025-04-03
18+
19+
jobs:
20+
# Check formatting.
21+
format:
22+
name: Format
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 10
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Install Rust toolchain
30+
uses: dtolnay/rust-toolchain@master
31+
with:
32+
toolchain: ${{ env.toolchain }}
33+
components: rustfmt
34+
35+
- name: Check formatting
36+
run: cargo fmt --all -- --check
37+
38+
# Run Clippy lints.
39+
clippy-lints:
40+
name: Clippy lints
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 20
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
47+
- name: Install Rust toolchain
48+
uses: dtolnay/rust-toolchain@master
49+
with:
50+
toolchain: ${{ env.toolchain }}
51+
components: clippy
52+
53+
- name: Restore Rust cache
54+
id: cache
55+
uses: Swatinem/rust-cache@v2
56+
with:
57+
shared-key: ci
58+
save-if: ${{ github.ref == 'refs/heads/main' }}
59+
60+
- name: Install build dependencies
61+
if: steps.cache.outputs.cache-hit != 'true'
62+
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev
63+
64+
- name: Run Clippy lints
65+
run: cargo clippy --locked --all-targets --all-features
66+
67+
# Run Bevy lints.
68+
bevy-lints:
69+
name: Bevy lints
70+
runs-on: ubuntu-latest
71+
timeout-minutes: 20
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v4
75+
76+
- name: Install Rust toolchain (plus bevy_lint)
77+
uses: TheBevyFlock/bevy_cli/bevy_lint@lint-v0.3.0
78+
79+
- name: Restore Rust cache
80+
id: cache
81+
uses: Swatinem/rust-cache@v2
82+
with:
83+
shared-key: ci
84+
save-if: false
85+
86+
- name: Install build dependencies
87+
if: steps.cache.outputs.cache-hit != 'true'
88+
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev
89+
90+
- name: Run Bevy lints
91+
run: bevy_lint --locked --all-targets --all-features

examples/config_extension.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use bevy::prelude::{
44
App, AppExtStates, Camera3d, Commands, NextState, OnEnter, PointLight, Reflect, Res, ResMut,
55
States, Transform, Vec3, default,
66
};
7-
use bevy_runtime_gltf_loader::{RuntimeGlftLoaderPlugin, PartsMap};
7+
use bevy_runtime_gltf_loader::{PartsMap, RuntimeGlftLoaderPlugin};
88
use serde::Deserialize;
99

1010
#[derive(States, Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]

examples/load_part.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use bevy::prelude::{
44
App, AppExtStates, Camera3d, Commands, NextState, OnEnter, PointLight, Res, ResMut, States,
55
Transform, Vec3, default,
66
};
7-
use bevy_runtime_gltf_loader::{SimpleRuntimeGltfLoaderPlugin, SimplePartsMap};
7+
use bevy_runtime_gltf_loader::{SimplePartsMap, SimpleRuntimeGltfLoaderPlugin};
88

99
#[derive(States, Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]
1010
enum RuntimeState {

examples/replace_mesh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use bevy::prelude::{
66
Reflect, Res, ResMut, StandardMaterial, States, Transform, Vec3, default,
77
};
88
use bevy::render::render_resource::{AsBindGroup, ShaderRef};
9-
use bevy_runtime_gltf_loader::{SimpleRuntimeGltfLoaderPlugin, SimplePartsMap};
9+
use bevy_runtime_gltf_loader::{SimplePartsMap, SimpleRuntimeGltfLoaderPlugin};
1010

1111
#[derive(States, Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]
1212
enum RuntimeState {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod plugin;
77

88
pub use config_singleton::*;
99
pub use extend_gltf_material::*;
10-
pub use part_path::*;
1110
pub use part_loader::*;
11+
pub use part_path::*;
1212
pub use parts_map::*;
1313
pub use plugin::*;

src/part_loader.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use crate::{EmptyMaterialExtension, WithMaterialExtension};
22
use bevy::asset::AssetServer;
33
use bevy::pbr::MaterialExtension;
4-
use bevy::prelude::{BuildChildrenTransformExt, Commands, Entity, GltfAssetLabel, Res, SceneRoot, Transform};
4+
use bevy::prelude::{
5+
BuildChildrenTransformExt, Commands, Entity, GltfAssetLabel, Res, SceneRoot, Transform,
6+
};
57
use std::marker::PhantomData;
68

79
pub struct PartLoader<'a, EXTENSION, MATERIAL = EmptyMaterialExtension> {

src/part_path.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use std::error::Error;
2-
use std::fmt::Display;
3-
use bevy::prelude::BevyError;
41
use crate::part_loader::PartLoader;
2+
use bevy::prelude::BevyError;
53
use serde::{Deserialize, Serialize};
4+
use std::error::Error;
5+
use std::fmt::Display;
66

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

32-
impl Error for MissingData {}
32+
impl Error for MissingData {}

src/parts_map.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ impl<EXTENSION: Asset> Default for PartsMap<EXTENSION> {
1717

1818
impl<EXTENSION: Asset> PartsMap<EXTENSION> {
1919
pub fn load_part(&self, name: &str) -> Result<&PartPath<EXTENSION>, BevyError> {
20-
self.get(name).ok_or(BevyError::from(PartNotFoundError::new(name)))
20+
self.get(name)
21+
.ok_or(BevyError::from(PartNotFoundError::new(name)))
2122
}
2223
}
2324

src/plugin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use std::marker::PhantomData;
1111

1212
pub type SimpleRuntimeGltfLoaderPlugin = RuntimeGlftLoaderPlugin<EmptyExtension>;
1313

14-
pub struct RuntimeGlftLoaderPlugin<EXTENSION, STATE = EmptyState, MATERIAL = EmptyMaterialExtension> {
14+
pub struct RuntimeGlftLoaderPlugin<EXTENSION, STATE = EmptyState, MATERIAL = EmptyMaterialExtension>
15+
{
1516
file_ending: &'static str,
1617
// Load a single config as a resource
1718
load_single: Option<LoadSingleConfig<STATE>>,

0 commit comments

Comments
 (0)