Skip to content

Commit 44f64a3

Browse files
Weibye-BreachWeibye
andcommitted
CI - Check that examples are listed in README and Cargo (#1650)
Closes #1581 # Internal File/Link Consistency checker Action This pull request adds an action to the CI that parses the [`./examples`](https://github.com/bevyengine/bevy/tree/main/examples) folder for files and cross references that with the links listed in [`README.md`](https://github.com/bevyengine/bevy/blob/main/examples/README.md) and [`Cargo.toml`](https://github.com/bevyengine/bevy/blob/main/Cargo.toml) to ensure the documentation actually reflects the examples currently in the repo. The primary reason for why we want this, is to prevent people from adding new examples but forgetting to also list them in the docs, or accidentally entering broken links (typos in docs). For details on how the action is working: [Check out the README here](https://github.com/Weibye/action-internal-link-consistency/blob/main/README.md) Co-authored-by: Andreas Weibye <[email protected]>
1 parent 4f34143 commit 44f64a3

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

.github/bors.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ status = [
1010
"check-markdown-links",
1111
"run-examples",
1212
"check-doc",
13+
"check-missing-examples-in-docs",
1314
]
1415

1516
use_squash_merge = true

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,16 @@ jobs:
152152
- name: Checks dead links
153153
run: cargo deadlinks --dir target/doc/bevy
154154
continue-on-error: true
155+
156+
check-missing-examples-in-docs:
157+
runs-on: ubuntu-latest
158+
steps:
159+
- uses: actions/checkout@v2
160+
- name: Check that examples are present in both README and Cargo
161+
uses: Weibye/[email protected]
162+
with:
163+
source: './examples/'
164+
targets: '[ "./Cargo.toml", "./examples/README.md" ]'
165+
file-types: '[".rs"]'
166+
exclude-folders: '["./examples/ios"]'
167+
exclude-files: '[]'

examples/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ git checkout v0.4.0
7272
<!-- markdownlint-disable-next-line MD026 -->
7373
## Hello, World!
7474

75-
Example | Main | Description
75+
Example | File | Description
7676
--- | --- | ---
7777
`hello_world` | [`hello_world.rs`](./hello_world.rs) | Runs a minimal example that outputs "hello world"
7878

7979
# Cross-Platform Examples
8080

8181
## 2D Rendering
8282

83-
Example | Main | Description
83+
Example | File | Description
8484
--- | --- | ---
8585
`contributors` | [`2d/contributors.rs`](./2d/contributors.rs) | Displays each contributor as a bouncy bevy-ball!
8686
`many_sprites` | [`2d/many_sprites.rs`](./2d/many_sprites.rs) | Displays many sprites in a grid arragement! Used for performance testing.
@@ -197,10 +197,10 @@ Example | File | Description
197197

198198
Example | File | Description
199199
--- | --- | ---
200-
`reflection` | [`reflection/reflection.rs`](reflection/reflection.rs) | Demonstrates how reflection in Bevy provides a way to dynamically interact with Rust types
201-
`generic_reflection` | [`reflection/generic_reflection.rs`](reflection/generic_reflection.rs) | Registers concrete instances of generic types that may be used with reflection
202-
`reflection_types` | [`reflection/reflection_types.rs`](reflection/reflection_types.rs) | Illustrates the various reflection types available
203-
`trait_reflection` | [`reflection/trait_reflection.rs`](reflection/trait_reflection.rs) | Allows reflection with trait objects
200+
`reflection` | [`reflection/reflection.rs`](./reflection/reflection.rs) | Demonstrates how reflection in Bevy provides a way to dynamically interact with Rust types
201+
`generic_reflection` | [`reflection/generic_reflection.rs`](./reflection/generic_reflection.rs) | Registers concrete instances of generic types that may be used with reflection
202+
`reflection_types` | [`reflection/reflection_types.rs`](./reflection/reflection_types.rs) | Illustrates the various reflection types available
203+
`trait_reflection` | [`reflection/trait_reflection.rs`](./reflection/trait_reflection.rs) | Allows reflection with trait objects
204204

205205
## Scene
206206

0 commit comments

Comments
 (0)