Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync new book to main #871

Merged
merged 287 commits into from
Jan 20, 2024

Conversation

TrialDragon
Copy link
Member

Synchronizes new book to main and fixes issues that came up as the result of resolving merge conflicts.

Changes usage of rust type shortcode to reference links since that was removed from new books.

Change book_section to docs_section because book_section was changed to docs_section in main a while ago.

Create a quick-start section. This one is more prep work for #870

Is apart of #870 in order to make further changes easier; especially when maintainers merge new book into main.

hymm and others added 30 commits August 1, 2022 15:46
Users using tracy need to upgrade their tracy version.
## Objective

It's not uncommon for people to forget to update their rust versions. 

## Solution

Add a short warning to remind people to run `rustup update` and a short description as to why

![image](https://user-images.githubusercontent.com/8348954/182221263-3f079b08-22e6-40c9-9d09-9296b75d4490.png)

## Notes

For now this is only on the latest migration guide, but I already have plans to make migration guide a dedicated section on the website and use a template that could include this warning on every page.
## Objective

Fixes bevyengine/bevy#4963
Issue is not in Bevy but on CSS of the page to resize the canvas

## Solution

Use the new option from Bevy 0.8 to resize canvas to parent
- "bu" -> "but"
- "eeking out" -> "eking out"
`delta` is correct because it's in the snippet below and I've checked that it works.
> mold is a faster drop-in replacement for existing Unix linkers. It is several times faster than the LLVM lld linker, the second-fastest open-source linker which I originally created a few years ago. mold is designed to increase developer productivity by reducing build time, especially in rapid debug-edit-rebuild cycles.

| Program (linker output size)  | GNU gold | LLVM lld | mold
|-------------------------------|----------|----------|--------
| Chrome 96 (1.89 GiB)          | 53.86s   | 11.74s   | 2.21s
| Clang 13 (3.18 GiB)           | 64.12s   | 5.82s    | 2.90s
| Firefox 89 libxul (1.64 GiB)  | 32.95s   | 6.80s    | 1.42s

Mold is exclusive to Linux, with support for Windows and MacOS in progress.

---

This PR adds mold to the recommended linkers in [the setup page](https://bevyengine.org/learn/book/getting-started/setup/).

Note that this addition is somewhat clunky, and this section may need to be reworked entirely. See bevyengine#329 for further discussion.
)

The current migration guide is unoptimal for the changes to `Assets::get`.

Basic and common usecases like `assets.get("file/path.ron")` are broken
and the migration guide chapter doesn't even mention them!

If they are considered bad practices, it's fine (though I somewhat disagree)
but they should be at least acknowledged, given a motivation why it shouldn't
be done and provided both a migration route and a temporary measure.

<https://discord.com/channels/691052431525675048/1006978388080218222>
For people who don't know what `taffy` is or who might want to contribute :)
This file has not been changed since 2 years, so I don't think we need it.
If the entry is still relevant, it should be moved to an issue instead.
…gine#430)

Very simple:

```rust
// 0.7
texture.sampler_descriptor = SamplerDescriptor {
    address_mode_u: AddressMode::Repeat,
    address_mode_v: AddressMode::Repeat,
    ..default()
};

// 0.8
texture.sampler_descriptor = ImageSampler::Descriptor(SamplerDescriptor {
    address_mode_u: AddressMode::Repeat,
    address_mode_v: AddressMode::Repeat,
    ..default()
});
```
## Objective

CI takes a long time because each generate job is done sequentially and there's no caching.
Fix that.

## Solution

Create one job per generate-* and wait until they are done to build the website.

- Each job uploads artifacts
- The final jobs download all the artifacts and use them to build the website
- Each job also caches their respective build artifacts to speed up build time
  - For the wasm-examples it also caches the wasm files. The cache is invalidated once the bevy version tagged latest changes

This is all done only for the CI workflow. Eventually this could also be done with the deploy workflow by using something like https://docs.github.com/en/actions/using-workflows/reusing-workflows.

This is what the jobs look like now. The timing were done with a pre-existing cache.

![vivaldi_TOqEly8nzH](https://user-images.githubusercontent.com/8348954/180705119-5d03e49b-91b6-49db-ad68-db3966c758f8.png)

## Notes

The longest job by far is still generating examples right now, but generating the assets metadata is about to get a lot longer. I believe we can create multiple jobs to parallelize the examples a bit more. Probably one per category. This can be done in a future PR.

I changed how the assets path are generated because it was causing issues when trying to zip them before the upload,
## Objective

The new asset cards (bevyengine#394) need more metadata for license and bevy compatible versions.

## Solution

- For assets with a link to github or gitlab:
  - Get the Cargo.toml file using the apis, parse it and read the bevy version and license fields.
  - This is done on a best effort basis. It's not always possible to have this information. For example, when the Cargo.toml is not at the top level. 
- For assets with crates.io links
  - Use the crates.io dbdump to get the required data.
- If the metadata is entered manually directly in bevy_assets it will be used instead.

The github client relies on a GITHUB_TOKEN env var to exist in CI or locally. It should be already there since we use github actions. The rate limit in github actions is 1000 per hour https://docs.github.com/en/rest/overview/resources-in-the-rest-api#requests-from-github-actions so we should be fine for a little while.

The gitlab client implementation ignores the token because we have so few crates that it doesn't matter.

## Notes

Querying the crates.io dump is pretty slow and the deps-tree required is pretty big. I think we should consider eventually rolling our own way to do that, but it works well right now.

This is going to be pretty slow to execute in the job once it is merged, but it's pretty easy to parallelize all the generate-* jobs so I did it in bevyengine#401 .
Fixes bevyengine#444

It's not completely clear to me exactly what was intended with this change in bevyengine#401, but this logic seems obviously reversed (it just completely erased the path).

This fixes the assets page locally for me.

edit: I see the note in 401 now about the paths needing to be filtered to make some part of the the CI / zipping work. Not entirely sure how to test that.
## Objective

Update the asset cards to support more metadata. The main goal is to be able to show the supported bevy version. Everything else is secondary right now.

## Solution

Support more metadata by using the styling from bevyengine#231.

I'm missing a few things, like different colors for bevy versions, but that's because I don't know how to do that with zola templates. I also ignored the author name and crate version for now because it doesn't apply to every crate and it can be iterated on in the future.

![image](https://user-images.githubusercontent.com/8348954/179620589-77b196df-c0ed-412f-ac78-8876e3430f65.png)

Supported metadata:
- `bevy_versions`: array of supported version
- `licenses`: array of licenses

The metadata currently doesn't exist, but the code is written in such a way to not break if it doesn't exist. I created bevyengine#397 to generate the required metadata.

A lot of the values were just found by me playing around with values and finding something that looked good. I'm absolutely opened to changing them. To be clear, a lot of what I have right now are just values that ended up working, but there's probably a better way to do most of those things.

## Remaining questions

- ~~What to do with assets without images.~~
  - Solved: I added a gradient to make it a bit less empty.
- How to handle different color based on the value of the version tag by using zola templates

## Notes

Until we add the required metadata, the cards will have a lot of empty space at the bottom, I already have a prototype ready to add the missing metadata, so that should be fixed pretty fast.

Co-authored-by: Charles <[email protected]>
Co-authored-by: Carter Anderson <[email protected]>
This is needed to populate Bevy Assets info from github.
`ScalingMode::FixedVertical` is an enum variant that takes an f32, but it's used without a parameter in the migration guide.
Fixes bevyengine#451 

Added a `.sort` so we're not relying on the file system's ordering.

I could not reproduce the error locally, but I tested with some debug logging in the [action on my fork ](https://github.com/rparrett/bevy-website/runs/8079655275?check_suite_focus=true)and confirmed that this was the issue and that this should fix it.
To run rust on MacOS you require Xcode or it will give the Following error: 
xcrun: error: invalid active developer path

Co-authored-by: Carter Anderson <[email protected]>
Noticed a teeny tiny typo with a lowercase <kbd>h</kbd> instead of an uppercase <kbd>H</kbd> 😄 

![image](https://user-images.githubusercontent.com/121322/188336323-8af0c7a6-90c2-4247-a51a-d40e4c6c6fbe.png)
Zola's `resize_image` actually panics when trying to resize animated webp files.

So we guard against trying to resize those, especially given that animated webps are not supported by zola's resize_image (only static images)
Some minor improvements to this tool both for contributors who may be working with it and for end-users making PRs to `bevy-assets`

- Show a friendlier error when failing to specify the `bevy-assets` path as a cli argument
- Show an error if the user specifies the `bevy-assets` path incorrectly
- Show errors that occur during `parse_assets`
- Check that images exist
- Group errors by asset

I felt a bit awkward working around the `AssetValidator` trait, and I'm not super strong with rust error handling / `anyhow` so any feedback would be appreciated.

Now outputs something like

```
(a bunch of metadata spam)

UnFlock
  DescriptionWithFormatting

taipo
  DescriptionTooLong
  ImageInvalidLink

Error: 2 asset(s) are invalid.
```

The change to `lib.rs` is much smaller than it looks. It consists of:
- removing a level of indentation by exiting early
- allowing `fs::read_dir` to potentially fail rather than hiding it behind `is_dir`
- removing the unwrap from `toml::from_str` in favor of `?`
Note the `max-height` style override to establish consistent "volume" with the other platinum sponsors.
Note the manual max-width override to match "area" with the other platinum sponsors.
Minor edit to emphasize the incredible speed difference :)
…ngine#471)

## Objective

Closes bevyengine#449 

## Solution

Add `.media-content` to the intro paragraphs.

## Before / After

<img width="531" alt="image" src="https://user-images.githubusercontent.com/200550/197818966-9a983324-d305-4493-9c06-d958194f7119.png">
@TrialDragon TrialDragon force-pushed the sync-new-book-to-main branch from 474a5cf to 8d5ba88 Compare January 18, 2024 09:18
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit-by-commit view looks great. Thank you!

@alice-i-cecile
Copy link
Member

Merging unilaterally: this is really valuable, janitorial and will get a final review or 7 before finally being shown to end users.

@alice-i-cecile alice-i-cecile merged commit 1436a2b into bevyengine:new-book Jan 20, 2024
7 checks passed
@TrialDragon TrialDragon deleted the sync-new-book-to-main branch January 20, 2024 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.