Commit graph

149 commits

Author SHA1 Message Date
Rob Parrett
9e8de2aa94
Slightly better message when contributor modifies examples template (#9372)
# Objective

Provide a slightly better message when a contributor needs to update the
generated example readme file for [any number of
reasons](https://github.com/bevyengine/bevy/pull/9372#discussion_r1285876202)
but hasn't added any examples.

This recently happened here:
https://github.com/bevyengine/bevy/pull/9370#issuecomment-1666776092

The contributor modified the readme template and is being told that they
added an example.

## Solution

The advice given is still correct. Just change the message so that it's
not accusing the contributor of adding an example.

It may be possible to instead add more specific messages instead if
someone is motivated to do that.

edit: reworked this whole PR text

---------

Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
2023-08-07 23:08:19 +00:00
François
31f40d5faf
only check for bans if the dependency tree changed (#9252)
# Objective

- CI job `check-bans` fails often for unrelated reasons to a PR. Reduce
those failures

## Solution

- Currently, the job only runs if a `Cargo.toml` file changed. This PR
would run the job only if the output of `cargo tree --depth 3` is
different in a PR from main. the job would still always run on main
2023-07-24 21:41:56 +00:00
François
71842c5ac9
Webgpu support (#8336)
# Objective

- Support WebGPU
- alternative to #5027 that doesn't need any async / await
- fixes #8315 
- Surprise fix #7318

## Solution

### For async renderer initialisation 

- Update the plugin lifecycle:
  - app builds the plugin
    - calls `plugin.build`
    - registers the plugin
  - app starts the event loop
- event loop waits for `ready` of all registered plugins in the same
order
    - returns `true` by default
- then call all `finish` then all `cleanup` in the same order as
registered
  - then execute the schedule

In the case of the renderer, to avoid anything async:
- building the renderer plugin creates a detached task that will send
back the initialised renderer through a mutex in a resource
- `ready` will wait for the renderer to be present in the resource
- `finish` will take that renderer and place it in the expected
resources by other plugins
- other plugins (that expect the renderer to be available) `finish` are
called and they are able to set up their pipelines
- `cleanup` is called, only custom one is still for pipeline rendering

### For WebGPU support

- update the `build-wasm-example` script to support passing `--api
webgpu` that will build the example with WebGPU support
- feature for webgl2 was always enabled when building for wasm. it's now
in the default feature list and enabled on all platforms, so check for
this feature must also check that the target_arch is `wasm32`

---

## Migration Guide

- `Plugin::setup` has been renamed `Plugin::cleanup`
- `Plugin::finish` has been added, and plugins adding pipelines should
do it in this function instead of `Plugin::build`
```rust
// Before
impl Plugin for MyPlugin {
    fn build(&self, app: &mut App) {
        app.insert_resource::<MyResource>
            .add_systems(Update, my_system);

        let render_app = match app.get_sub_app_mut(RenderApp) {
            Ok(render_app) => render_app,
            Err(_) => return,
        };

        render_app
            .init_resource::<RenderResourceNeedingDevice>()
            .init_resource::<OtherRenderResource>();
    }
}

// After
impl Plugin for MyPlugin {
    fn build(&self, app: &mut App) {
        app.insert_resource::<MyResource>
            .add_systems(Update, my_system);
    
        let render_app = match app.get_sub_app_mut(RenderApp) {
            Ok(render_app) => render_app,
            Err(_) => return,
        };
    
        render_app
            .init_resource::<OtherRenderResource>();
    }

    fn finish(&self, app: &mut App) {
        let render_app = match app.get_sub_app_mut(RenderApp) {
            Ok(render_app) => render_app,
            Err(_) => return,
        };
    
        render_app
            .init_resource::<RenderResourceNeedingDevice>();
    }
}
```
2023-05-04 22:07:57 +00:00
François
8070c29c21
Take example screenshots in CI (#8488)
# Objective

- I want to take screenshots of examples in CI to help with validation
of changes

## Solution

- Can override how much time is updated per frame
- Can specify on which frame to take a screenshots
- Save screenshots in CI

I reused the `TimeUpdateStrategy::ManualDuration` to be able to set the
time update strategy to a fixed duration every frame. Its previous
meaning didn't make much sense to me. This change makes it possible to
have screenshots that are exactly the same across runs.

If this gets merged, I'll add visual comparison of screenshots between
runs to ensure nothing gets broken

## Migration Guide

* `TimeUpdateStrategy::ManualDuration` meaning has changed. Instead of
setting time to `Instant::now()` plus the given duration, it sets time
to last update plus the given duration.
2023-05-01 18:00:01 +00:00
François
37ad73d8fc
CI: comment on PR when missing feature/example update (#8222)
# Objective

- I noticed in a PR that this message wasn't sent when it should have
- it was set to watch the status of the wrong step, fix it
2023-04-21 22:42:33 +00:00
dependabot[bot]
be0ca7f168
Bump peter-evans/create-pull-request from 4 to 5 (#8343)
Bumps
[peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request)
from 4 to 5.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/peter-evans/create-pull-request/releases">peter-evans/create-pull-request's
releases</a>.</em></p>
<blockquote>
<h2>Create Pull Request v5.0.0</h2>
<h2>Behaviour changes</h2>
<ul>
<li>The action will no longer leave the local repository checked out on
the pull request <code>branch</code>. Instead, it will leave the
repository checked out on the branch or commit that it was when the
action started.</li>
<li>When using <code>add-paths</code>, uncommitted changes will no
longer be destroyed. They will be stashed and restored at the end of the
action run.</li>
</ul>
<h2>What's new</h2>
<ul>
<li>Adds input <code>body-path</code>, the path to a file containing the
pull request body.</li>
<li>At the end of the action run the local repository is now checked out
on the branch or commit that it was when the action started.</li>
<li>Any uncommitted tracked or untracked changes are now stashed and
restored at the end of the action run. Currently, this can only occur
when using the <code>add-paths</code> input, which allows for changes to
not be committed. Previously, any uncommitted changes would be
destroyed.</li>
<li>The proxy implementation has been revised but is not expected to
have any change in behaviour. It continues to support the standard
environment variables <code>http_proxy</code>, <code>https_proxy</code>
and <code>no_proxy</code>.</li>
<li>Now sets the git <code>safe.directory</code> configuration for the
local repository path. The configuration is removed when the action
completes. Fixes issue <a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1170">peter-evans/create-pull-request#1170</a>.</li>
<li>Now determines the git directory path using the <code>git rev-parse
--git-dir</code> command. This allows users with custom repository
configurations to use the action.</li>
<li>Improved handling of the <code>team-reviewers</code> input and
associated errors.</li>
</ul>
<h2>News</h2>
<p>🏆 create-pull-request won <a
href="https://twitter.com/peterevans0/status/1638463617686470657?s=20">an
award</a> for &quot;awesome action&quot; at the Open Source Awards at
GitHub Universe. Thank you for your support and for making
create-pull-request one of the top used actions. Please give it a
, or even <a href="https://github.com/sponsors/peter-evans">buy me
a coffee</a>.</p>
<h2>What's Changed</h2>
<ul>
<li>v5 by <a
href="https://github.com/peter-evans"><code>@​peter-evans</code></a> in
<a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/1792">peter-evans/create-pull-request#1792</a></li>
<li>15 dependency updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/peter-evans/create-pull-request/compare/v4.2.4...v5.0.0">https://github.com/peter-evans/create-pull-request/compare/v4.2.4...v5.0.0</a></p>
<h2>Create Pull Request v4.2.4</h2>
<p>⚙️ Patches some recent security vulnerabilities.</p>
<h2>What's Changed</h2>
<ul>
<li>Update concepts-guidelines.md by <a
href="https://github.com/chrisbruford"><code>@​chrisbruford</code></a>
in <a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/1610">peter-evans/create-pull-request#1610</a></li>
<li>58 dependency updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/chrisbruford"><code>@​chrisbruford</code></a>
made their first contribution in <a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/1610">peter-evans/create-pull-request#1610</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/peter-evans/create-pull-request/compare/v4.2.3...v4.2.4">https://github.com/peter-evans/create-pull-request/compare/v4.2.3...v4.2.4</a></p>
<h2>Create Pull Request v4.2.3</h2>
<h2>What's Changed</h2>
<ul>
<li>fix: add check for missing token input by <a
href="https://github.com/peter-evans"><code>@​peter-evans</code></a> in
<a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/1324">peter-evans/create-pull-request#1324</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/peter-evans/create-pull-request/compare/v4.2.2...v4.2.3">https://github.com/peter-evans/create-pull-request/compare/v4.2.2...v4.2.3</a></p>
<h2>Create Pull Request v4.2.2</h2>
<h2>What's Changed</h2>
<ul>
<li>fix: support github server url for pushing to fork by <a
href="https://github.com/peter-evans"><code>@​peter-evans</code></a> in
<a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/1318">peter-evans/create-pull-request#1318</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5b4a9f6a9e"><code>5b4a9f6</code></a>
v5 (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1792">#1792</a>)</li>
<li><a
href="1847e5d1d6"><code>1847e5d</code></a>
build(deps-dev): bump eslint from 8.36.0 to 8.37.0 (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1803">#1803</a>)</li>
<li><a
href="c246f7e912"><code>c246f7e</code></a>
build(deps-dev): bump <code>@​typescript-eslint/parser</code> from
5.57.0 to 5.57.1 (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1801">#1801</a>)</li>
<li><a
href="2dd2b11b09"><code>2dd2b11</code></a>
build(deps-dev): bump eslint-import-resolver-typescript (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1802">#1802</a>)</li>
<li><a
href="05d5a3c3f9"><code>05d5a3c</code></a>
build(deps-dev): bump <code>@​types/node</code> from 18.15.10 to
18.15.11 (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1800">#1800</a>)</li>
<li><a
href="21479f22fc"><code>21479f2</code></a>
build(deps-dev): bump ts-jest from 29.0.5 to 29.1.0 (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1799">#1799</a>)</li>
<li><a
href="36a56dac07"><code>36a56da</code></a>
build(deps-dev): bump <code>@​typescript-eslint/parser</code> from
5.56.0 to 5.57.0 (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1768">#1768</a>)</li>
<li><a
href="b7f0c9773b"><code>b7f0c97</code></a>
build(deps-dev): bump prettier from 2.8.6 to 2.8.7 (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1767">#1767</a>)</li>
<li><a
href="6a62596740"><code>6a62596</code></a>
build(deps): bump peter-evans/enable-pull-request-automerge from 2 to 3
(<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1766">#1766</a>)</li>
<li><a
href="d1ed29fe1e"><code>d1ed29f</code></a>
build(deps-dev): bump <code>@​types/node</code> from 18.15.5 to 18.15.10
(<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/1765">#1765</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/peter-evans/create-pull-request/compare/v4...v5">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=peter-evans/create-pull-request&package-manager=github_actions&previous-version=4&new-version=5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-10 07:47:39 +00:00
François
21dc3abe1b
daily job running mobile example on real devices (#8216)
# Objective

- Test mobile example on real devices

## Solution

- Use [BrowserStack](https://www.browserstack.com) to have access to
[real
devices](https://www.browserstack.com/list-of-browsers-and-platforms/app_automate)
- [App Automate](https://www.browserstack.com/app-automate) to run the
example
- [App Percy](https://www.browserstack.com/app-percy) to compare the
screenshot
- Added a daily/manual CI job that will build for iOS and Android, send
the apps to BrowserStack, run the app on one iOS device and one Android
device, capture a screenshot, send it for visual validation, and archive
it in the GitHub action

Example run: https://github.com/mockersf/bevy/actions/runs/4521883534

They currently have a bug with the settings to view snapshots, they
should be public. I'll raise it to them, and if they don't fix it in
time it's possible to work around for everyone to view the results
through their API.

@cart to get this to work, you'll need
- to set up an account on BrowserStack
- add the secrets `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY`
to the Bevy repo
- create a project in Percy
- add the secret `PERCY_TOKEN` to the Bevy repo and modify the project
name line 122 in the `Daily.yml` file
2023-03-28 23:16:07 +00:00
François
cd06fad441
remove bors and small CI improvements (#7947) 2023-03-07 21:42:53 +00:00
Carter Anderson
c09a9f0c73
Only run validation jobs in Merge Queues (#7937)
Co-authored-by: François <mockersf@gmail.com>
2023-03-07 01:37:33 +00:00
Carter Anderson
5b25c803a1
Move merge_group to top (#7924) 2023-03-06 06:08:21 +00:00
Carter Anderson
2d38431ac6
Reorder merge group and remove branch filter (#7923) 2023-03-06 05:31:02 +00:00
Carter Anderson
6c1e3b9472
Specify merge queue branches (#7922) 2023-03-06 05:19:33 +00:00
Carter Anderson
a27b14e7d5
Enable CI and validation jobs for merge queues (#7921) 2023-03-06 05:12:20 +00:00
François
261905f11d Feature documentation (#7814)
# Objective

- Fixes #1800, fixes #6984
- Alternative to #7196
- Ensure feature list is always up to date and that all are documented
- Help discovery of features

## Solution

- Use a template to update the cargo feature list
- Use the comment just above the feature declaration as the description
- Add the checks to CI
- Add the features to the base crate doc
2023-02-28 14:24:47 +00:00
JMS55
db2fd92385 Make ktx2 and zstd default features (#7696)
# Objective
- Environment maps use these formats, and in the future rendering LUTs will need textures loaded by default in the engine

## Solution

- Make ktx2 and zstd part of the default feature
- Let examples assume these features are enabled

---

## Changelog
- `ktx2` and `zstd` are now party of bevy's default enabled features

## Migration Guide

- If you used the `ktx2` or `zstd` features, you no longer need to explicitly enable them, as they are now part of bevy's default enabled features
2023-02-17 01:00:07 +00:00
JMS55
dd4299bcf9 EnvironmentMapLight, BRDF Improvements (#7051)
(Before)
![image](https://user-images.githubusercontent.com/47158642/213946111-15ec758f-1f1d-443c-b196-1fdcd4ae49da.png)
(After)
![image](https://user-images.githubusercontent.com/47158642/217051179-67381e73-dd44-461b-a2c7-87b0440ef8de.png)
![image](https://user-images.githubusercontent.com/47158642/212492404-524e4ad3-7837-4ed4-8b20-2abc276aa8e8.png)

# Objective
- Improve lighting; especially reflections.
- Closes https://github.com/bevyengine/bevy/issues/4581.

## Solution
- Implement environment maps, providing better ambient light.
- Add microfacet multibounce approximation for specular highlights from Filament.
- Occlusion is no longer incorrectly applied to direct lighting. It now only applies to diffuse indirect light. Unsure if it's also supposed to apply to specular indirect light - the glTF specification just says "indirect light". In the case of ambient occlusion, for instance, that's usually only calculated as diffuse though. For now, I'm choosing to apply this just to indirect diffuse light, and not specular.
- Modified the PBR example to use an environment map, and have labels.
- Added `FallbackImageCubemap`.

## Implementation
- IBL technique references can be found in environment_map.wgsl.
- It's more accurate to use a LUT for the scale/bias. Filament has a good reference on generating this LUT. For now, I just used an analytic approximation.
 - For now, environment maps must first be prefiltered outside of bevy using a 3rd party tool. See the `EnvironmentMap` documentation.
- Eventually, we should have our own prefiltering code, so that we can have dynamically changing environment maps, as well as let users drop in an HDR image and use asset preprocessing to create the needed textures using only bevy. 

---

## Changelog
- Added an `EnvironmentMapLight` camera component that adds additional ambient light to a scene.
- StandardMaterials will now appear brighter and more saturated at high roughness, due to internal material changes. This is more physically correct.
- Fixed StandardMaterial occlusion being incorrectly applied to direct lighting.
- Added `FallbackImageCubemap`.

Co-authored-by: IceSentry <c.giguere42@gmail.com>
Co-authored-by: James Liu <contact@jamessliu.com>
Co-authored-by: Rob Parrett <robparrett@gmail.com>
2023-02-09 16:46:32 +00:00
François
0cbb9f72bd msrv: only send a message on failure during the actual msrv part (#7532)
# Objective

- In case of a CI failure before the MSRV check, like installing linux dependencies, a comment was still added to the PR

## Solution

- Check that the actual MSRV step failed
2023-02-06 22:14:39 +00:00
François
7e0a9bfade IOS, Android... same thing (#7493)
# Objective

- Merge the examples on iOS and Android
- Make sure they both work from the same code

## Solution

- don't create window when not in an active state (from #6830)
- exit on suspend on Android (from #6830)
- automatically enable dependency feature of bevy_audio on android so that it works out of the box
- don't inverse y position of touch events
- reuse the same example for both Android and iOS

Fixes #4616
Fixes #4103
Fixes #3648
Fixes #3458
Fixes #3249
Fixes #86
2023-02-06 18:08:49 +00:00
François
386763ecda add an action to ask for a migration guide when one is missing (#7507)
# Objective

- Help ensure migration guide are present for breaking changes

## Solution

- Add an action that adds a comment when it's missing


<img width="918" alt="Screenshot 2023-02-05 at 03 06 13" src="https://user-images.githubusercontent.com/8672791/216797861-3cbde59a-6e21-464a-9b83-a28a2474d111.png">
2023-02-05 14:21:44 +00:00
MinerSebas
e03982583d Resolve Warnings in Action Summary (#7473)
# Objective

- The CI Summary shows several fixable Warnings.
Example from https://github.com/bevyengine/bevy/actions/runs/4075078887:
![Screenshot_20230202_152644](https://user-images.githubusercontent.com/66798382/216352644-62e9664b-c881-4bc5-9a80-694cef25df76.png)

- The Job `check-compiles` provided an invalid input.
- The Job `check-doc` uses an outdated Version of `actions/cache`.

## Solution

- Remove the invalid `override` input.
- Update `actions/cache@v2` to `actions/cache@v3`.
2023-02-02 16:40:42 +00:00
François
69fc8c6b70 add timeouts to CI jobs (#7453)
# Objective

- Avoid hitting the 6 hours default timeout
- Waiting for 6 hours for a job to fail is wasteful and slow down CI for other PRs

## Solution

- Put shorter timeouts on all jobs
2023-02-01 15:08:31 +00:00
Rob Parrett
ca2d91e7ab Fix CI welcome message (#7428)
# Objective

Fixes #7424

## Solution

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
> By default, a workflow only runs when a pull_request_target event's activity type is opened, synchronize, or reopened.

Specify `opened` so that this only runs when a PR is opened

While I was in there, I fixed a couple other issues:
- extra indentation that was causing the welcome message to be put in a code block.
- broken relative link in message (was resolving to <https://github.com/bevyengine/bevy/pull/CONTRIBUTING.md>)
- fixed a few other minor typos in the message

cc @mockersf
2023-01-30 20:21:06 +00:00
François
daa45ebb4d remove spancmp (#7409)
# Objective

- This tool get less use than I hoped, as we gained more proficiency with other tracing tools like tracy

## Solution

- Remove it
2023-01-30 05:50:28 +00:00
François
1e591bf7a5 Fix ci error comments (#7416)
# Objective

- Fix a few errors on the workflow for leaving comments after ci failures
2023-01-29 23:05:33 +00:00
François
9d52aaede3 Make CI friendlier (#7398)
# Objective

- Make CI friendlier

## Solution

- CI now says hello to new contributor
- for some jobs with non obvious solutions to failures, give more context
  - example run should say which example failed
  - example doc should say the next action to do (add metadata or run the update script)
  - MSRV will say when it needs updating

I'm not completely sure everything is working and will try to trigger failures in this PR
2023-01-29 17:16:29 +00:00
François
7df680bb0a add rust-version for MSRV and CI job to check (#6852)
# Objective

- Fixes #6777, fixes #2998, replaces #5518
- Help avoid confusing error message when using an older version of Rust

## Solution

- Add the `rust-version` field to `Cargo.toml`
- Add a CI job checking the MSRV
- Add the job to bors
2023-01-09 21:19:48 +00:00
Gino Valente
f8a229b0c9 bevy_reflect: Add compile fail tests for bevy_reflect (#7041)
# Objective

There isn't really a way to test that code using bevy_reflect compiles or doesn't compile for certain scenarios. This would be especially useful for macro-centric PRs like #6511 and #6042.

## Solution

Using `bevy_ecs_compile_fail_tests` as reference, added the `bevy_reflect_compile_fail_tests` crate.

Currently, this crate contains a very simple test case. This is so that we can get the basic foundation of this crate agreed upon and merged so that more tests can be added by other PRs.

### Open Questions

- [x] Should this be added to CI? (Answer: Yes)

---

## Changelog

- Added the `bevy_reflect_compile_fail_tests` crate for testing compilation errors
2023-01-02 21:07:33 +00:00
Mike
ea80aca7ca unpin miri (#6863)
# Objective

- https://github.com/rust-lang/miri/pull/2713 was merged into miri. See if this fixes miri for bevy.
2022-12-11 18:22:11 +00:00
Olivia Crain
b58ca8721a ci: Use Ubuntu 22.04 runner for run-examples, run-examples-on-wasm jobs (#6875)
# Objective

- The `run-examples-on-wasm` job fails on Ubuntu 22.04, when it was previously working on Ubuntu 20.04. Playwright 1.22.1 (the version currently pinned by us) fails trying to install system dependencies that were renamed between Ubuntu 20.04 and 22.04.
- The `run-examples` job previously failed on Ubuntu 22.04 with errors consistent with those listed in [this upstream mesa bug](https://gitlab.freedesktop.org/mesa/mesa/-/issues/7819).
- Fixes #6832

## Solution

- Upgrade `playwright` to the latest [v1.28.1](https://github.com/microsoft/playwright/releases/tag/v1.28.1) release. Ubuntu 22.04 support was [added](https://github.com/microsoft/playwright/pull/14588) in [v1.23.0](https://github.com/microsoft/playwright/releases/tag/v1.23.0). The [test now passes on 22.04](https://github.com/oliviacrain/bevy/actions/runs/3633583112/jobs/6130757397), and the output screenshots are unchanged from previous job outputs.
- Use `ubuntu-latest` for the `run-examples` job. No other modifications necessary. The [PPA we pull mesa from](https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers) rebuilt the package for 22.04 with the [upstream fix](https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20145/diffs?commit_id=b3d1ae19f2f4d93cf0a5f45a598149ac4e8e05aa).
2022-12-08 20:05:27 +00:00
Mike
8faa12c5d6 pin nightly to 2022-11-28 to fix miri (#6808)
# Objective

- pin nightly to 2022-11-28 to fix miri
2022-12-01 01:30:55 +00:00
Mike
0e9c6dddb2 try to fix run-examples (#6810)
# Objective

- run examples is failing with `xvfb-run: error: Xvfb failed to start`

## Solution

- rollback ubuntu version for run-examples to 20.04. latest is 22.04

## Notes

- this is just a quick fix and someone should probably get it working on 22.04. I'll make an issue for that if this gets merged.
2022-12-01 00:27:54 +00:00
François
056272413f Move Android example to its own package (#6759)
# Objective

- Fix CI issue with updated `cargo-app`

## Solution

- Move the Android example to its own package. It's not necessary for the CI fix, but it's cleaner, mimic the iOS example, and easier to reuse for someone wanting to setup android support in their project
- Build the package in CI instead of the example


The Android example is still working on my android device with this change 👍
2022-11-25 23:02:56 +00:00
François
89b3422f62 migrate away from actions-rs actions to dtolnay/rust-toolchain (#6432)
# Objective

- actions from actions-rs are outdated and use deprecated function
- They haven't been updated for the last two years (https://github.com/actions-rs/toolchain)

## Solution

- use the newer and up-to-date https://github.com/dtolnay/rust-toolchain
2022-10-31 17:36:23 +00:00
François
64a8485a11 Disabling default features support in bevy_ecs, bevy_reflect and bevy (#5993)
# Objective

- Fix disabling features in bevy_ecs (broken by #5630)
- Add tests in CI for bevy_ecs, bevy_reflect and bevy as those crates could be use standalone
2022-10-24 13:46:39 +00:00
Rob Parrett
847c26b8dc Rename shapes examples for consistency (#6082)
# Objective

I was about to submit a PR to add these two examples to `bevy-website` and re-discovered the inconsistency.

Although it's not a major issue on the website where only the filenames are shown, this would help to visually distinguish the two examples in the list  because the names are very prominent.

This also helps out when fuzzy-searching the codebase for these files.

## Solution

Rename `shapes` to `2d_shapes`. Now the filename matches the example name, and the naming structure matches the 3d example.

## Notes

@Nilirad proposed this in https://github.com/bevyengine/bevy/pull/4613#discussion_r862455631 but it had slipped away from my brain at that time.
2022-09-25 00:57:07 +00:00
TimJentzsch
d1e5c50761 Use latest stable version for CI 'build' job (#5672)
# Objective

Fixes #5668.

The Rust version used in the CI `build` step previously depended on the default Rust version defined by GitHub in the Ubuntu image: <https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md#rust-tools>

This currently doesn't allow us to use Rust 1.63 features until this version is updated.

## Solution

We now use the `actions-rs/toolchain@v1` action to always use the latest stable Rust version.
This is already used for other CI jobs that we have.
2022-08-13 15:44:35 +00:00
François
eed6843e84 remove disable-weak-memory-emulation (#5469)
# Objective

- Fixes #5164
- Remove `miri-disable-weak-memory-emulation`
- Issue has been fixed in dependency
2022-07-27 16:51:03 +00:00
François
3561b38e4d set ndk env variable (#5465)
# Objective

- Fixes #5463
- set ANDROID_NDK_ROOT
- GitHub recently updated their ubuntu container, removing some of the android environment variable: ca5d04c7da
- `cargo-apk` is not reading the new environment variable: 9a8be258a9/ndk-build/src/ndk.rs (L33-L38)
- this also means CI will now use the latest android NDK, I don't know if that's an issue
2022-07-27 06:35:04 +00:00
François
35f99a6ccc unpin nightly in CI (#5385)
# Objective

- Nightly was pinned after a Rust regression
- Rust regression has been fixed

## Solution

- Unpin nightly
2022-07-20 13:58:03 +00:00
François
d65e01b768 windows CI: use exact same command to prebuild (#5352)
# Objective

- Running examples on windows crash due to full disk
- The prebuild step was not being reused and consuming extra space

## Solution

- Use the exact same command to prebuild to ensure it will be reused
- Also on linux
2022-07-17 14:43:35 +00:00
François
e0a8087408 remove nightly from CI/bors (#5333)
# Objective

- After a few recent failures, nightly in CI seems too costly to keep

## Solution

- remove from CI/bors
2022-07-16 00:07:08 +00:00
François
c8aa047cca Parameterize nightly toolchain in CI (#5330)
# Objective

Rust's nightly builds semi-regularly break us (or our dependencies). This creates churn and angst when we're just trying to get our jobs done.

We do still want nightly builds for a variety of reasons:

* cargo-udeps requires nightly and likely always will.
* Helps us catch rust nightly bugs quickly. We're "good citizens" if we regularly report regressions.
* Lets us prepare for "actual expected breakage" ahead of stable releases so we avoid breaking main users.

## Solution

* This pr parameterizes the nightly toolchain, making it an easy one-liner to pin our builds to a specific nightly, when required.
* Put nightly jobs to check wasm and nightly on their own matrix. I also removed tests on nightly linux, just build check
* alternative to https://github.com/bevyengine/bevy/pull/5329

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-07-15 22:37:07 +00:00
François
814f8d1635 update wgpu to 0.13 (#5168)
# Objective

- Update wgpu to 0.13
- ~~Wait, is wgpu 0.13 released? No, but I had most of the changes already ready since playing with webgpu~~ well it has been released now
- Also update parking_lot to 0.12 and naga to 0.9

## Solution

- Update syntax for wgsl shaders https://github.com/gfx-rs/wgpu/blob/master/CHANGELOG.md#wgsl-syntax
- Add a few options, remove some references: https://github.com/gfx-rs/wgpu/blob/master/CHANGELOG.md#other-breaking-changes
- fragment inputs should now exactly match vertex outputs for locations, so I added exports for those to be able to reuse them https://github.com/gfx-rs/wgpu/pull/2704
2022-07-14 21:17:16 +00:00
Alice Cecile
2db1611775 Add troubleshooting command to miri docs (#5116)
# Objective

When `miri` runs in our build system to detect unsoundness, its output can be very unhelpful, as the tests are all run in parallel.

## Solution

Add a comment documenting the extremely obvious 10/10 command used by @BoxyUwU in #4959.

I've stuck this in the CI file, as it seems like the most obvious place to check when frustrated. I didn't put it  in CONTRIBUTING.md because this is an eldritch abomination and will never be useful to new contributors.
2022-07-06 00:11:24 +00:00
Thierry Berger
faa40bfc82 Fix markdownlint privileges complaint (#5216)
# Objective

Fixes an annoying error message in CI.

more info at https://github.com/github/super-linter/pull/2464

![image](https://user-images.githubusercontent.com/2290685/177364755-fe607c9c-615e-477c-8e91-d35aae07ab0b.png)
2022-07-05 15:49:11 +00:00
dependabot[bot]
c0f807ce38 Bump peter-evans/create-pull-request from 3 to 4 (#4940)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3 to 4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/peter-evans/create-pull-request/releases">peter-evans/create-pull-request's releases</a>.</em></p>
<blockquote>
<h2>Create Pull Request v4.0.0</h2>
<h2>Breaking changes</h2>
<ul>
<li>The <code>add-paths</code> input no longer accepts <code>-A</code> as a valid value. When committing all new and modified files the <code>add-paths</code> input should be omitted.</li>
<li>If using self-hosted runners or GitHub Enterprise Server, there are minimum requirements for <code>v4</code> to run. See &quot;What's new&quot; below for details.</li>
</ul>
<h2>What's new</h2>
<ul>
<li>Updated runtime to Node.js 16
<ul>
<li>The action now requires a minimum version of v2.285.0 for the <a href="https://github.com/actions/runner/releases/tag/v2.285.0">Actions Runner</a>.</li>
<li>If using GitHub Enterprise Server, the action requires <a href="https://docs.github.com/en/enterprise-server@3.4/admin/release-notes">GHES 3.4</a> or later.</li>
</ul>
</li>
</ul>
<h2>What's Changed</h2>
<ul>
<li>README.md: Add word &quot;permissions&quot; to part on GITHUB_TOKEN by <a href="https://github.com/hartwork"><code>@​hartwork</code></a> in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1082">peter-evans/create-pull-request#1082</a></li>
<li>docs: Document how to improve close-and-reopen user experience by <a href="https://github.com/hartwork"><code>@​hartwork</code></a> in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1084">peter-evans/create-pull-request#1084</a></li>
<li>README.md: Skip follow-up steps if there is no pull request by <a href="https://github.com/hartwork"><code>@​hartwork</code></a> in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1083">peter-evans/create-pull-request#1083</a></li>
<li>v4 by <a href="https://github.com/peter-evans"><code>@​peter-evans</code></a> in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1099">peter-evans/create-pull-request#1099</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/hartwork"><code>@​hartwork</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1082">peter-evans/create-pull-request#1082</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/peter-evans/create-pull-request/compare/v3.14.0...v4.0.0">https://github.com/peter-evans/create-pull-request/compare/v3.14.0...v4.0.0</a></p>
<h2>Create Pull Request v3.14.0</h2>
<p>This release reverts a commit made to bump the runtime to node 16. It inadvertently caused <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1077">an issue</a> for users on GitHub Enterprise. Apologies. 🙇‍♂️</p>
<h2>What's Changed</h2>
<ul>
<li>feat: revert update action runtime to node 16 by <a href="https://github.com/peter-evans"><code>@​peter-evans</code></a> <a href="18f7dc018c</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/peter-evans/create-pull-request/compare/v3.13.0...v3.14.0">https://github.com/peter-evans/create-pull-request/compare/v3.13.0...v3.14.0</a></p>
<h2>Create Pull Request v3.13.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Document that draft status changes are not reflected by <a href="https://github.com/willthames"><code>@​willthames</code></a> in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1064">peter-evans/create-pull-request#1064</a></li>
<li>fix: remove unused draft param from pull update by <a href="https://github.com/peter-evans"><code>@​peter-evans</code></a> in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1065">peter-evans/create-pull-request#1065</a></li>
<li>Update action runtime to node 16 by <a href="https://github.com/sibiraj-s"><code>@​sibiraj-s</code></a> in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1074">peter-evans/create-pull-request#1074</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/willthames"><code>@​willthames</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1064">peter-evans/create-pull-request#1064</a></li>
<li><a href="https://github.com/sibiraj-s"><code>@​sibiraj-s</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1074">peter-evans/create-pull-request#1074</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/peter-evans/create-pull-request/compare/v3.12.1...v3.13.0">https://github.com/peter-evans/create-pull-request/compare/v3.12.1...v3.13.0</a></p>
<h2>Create Pull Request v3.12.1</h2>
<h2>What's Changed</h2>
<ul>
<li>ci: remove workflow by <a href="https://github.com/peter-evans"><code>@​peter-evans</code></a> in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1046">peter-evans/create-pull-request#1046</a></li>
<li>fix: add '--' to checkout command to avoid ambiguity by <a href="https://github.com/kenji-miyake"><code>@​kenji-miyake</code></a> in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1051">peter-evans/create-pull-request#1051</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/kenji-miyake"><code>@​kenji-miyake</code></a> made their first contribution in <a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/pull/1051">peter-evans/create-pull-request#1051</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="923ad837f1"><code>923ad83</code></a> force tryFetch (<a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1189">#1189</a>)</li>
<li><a href="f094b77505"><code>f094b77</code></a> fix: avoid issue with case sensitivity of repo names (<a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1179">#1179</a>)</li>
<li><a href="af7c021bb9"><code>af7c021</code></a> docs: shorten quote</li>
<li><a href="97872c4843"><code>97872c4</code></a> docs: update GA quote/ref in concepts-guidelines.md (<a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1169">#1169</a>)</li>
<li><a href="bd72e1b792"><code>bd72e1b</code></a> fix: use full name for head branch to allow for repo renaming (<a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1164">#1164</a>)</li>
<li><a href="f1a7646cea"><code>f1a7646</code></a> build: update distribution (<a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1157">#1157</a>)</li>
<li><a href="15b68d176d"><code>15b68d1</code></a> fix: strip optional '.git' suffix from https server remote name. (<a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1153">#1153</a>)</li>
<li><a href="0dfc93c104"><code>0dfc93c</code></a> build(deps): bump peter-evans/create-pull-request from 3 to 4 (<a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1150">#1150</a>)</li>
<li><a href="252fb19db2"><code>252fb19</code></a> build(deps): bump peter-evans/slash-command-dispatch from 2 to 3 (<a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1122">#1122</a>)</li>
<li><a href="4b867c4939"><code>4b867c4</code></a> build(deps): bump actions/setup-node from 2 to 3 (<a href="https://github-redirect.dependabot.com/peter-evans/create-pull-request/issues/1123">#1123</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/peter-evans/create-pull-request/compare/v3...v4">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=peter-evans/create-pull-request&package-manager=github_actions&previous-version=3&new-version=4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
2022-07-04 13:04:13 +00:00
Alice Cecile
4c5e30a9f8 Re-enable check-unused-dependencies in CI (#5172)
# Objective

Fixes #5155. This *should* work now that the semver breaking dependency of the CI crate got yanked, but we'll see what CI has to say about it.
2022-07-02 00:55:52 +00:00
Boxy
a1a07945d6 fix some memory leaks detected by miri (#4959)
The first leak:
```rust
    #[test]
    fn blob_vec_drop_empty_capacity() {
        let item_layout = Layout:🆕:<Foo>();
        let drop = drop_ptr::<Foo>;
        let _ = unsafe { BlobVec::new(item_layout, Some(drop), 0) };
    }
```
this is because we allocate the swap scratch in blobvec regardless of what the capacity is, but we only deallocate if capacity is > 0

The second leak:
```rust
    #[test]
    fn panic_while_overwriting_component() {
        let helper = DropTestHelper::new();

        let res = panic::catch_unwind(|| {
            let mut world = World::new();
            world
                .spawn()
                .insert(helper.make_component(true, 0))
                .insert(helper.make_component(false, 1));

            println!("Done inserting! Dropping world...");
        });

        let drop_log = helper.finish(res);

        assert_eq!(
            &*drop_log,
            [
                DropLogItem::Create(0),
                DropLogItem::Create(1),
                DropLogItem::Drop(0),
            ]
        );
    }
```
this is caused by us not running the drop impl on the to-be-inserted component if the drop impl of the overwritten component panics

---

managed to figure out where the leaks were by using this 10/10 command
```
cargo --quiet test --lib -- --list | sed 's/: test$//' | MIRIFLAGS="-Zmiri-disable-isolation" xargs -n1 cargo miri test --lib -- --exact
```
which runs every test one by one rather than all at once which let miri actually tell me which test had the leak 🙃
2022-07-01 21:54:28 +00:00
François
8ba6be187d unpin nightly and disable weak memory emulation (#4988)
# Objective

- Follow suggestion from https://github.com/bevyengine/bevy/pull/4984#issuecomment-1152949640

## Solution

- Unpin nightly, disable weak memory emulation

---

This failed the miri job in my branch with the following error:
```
error: Undefined Behavior: attempting a read access using <untagged> at alloc198028[0x0], but that tag does not exist in the borrow stack for this location
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.12.0/src/imp_std.rs:177:28
    |
177 |                 let next = (*waiter).next;
    |                            ^^^^^^^^^^^^^^
    |                            |
    |                            attempting a read access using <untagged> at alloc198028[0x0], but that tag does not exist in the borrow stack for this location
    |                            this error occurs as part of an access at alloc198028[0x0..0x8]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
```

@BoxyUwU could you take a look? I guess it's related to the issue mentioned in https://github.com/rust-lang/miri/issues/2223
2022-07-01 13:19:39 +00:00
François
d4e4a92982 android - fix issues other than the rendering (#5130)
# Objective

- Make Bevy work on android

## Solution

- Update android metadata and add a few more
- Set the target sdk to 31 as it will soon (in august) be the minimum sdk level for play store
- Remove the custom code to create an activity and use ndk-glue macro instead
- Delay window creation event on android
- Set the example with compatibility settings for wgpu. Those are needed for Bevy to work on my 2019 android tablet
- Add a few details on how to debug in case of failures
- Fix running the example on emulator. This was failing because of the name of the example

Bevy still doesn't work on android with this, audio features need to be disabled because of an ndk-glue version mismatch: rodio depends on 0.6.2, winit on 0.5.2. You can test with:
```
cargo apk run --release --example android_example --no-default-features --features "bevy_winit,render"
```
2022-06-30 19:42:45 +00:00