Skip to content

Commit

Permalink
Merge pull request #13 from Weibye/dev
Browse files Browse the repository at this point in the history
Getting more functionality in place
  • Loading branch information
Weibye committed Mar 26, 2021
2 parents 15f5086 + b4b86b2 commit b5f7c96
Show file tree
Hide file tree
Showing 27 changed files with 379 additions and 455 deletions.
12 changes: 10 additions & 2 deletions .gitignore
Expand Up @@ -98,5 +98,13 @@ Thumbs.db
__tests__/runner/*
lib/**/*

# Specific for this project
.vs
# VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/
102 changes: 24 additions & 78 deletions README.md
Expand Up @@ -2,96 +2,42 @@
<a href="https://github.com/Weibye/example_checker/actions"><img alt="example_checker status" src="https://github.com/Weibye/example_checker/workflows/build-test/badge.svg"></a>
</p>

# Bevy Example checker action
# Internal File Link-checker

This action parses `./examples/` folders for `example_name.rs` files, and cross references them with both `./examples/README.md` and `./Cargo.toml` to check if they all agree on the same information.
This actions parses a folder recursively for any files and checks if links to these files are present in the defined target documents.

This to prevent people from adding new examples but forgetting to list them in the other sources, or removing examples from documents but forgetting to remove them from the source code.
It's main purpose is to ensure all the target documents has valid links to all the files within these folders.

The primary user for this action at this moment is Bevy Engine, where it is used to check if all the examples are in fact listed in the Cargo and Readme documents. This to prevent people from adding new examples but forgetting to list them in the other sources, or removing examples from documents but forgetting to remove them from the source code.

TODO:
- Make sure all examples are listed in all 3 sources
- readme regex looks for next table and thus loses the last one
- readme must respect exclude directory
- cargo must respect exclude directory
- Cargo should not capture elements that are commented out
- Readme should not capture elements that are commented out

### Requirements / Assumptions

#### Folders
- All examples must reside within the `./examples/` folder
- All example files must have the .rs file ending
-

#### README
- All examples must be listed as entries in a table following the given format:
- All tables must end with an empty new line

```
Example | File | Description
--- | --- | ---
`name_of_example` | [`readme_relative_path_to_file.rs`](./readme/relative/path/to/file.rs) | Text description of the example
```
- The table must have the columns listed as `Example | File | Description`

#### Cargo
- All examples must be listed as entries with the following format
- Must start with the header `[[example]]`
- Must contain `name` and `path` fields
- Example must end with an empty new line
- The block can contain more / other information, which will be ignored by the parser
```
[[example]]
name = "name_of_example"
path = "root/relative/path/to/example"
```


/* Assumptions
* All examples will be within the ./example folder
* All examples are required to be listed in the examples/README.md file
* All example are required to be listed in the Cargo.toml file
* Every single .rs file inside the examples folder represents unique examples
* Only example files will have the .rs file-ending
*
* Potential:
* README
* Check that an entry has description in readme
*
*
* README:
* Assumes 1 empty line between the end of a table and the header of whatever next section

TODO:
- Make sure all examples are listed in all 3 sources
- readme regex looks for next table and thus loses the last one
- readme must respect exclude directory
- cargo must respect exclude directory
- Cargo should not capture elements that are commented out
- Readme should not capture elements that are commented out
- Update action.yml
- Write tests for the system
## Usage

<!-- --> comments in readme
# comments in toml


*/

## Inputs
### Target

### `who-to-greet`
### Target Style
#### Markdown
```[`readme_relative_path_to_file.rs`](./relative/path/to/file.rs)```
#### TOML Path Value
`path = "relative/path/to/file.rs"`

**Required** The name of the person to greet. Default `"World"`.
### File Ignore

## Outputs
This setting make sure any file listed here is ignored from consideration and cross check.

### `time`
This needs to be an array of root-relative paths to files.

The time we greeted you.

## Example usage
### Folder Ignore
This setting make sure any files or folders (recursively) are ignored from consideration and cross check.
This needs to be root-relative paths to folders.
### Whitelist FileType

uses: actions/hello-world-javascript-action@v1.1
with:
who-to-greet: 'Mona the Octocat'
Empty means it scans for all filetypes on disk.

10 changes: 6 additions & 4 deletions __tests__/testData/Cargo.toml
Expand Up @@ -89,6 +89,12 @@ serde = {version = "1", features = ["derive"]}
name = "hello_world"
path = "examples/hello_world.rs"

[[example]]
name = "only_listed_in_cargo"
path = "examples/only_listed_in_cargo"

# path = "this_is_commented_out"

# 2D Rendering
[[example]]
name = "contributors"
Expand Down Expand Up @@ -344,10 +350,6 @@ path = "examples/reflection/trait_reflection.rs"
name = "scene"
path = "examples/scene/scene.rs"

[[example]]
name = "only_found_in_cargo"
path = "only_found_in_cargo.rs"

# Shaders
[[example]]
name = "array_texture"
Expand Down
10 changes: 3 additions & 7 deletions __tests__/testData/examples/README.md
Expand Up @@ -57,14 +57,16 @@ git checkout v0.4.0
Example | Main | Description
--- | --- | ---
`hello_world` | [`hello_world.rs`](./hello_world.rs) | Runs a minimal example that outputs "hello world"
`only_listed_in_readme` | [`only_listed_in_readme.rs`](./only_listed_in_readme.rs) | This file is only listed in the README
<!-- `this_is_commented_out` | [`this_is_commented_out.rs`](./this_is_commented_out.rs) | This file is only listed in the README -->

# Cross-Platform Examples

## 2D Rendering

Example | Main | Description
--- | --- | ---
`contributors` | [`2d/contributors.rs`](./2d/contributors.rs) | Displays each contributor as a bouncy bevy-ball!
`contributors` | [`2d/contributors.rs`](2d/contributors.rs) | Displays each contributor as a bouncy bevy-ball!
`sprite` | [`2d/sprite.rs`](./2d/sprite.rs) | Renders a sprite
`sprite_sheet` | [`2d/sprite_sheet.rs`](./2d/sprite_sheet.rs) | Renders an animated sprite
`text2d` | [`2d/text2d.rs`](./2d/text2d.rs) | Generates text in 2d
Expand Down Expand Up @@ -140,11 +142,6 @@ Example | File | Description
`system_param` | [`ecs/system_param.rs`](./ecs/system_param.rs) | Illustrates creating custom system parameters with `SystemParam`
`timers` | [`ecs/timers.rs`](./ecs/timers.rs) | Illustrates ticking `Timer` resources inside systems and handling their state

## Decoys
Example | File | Description
--- | --- | ---
`example_not_on_disk` | [`test/example_not_on_disk.rs`](./test/example_not_on_disk.rs) | This example is not on disk

## Games

Example | File | Description
Expand All @@ -165,7 +162,6 @@ Example | File | Description
`mouse_input_events` | [`input/mouse_input_events.rs`](./input/mouse_input_events.rs) | Prints out all mouse events (buttons, movement, etc.)
`touch_input` | [`input/touch_input.rs`](./input/touch_input.rs) | Displays touch presses, releases, and cancels
`touch_input_events` | [`input/touch_input_events.rs`](./input/touch_input_input_events.rs) | Prints out all touch inputs
`missing_description` | [`input/missing_description.rs`](./input/missing_description)

## Reflection

Expand Down
Empty file.
Empty file.
File renamed without changes.
@@ -0,0 +1 @@
// Exclude file =!!!
95 changes: 83 additions & 12 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions src/CargoExamples.ts

This file was deleted.

0 comments on commit b5f7c96

Please sign in to comment.