Skip to content

Commit

Permalink
Examples metadata in Cargo.toml (bevyengine#4741)
Browse files Browse the repository at this point in the history
# Objective

- Have information about examples only in one place that can be used for the repo and for the website (and remove the need to keep a list of example to build for wasm in the website https://github.com/bevyengine/bevy-website/blob/75acb730406ef9c5928d37daf8bb32e4dbeb8b13/generate-wasm-examples/generate_wasm_examples.sh#L92-L99)

## Solution

- Add metadata about examples in `Cargo.toml`
- Build the `examples/README.md` from a template using those metadata. I used tera as the template engine to use the same tech as the website.
- Make CI fail if an example is missing metadata, or if the readme file needs to be updated (the command to update it is displayed in the failed step in CI)

## Remaining To Do

- After the next release with this merged in, the website will be able to be updated to use those metadata too
- I would like to build the examples in wasm and make them available at http://dev-docs.bevyengine.org/ but that will require more design
- bevyengine/bevy-website#299 for other ToDos

Co-authored-by: Readme <github-actions@github.com>
  • Loading branch information
2 people authored and james7132 committed Oct 28, 2022
1 parent ad185cf commit 58c80e5
Show file tree
Hide file tree
Showing 6 changed files with 1,374 additions and 196 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:

markdownlint:
runs-on: ubuntu-latest
needs: check-missing-examples-in-docs
needs: check-examples-readme-update-needed
if: always()
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -261,14 +261,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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: '[]'
- run: cargo run -p build-example-pages -- check-missing

check-examples-readme-update-needed:
needs: check-missing-examples-in-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cargo run -p build-example-pages -- update
- name: Check for modified files
run: |
echo "if this step fails, run the following command and commit the changed file on your PR."
echo " > cargo run -p build-example-pages -- update"
git diff --quiet HEAD --
check-unused-dependencies:
runs-on: ubuntu-latest
Expand Down
Loading

0 comments on commit 58c80e5

Please sign in to comment.