Skip to content

Commit

Permalink
feat: complete plugin re-write
Browse files Browse the repository at this point in the history
  • Loading branch information
makspll committed Jan 5, 2025
1 parent c7cd061 commit bbfda42
Show file tree
Hide file tree
Showing 301 changed files with 43,256 additions and 45,692 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[env]
TARGET_DIR = { value = "target", relative = true }

[alias]
xtask = "run --package xtask --"
22 changes: 17 additions & 5 deletions .github/workflows/bevy_api_gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ on:
paths:
- "crates/bevy_api_gen/**"
- ".github/workflows/bevy_api_gen.yml"
- ".github/workflows/generate_bindings.yml"



name: Check and Lint - bevy_api_gen

env:
RUST_TOOLCHAIN: nightly-2024-12-15

jobs:
check:
name: Check - bevy_api_gen
Expand All @@ -25,7 +30,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-11-05
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
Expand All @@ -52,7 +57,7 @@ jobs:
with:
profile: minimal
components: rustfmt
toolchain: nightly-2024-11-05
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
Expand All @@ -75,7 +80,7 @@ jobs:
rm -rf crates
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2024-11-05
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: clippy
override: true
- name: Rust Cache
Expand All @@ -98,7 +103,7 @@ jobs:
rm -rf crates
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2024-11-05
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
Expand All @@ -120,7 +125,7 @@ jobs:
rm -rf crates
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2024-11-05
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
Expand All @@ -131,3 +136,10 @@ jobs:
with:
command: doc
args: --profile=ephemeral-build
bindings:
permissions:
contents: write
pull-requests: write
name: Generate Bindings - bevy_api_gen
uses: ./.github/workflows/generate_bindings.yml
secrets: inherit
114 changes: 16 additions & 98 deletions .github/workflows/bevy_mod_scripting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,93 +21,27 @@ concurrency:
cancel-in-progress: true

jobs:
check:
check:
permissions:
pull-requests: write
name: Check - ${{ matrix.run_args.label }}
runs-on: ${{ matrix.run_args.os }}
strategy:
matrix:
run_args: [
{label: Windows - All Features, os: windows-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: x86_64-pc-windows-msvc },
{label: MacOS - All Features, os: macOS-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: x86_64-apple-darwin },
{label: Ubuntu - All Features, os: ubuntu-latest, features: "lua54,lua_script_api,rhai,teal,rhai_script_api,rune", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu Aarch64 - All Features, os: ubuntu-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: aarch64-unknown-linux-gnu },
{label: Ubuntu - Lua51, os: ubuntu-latest, features: "lua51,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Lua52, os: ubuntu-latest, features: "lua52,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Lua53, os: ubuntu-latest, features: "lua53,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Luajit, os: ubuntu-latest, features: "luajit,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Luajit52, os: ubuntu-latest, features: "luajit52,lua_script_api", cross: x86_64-unknown-linux-gnu },
{label: Ubuntu - Luau, os: ubuntu-latest, features: "luau,lua_script_api", cross: x86_64-unknown-linux-gnu }

{label: Windows, os: windows-latest },
{label: MacOS, os: macOS-latest },
{label: Ubuntu, os: ubuntu-latest },
{label: Ubuntu Aarch64, os: ubuntu-latest }
]
steps:
- if: runner.os == 'linux'
name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- if: runner.os != 'windows'
name: Clear space
run: rm -rf /usr/share/dotnet; rm -rf /opt/ghc; rm -rf "/usr/local/share/boost"; rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: houseabsolute/actions-rust-cross@v0
with:
command: check
target: ${{ matrix.run_args.cross }}
args: --workspace --features=${{ matrix.run_args.features }} --profile=ephemeral-build

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rustfmt
toolchain: stable
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --features=lua54,rhai,teal,lua_script_api,rhai_script_api,rune --profile=ephemeral-build -- -D warnings
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Clear space
run: sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Checkout
uses: actions/checkout@v3
- 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'
run: |
sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -116,25 +50,9 @@ jobs:
uses: Swatinem/[email protected]
- uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --features=lua54,rhai,teal,lua_script_api,rhai_script_api,rune --profile=ephemeral-build
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Find docs.rs features
run: echo "DOCS_FEATURES=$(cargo metadata --no-deps | python -c "import sys,json; [print(','.join(x['metadata']['docs.rs']['features'])) for x in json.load(sys.stdin)['packages'] if x['name'] == 'bevy_mod_scripting']")" >> $GITHUB_OUTPUT
id: features
- uses: actions-rs/cargo@v1
command: xtask
args: ci-check
- uses: romeovs/[email protected]
continue-on-error: true
with:
command: doc
args: --workspace --features=${{ steps.features.outputs.DOCS_FEATURES }} --profile=ephemeral-build
lcov-file: ./target/coverage/lcov.info
60 changes: 0 additions & 60 deletions .github/workflows/doc_gen.yml

This file was deleted.

93 changes: 93 additions & 0 deletions .github/workflows/generate_bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Generate Bindings (Bevy, Glam)

on:
workflow_call:
# inputs:
# config-path:
# required: true
# type: string
# secrets:
# token:
# required: true
workflow_dispatch:

env:
RUST_TOOLCHAIN: nightly-2024-12-15
BEVY_API_GEN_PATH: ${{ github.workspace }}/crates/bevy_api_gen
BEVY_PATH: ${{ github.workspace }}/target/codegen/bevy
OUTPUT_PATH: ${{ github.workspace }}/crates/bevy_mod_scripting_functions/src/bevy_bindings/
BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded
BRANCH_NAME: __update-bevy-bindings-${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}

jobs:
generate_bindings:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bot GitHub Credentials
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rust-src, rustc-dev, llvm-tools-preview
override: true
- name: Install bevy_api_gen Binaries
run: cargo install --path ${{ env.BEVY_API_GEN_PATH }}
- name: read bevy workspace version
uses: SebRollen/[email protected]
id: read_toml
with:
file: 'Cargo.toml'
field: 'workspace.dependencies.bevy.version'
- name: Prepare Directories
run: |
mkdir -p ${{ env.OUTPUT_PATH }}
mkdir -p ${{ env.BEVY_PATH }}
- name: Clone Bevy
run: |
git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }}
cd ${{ env.BEVY_PATH }} && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }}
ls -la ${{ env.BEVY_PATH }}
- name: Generate Bevy Bindings
run: |
cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv
- name: Collect Bevy Bindings
run: |
ls -la ${{ env.BEVY_PATH }}
cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}'
- name: Prune Output
run: |
find ${{ env.OUTPUT_PATH }} -type f ! -name "*.rs" -delete
- name: Check for changes
id: check_changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes=true" >> "$GITHUB_OUTPUT";
fi
- name: Commit Changes
if: steps.check_changes.outputs.changes
run: |
git checkout -b ${{ env.BRANCH_NAME }} || git checkout ${{ env.BRANCH_NAME }}
git add -A
git commit -m "chore(codegen): update bevy bindings"
git push -u origin ${{ env.BRANCH_NAME }} --force
- uses: jwalton/gh-find-current-pr@master
if: steps.check_changes.outputs.changes
id: findPR
with:
state: all
- name: Create Or Update PR
if: steps.check_changes.outputs.changes && success() && steps.findPR.outputs.number
run: |
gh pr list --base feature/bevy-system-refactor --search "chore(codegen): update bevy bindings" --json number > prs.json
if [ $(jq '. | length' prs.json) -eq 0 ]; then
gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings for #${{ steps.findPR.outputs.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true
fi
Loading

0 comments on commit bbfda42

Please sign in to comment.