Skip to content

Commit f8fa229

Browse files
mockersfReadme
andcommitted
Examples metadata in Cargo.toml (#4741)
# 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>
1 parent 5712583 commit f8fa229

File tree

6 files changed

+1374
-196
lines changed

6 files changed

+1374
-196
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162

163163
markdownlint:
164164
runs-on: ubuntu-latest
165-
needs: check-missing-examples-in-docs
165+
needs: check-examples-readme-update-needed
166166
if: always()
167167
steps:
168168
- uses: actions/checkout@v3
@@ -261,14 +261,19 @@ jobs:
261261
runs-on: ubuntu-latest
262262
steps:
263263
- uses: actions/checkout@v3
264-
- name: Check that examples are present in both README and Cargo
265-
uses: Weibye/action-internal-link-consistency@1.0.0
266-
with:
267-
source: './examples/'
268-
targets: '[ "./Cargo.toml", "./examples/README.md" ]'
269-
file-types: '[".rs"]'
270-
exclude-folders: '["./examples/ios"]'
271-
exclude-files: '[]'
264+
- run: cargo run -p build-example-pages -- check-missing
265+
266+
check-examples-readme-update-needed:
267+
needs: check-missing-examples-in-docs
268+
runs-on: ubuntu-latest
269+
steps:
270+
- uses: actions/checkout@v3
271+
- run: cargo run -p build-example-pages -- update
272+
- name: Check for modified files
273+
run: |
274+
echo "if this step fails, run the following command and commit the changed file on your PR."
275+
echo " > cargo run -p build-example-pages -- update"
276+
git diff --quiet HEAD --
272277
273278
check-unused-dependencies:
274279
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)