Skip to content

Commit

Permalink
CI - Check that examples are listed in README and Cargo (bevyengine#1650
Browse files Browse the repository at this point in the history
)

Closes bevyengine#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>
  • Loading branch information
Weibye-Breach and Weibye committed May 30, 2021
1 parent 4f34143 commit 44f64a3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/bors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ status = [
"check-markdown-links",
"run-examples",
"check-doc",
"check-missing-examples-in-docs",
]

use_squash_merge = true
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: '[]'
12 changes: 6 additions & 6 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ 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"

# Cross-Platform Examples

## 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.
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 44f64a3

Please sign in to comment.