mun-lang / mun

Source code for the Mun language and runtime.
https://mun-lang.org
Other
1.87k stars 73 forks source link

misc(example): added Bevy-Mun example #416

Closed virgilhuxley closed 2 years ago

virgilhuxley commented 2 years ago

Note: This example can not be run from cargo run --example bevy_simple.
User must be in examples/bevy_simple directory to run.

baszalmstra commented 2 years ago

@Wodann do you know how to fix the CI issue?

codecov[bot] commented 2 years ago

Codecov Report

Merging #416 (f1ab868) into main (b3df13f) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #416   +/-   ##
=======================================
  Coverage   83.04%   83.04%           
=======================================
  Files         280      280           
  Lines       16520    16520           
=======================================
  Hits        13719    13719           
  Misses       2801     2801           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b3df13f...f1ab868. Read the comment docs.

Wodann commented 2 years ago

@Wodann do you know how to fix the CI issue?

Yes, the examples directory is intended for mun packages only. The corresponding rust code should be in crates/mun_runtime.

The C++ tests look through the mun examples to ensure that all of them are compiled. Since the bevy example has the rust code included at the top-level, it fails to find (and compile) the mun library.

Edit: I'm restructuring the files to ensure it succeeds.

baszalmstra commented 2 years ago

I am a bit concerned that the rust examples will be hard to find if we add it to the examples directory of the runtime. When I browse repositories the first (and only really) place I look is the examples folder in the root. Would it be an idea to make subdirectories in the examples folder for mun and rust instead? Or perhaps a symlink?

Wodann commented 2 years ago

I am a bit concerned that the rust examples will be hard to find if we add it to the examples directory of the runtime. When I browse repositories the first (and only really) place I look is the examples folder in the root. Would it be an idea to make subdirectories in the examples folder for mun and rust instead? Or perhaps a symlink?

The normal folder structure of a package is like this. Tests, benchmarks, and examples live alongside the src of a crate. This allows you to directly use the crate - without specifying a dependency.

As we have a mono-repo, we have multiple types of examples: Rust examples for mun_runtime but potentially also other crates, C++ examples for our wrapper, and Mun examples. My reasoning was to keep the C++ examples in the cpp folder, the Mun examples at the top-level, and the Rust examples in their respective crates - based on the project layout linked earlier.

When we publish packages, this also ensures that examples show up correctly on docs.rs; e.g. https://docs.rs/crate/mun_runtime/0.3.0/source/examples/

I'm happy to link to the different examples, though. Would the README be a good place for that?

baszalmstra commented 2 years ago

Yeah that also sounds good. I just want to make sure that they are easily findable. Having them 3 folders deep might not be the easiest to find.

Wodann commented 2 years ago

@baszalmstra I was finally able to fix the CI. Windows no longer uses a cache and has incremental builds disabled. That allows all tests to be compiled without exceeding disk space.

Could you please have a look and approve if you're happy. If you'd like I can also create a separate PR for the required changes and rebase this PR.

Before: image

After: image

baszalmstra commented 2 years ago

@Wodann Looks good to me. Its a bit sad about windows, but we can look at that later. Do you know why tarpaulin is failing though?