Check for bevy_internal imports in CI (#9612)
# Objective - Avoid using bevy_internal imports in examples. ## Solution - Add CI to check for bevy_internal imports like suggested in https://github.com/bevyengine/bevy/pull/9547#issuecomment-1689377999 - Fix another import I don't know much about CI so I don't know if this is the better approach, but I think is better than doing a pull request every time I found this lol, any suggestion is welcome. --------- Co-authored-by: Rob Parrett <robparrett@gmail.com>
This commit is contained in:
parent
1399078f12
commit
f2f39c835a
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
@ -333,3 +333,25 @@ jobs:
|
||||
with:
|
||||
name: msrv
|
||||
path: msrv/
|
||||
|
||||
check-bevy-internal-imports:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Check for bevy_internal imports
|
||||
shell: bash
|
||||
run: |
|
||||
errors=""
|
||||
for file in $(find examples tests -name '*.rs'); do
|
||||
if grep -q "use bevy_internal" "$file"; then
|
||||
errors+="ERROR: Detected 'use bevy_internal' in $file\n"
|
||||
fi
|
||||
done
|
||||
if [ -n "$errors" ]; then
|
||||
echo -e "$errors"
|
||||
echo " Avoid importing bevy_internal, it should not be used directly"
|
||||
echo " Fix the issue by replacing 'bevy_internal' with 'bevy'"
|
||||
echo " Example: 'use bevy::sprite::MaterialMesh2dBundle;' instead of 'bevy_internal::sprite::MaterialMesh2dBundle;'"
|
||||
exit 1
|
||||
fi
|
||||
@ -3,9 +3,7 @@
|
||||
use std::f32::consts::PI;
|
||||
use std::time::Duration;
|
||||
|
||||
use bevy::pbr::CascadeShadowConfigBuilder;
|
||||
use bevy::prelude::*;
|
||||
use bevy_internal::animation::RepeatAnimation;
|
||||
use bevy::{animation::RepeatAnimation, pbr::CascadeShadowConfigBuilder, prelude::*};
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user