Skip to content

Commit

Permalink
Merge branch 'main' into task-pool-consolidation
Browse files Browse the repository at this point in the history
  • Loading branch information
james7132 committed Apr 17, 2024
2 parents 274fe31 + cae07ef commit 207075e
Show file tree
Hide file tree
Showing 771 changed files with 43,086 additions and 15,391 deletions.
2 changes: 1 addition & 1 deletion .cargo/config_fast_builds.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rustflags = [
[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe" # Use LLD Linker
rustflags = [
"-Zshare-generics=n",
"-Zshare-generics=n", # (Nightly)
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]

Expand Down
4 changes: 1 addition & 3 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# These are supported funding model platforms

custom: https://bevyengine.org/community/donate/
custom: https://bevyengine.org/donate/
49 changes: 49 additions & 0 deletions .github/actions/install-linux-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This action installs a few dependencies necessary to build Bevy on Linux. By default it installs
# alsa and udev, but can be configured depending on which libraries are needed:
#
# ```
# - uses: ./.github/actions/install-linux-deps
# with:
# alsa: false
# wayland: true
# ```
#
# See the `inputs` section for all options and their defaults. Note that you must checkout the
# repository before you can use this action.
#
# This action will only install dependencies when the current operating system is Linux. It will do
# nothing on any other OS (MacOS, Windows).

name: Install Linux dependencies
description: Installs the dependencies necessary to build Bevy on Linux.
inputs:
alsa:
description: Install alsa (libasound2-dev)
required: false
default: true
udev:
description: Install udev (libudev-dev)
required: false
default: true
wayland:
description: Install Wayland (libwayland-dev)
required: false
default: false
xkb:
description: Install xkb (libxkbcommon-dev)
required: false
default: false
runs:
using: composite
steps:
- name: Install Linux dependencies
shell: bash
if: ${{ runner.os == 'linux' }}
run: >
sudo apt-get update
sudo apt-get install --no-install-recommends
${{ fromJSON(inputs.alsa) && 'libasound2-dev' || '' }}
${{ fromJSON(inputs.udev) && 'libudev-dev' || '' }}
${{ fromJSON(inputs.wayland) && 'libwayland-dev' || '' }}
${{ fromJSON(inputs.xkb) && 'libxkbcommon-dev' || '' }}
1 change: 1 addition & 0 deletions .github/contributing/engine_style_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For more advice on contributing to the engine, see the [relevant section](../../
4. Use \`variable_name\` code blocks in comments to signify that you're referring to specific types and variables.
5. Start comments with capital letters. End them with a period if they are sentence-like.
3. Use comments to organize long and complex stretches of code that can't sensibly be refactored into separate functions.
4. When using [Bevy error codes](https://bevyengine.org/learn/errors/) include a link to the relevant error on the Bevy website in the returned error message `... See: https://bevyengine.org/learn/errors/#b0003`.

## Rust API guidelines

Expand Down
154 changes: 117 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN: nightly

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: ${{github.event_name == 'pull_request'}}

jobs:
build:
strategy:
Expand All @@ -30,9 +34,8 @@ jobs:
target/
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
if: runner.os == 'linux'
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Build & run tests
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- test
Expand All @@ -57,14 +60,17 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
with:
wayland: true
xkb: true
- name: CI job
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- lints

miri:
runs-on: ubuntu-latest
runs-on: macos-14
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
Expand All @@ -81,8 +87,6 @@ jobs:
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
components: miri
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: CI job
# To run the tests one item at a time for troubleshooting, use
# cargo --quiet test --lib -- --list | sed 's/: test$//' | MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-permissive-provenance -Zmiri-disable-weak-memory-emulation" xargs -n1 cargo miri test -p bevy_ecs --lib -- --exact
Expand Down Expand Up @@ -116,8 +120,8 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Check Compile
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- compile
Expand All @@ -142,8 +146,31 @@ jobs:
target: wasm32-unknown-unknown
- name: Check wasm
run: cargo check --target wasm32-unknown-unknown

build-wasm-atomics:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-assets-cargo-build-wasm-nightly-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
targets: wasm32-unknown-unknown
components: rust-src
- name: Check wasm
run: cargo check --target wasm32-unknown-unknown -Z build-std=std,panic_abort
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
RUSTFLAGS: "-C target-feature=+atomics,+bulk-memory"

markdownlint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -183,40 +210,66 @@ jobs:
echo 'Or if you use VSCode, use the `Even Better Toml` extension with 2 spaces'
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml'
run-examples-on-windows-dx12:
runs-on: windows-latest
timeout-minutes: 60
typos:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@v1.20.8
- name: Typos info
if: failure()
run: |
echo 'To fix typos, please run `typos -w`'
echo 'To check for a diff, run `typos`'
echo 'You can find typos here: https://crates.io/crates/typos'
echo 'if you use VSCode, you can also install `Typos Spell Checker'
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode'
- uses: dtolnay/rust-toolchain@stable

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-windows-run-examples-${{ hashFiles('**/Cargo.toml') }}
run-examples-macos-metal:
runs-on: macos-14
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Disable audio
# Disable audio through a patch. on github m1 runners, audio timeouts after 15 minutes
run: git apply --ignore-whitespace tools/example-showcase/disable-audio.patch
- name: Build bevy
shell: bash
# this uses the same command as when running the example to ensure build is reused
run: |
WGPU_BACKEND=dx12 CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing"
TRACE_CHROME=trace-alien_cake_addict.json CI_TESTING_CONFIG=.github/example-run/alien_cake_addict.ron cargo build --example alien_cake_addict --features "bevy_ci_testing,trace,trace_chrome"
- name: Run examples
shell: bash
run: |
for example in .github/example-run/*.ron; do
example_name=`basename $example .ron`
echo -n $example_name > last_example_run
echo "running $example_name - "`date`
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing"
time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome"
sleep 10
if [ `find ./ -maxdepth 1 -name 'screenshot-*.png' -print -quit` ]; then
mkdir screenshots-$example_name
mv screenshot-*.png screenshots-$example_name/
fi
done
mkdir traces && mv trace*.json traces/
mkdir screenshots && mv screenshots-* screenshots/
- name: save traces
uses: actions/upload-artifact@v4
with:
name: example-traces-macos
path: traces
- name: save screenshots
uses: actions/upload-artifact@v4
with:
name: screenshots-macos
path: screenshots
- uses: actions/upload-artifact@v4
if: ${{ failure() && github.event_name == 'pull_request' }}
with:
name: example-run-macos
path: example-run/

check-doc:
runs-on: ubuntu-latest
Expand All @@ -233,9 +286,11 @@ jobs:
target/
key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
if: runner.os == 'linux'
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
with:
wayland: true
xkb: true
- name: Build and check doc
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- doc
Expand Down Expand Up @@ -339,8 +394,8 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- name: Run cargo check
id: check
run: cargo check
Expand Down Expand Up @@ -375,4 +430,29 @@ jobs:
echo " Fix the issue by replacing 'bevy_internal' with 'bevy'"
echo " Example: 'use bevy::sprite::MaterialMesh2dBundle;' instead of 'bevy_internal::sprite::MaterialMesh2dBundle;'"
exit 1
fi
fi
check-cfg:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
with:
wayland: true
xkb: true
- name: Build and check cfg typos
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- cfg-check
4 changes: 4 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
branches:
- main

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: ${{github.event_name == 'pull_request'}}

env:
CARGO_TERM_COLOR: always

Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
push:
branches:
- 'main'

# Allows running the action manually.
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: --html-in-header header.html
NIGHTLY_TOOLCHAIN: nightly

# Sets the permissions to allow deploying to Github pages.
permissions:
Expand All @@ -33,11 +33,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}

- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
with:
wayland: true
xkb: true

# This does the following:
# - Replaces the docs icon with one that clearly denotes it's not the released package on crates.io
Expand All @@ -48,7 +52,10 @@ jobs:
echo "<meta name=\"robots\" content=\"noindex\">" > header.html
- name: Build docs
run: cargo doc --all-features --no-deps -p bevy
env:
# needs to be in sync with [package.metadata.docs.rs]
RUSTDOCFLAGS: -Zunstable-options --cfg=docsrs
run: cargo doc --all-features --no-deps -p bevy -Zunstable-options -Zrustdoc-scrape-examples

# This adds the following:
# - A top level redirect to the bevy crate documentation
Expand Down

0 comments on commit 207075e

Please sign in to comment.