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 <13300393+Weibye@users.noreply.github.com>
This commit is contained in:
Andreas Weibye 2021-05-30 18:14:58 +00:00
parent 4f34143046
commit 44f64a32f4
3 changed files with 20 additions and 6 deletions

1
.github/bors.toml vendored
View File

@ -10,6 +10,7 @@ status = [
"check-markdown-links",
"run-examples",
"check-doc",
"check-missing-examples-in-docs",
]
use_squash_merge = true

View File

@ -152,3 +152,16 @@ jobs:
- name: Checks dead links
run: cargo deadlinks --dir target/doc/bevy
continue-on-error: true
check-missing-examples-in-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check that examples are present in both README and Cargo
uses: Weibye/action-internal-link-consistency@1.0.0
with:
source: './examples/'
targets: '[ "./Cargo.toml", "./examples/README.md" ]'
file-types: '[".rs"]'
exclude-folders: '["./examples/ios"]'
exclude-files: '[]'

View File

@ -72,7 +72,7 @@ git checkout v0.4.0
<!-- markdownlint-disable-next-line MD026 -->
## Hello, World!
Example | Main | Description
Example | File | Description
--- | --- | ---
`hello_world` | [`hello_world.rs`](./hello_world.rs) | Runs a minimal example that outputs "hello world"
@ -80,7 +80,7 @@ Example | Main | Description
## 2D Rendering
Example | Main | Description
Example | File | Description
--- | --- | ---
`contributors` | [`2d/contributors.rs`](./2d/contributors.rs) | Displays each contributor as a bouncy bevy-ball!
`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
Example | File | Description
--- | --- | ---
`reflection` | [`reflection/reflection.rs`](reflection/reflection.rs) | Demonstrates how reflection in Bevy provides a way to dynamically interact with Rust types
`generic_reflection` | [`reflection/generic_reflection.rs`](reflection/generic_reflection.rs) | Registers concrete instances of generic types that may be used with reflection
`reflection_types` | [`reflection/reflection_types.rs`](reflection/reflection_types.rs) | Illustrates the various reflection types available
`trait_reflection` | [`reflection/trait_reflection.rs`](reflection/trait_reflection.rs) | Allows reflection with trait objects
`reflection` | [`reflection/reflection.rs`](./reflection/reflection.rs) | Demonstrates how reflection in Bevy provides a way to dynamically interact with Rust types
`generic_reflection` | [`reflection/generic_reflection.rs`](./reflection/generic_reflection.rs) | Registers concrete instances of generic types that may be used with reflection
`reflection_types` | [`reflection/reflection_types.rs`](./reflection/reflection_types.rs) | Illustrates the various reflection types available
`trait_reflection` | [`reflection/trait_reflection.rs`](./reflection/trait_reflection.rs) | Allows reflection with trait objects
## Scene