Skip to content

Commit

Permalink
move bevy examples to web crate
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Feb 23, 2024
1 parent 898462c commit 7f32cbc
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 265 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: Swatinem/rust-cache@v2
- run: nix build .#web
- uses: actions/configure-pages@v4
- uses: actions/upload-pages-artifact@v3
with:
path: "result/web"
- id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/assets/temp
/dist
/result
/target
14 changes: 12 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["bevy_gltf_kun", "gltf_kun"]
members = ["bevy_gltf_kun", "gltf_kun", "web"]

[workspace.package]
version = "0.0.6"
Expand Down
7 changes: 1 addition & 6 deletions bevy_gltf_kun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@ gltf_kun = { version = "0.0.6", path = "../gltf_kun" }
serde_json.workspace = true
thiserror.workspace = true

bevy_xpbd_3d = { version = "0.4.2", default-features = false, features = ["3d", "f32", "parry-f32", "debug-plugin", "parallel"], optional = true }

[dev-dependencies]
bevy = "0.13.0"
bevy_egui = "0.25.0"
bevy_panorbit_camera = "0.14.0"
bevy_xpbd_3d = { version = "0.4.2", optional = true }
230 changes: 0 additions & 230 deletions bevy_gltf_kun/examples/bevy_physics.rs

This file was deleted.

31 changes: 25 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@
[
binaryen
cargo-auditable
cargo-component
clang
cmake
nodePackages.prettier
pkg-config
protobuf
trunk
wasm-bindgen-cli
wasm-tools
Expand All @@ -78,6 +74,11 @@
cargoArtifacts =
craneLib.buildDepsOnly (commonArgs // { pname = "deps"; });

cargoArtifactsWasm = craneLib.buildDepsOnly (commonArgs // {
pname = "deps-wasm";
doCheck = false;
});

cargoClippy = craneLib.cargoClippy (commonArgs // {
inherit cargoArtifacts;
pname = "clippy";
Expand All @@ -91,22 +92,40 @@
bevy_gltf_kun = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
pname = "bevy_gltf_kun";
cargoExtraArgs = "-p bevy_gltf_kun";
});

gltf_kun = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
pname = "gltf_kun";
cargoExtraArgs = "-p gltf_kun";
});

web = craneLib.buildTrunkPackage (commonArgs // {
inherit cargoArtifactsWasm;
pname = "web";
cargoExtraArgs = "-p web --target wasm32-unknown-unknown";

src = lib.cleanSourceWith {
src = ./.;
filter = path: type:
(lib.hasSuffix ".html" path) || (lib.hasInfix "/assets/" path)
|| (craneLib.filterCargoSources path type);
};

wasm-bindgen-cli = pkgs.wasm-bindgen-cli;
});
in {
checks = { inherit gltf_kun bevy_gltf_kun cargoClippy cargoDoc; };
checks = { inherit gltf_kun bevy_gltf_kun web cargoClippy cargoDoc; };

packages = {
bevy_gltf_kun = bevy_gltf_kun;
gltf_kun = gltf_kun;
web = web;

default = pkgs.symlinkJoin {
name = "all";
paths = [ bevy_gltf_kun gltf_kun ];
paths = [ bevy_gltf_kun gltf_kun web ];
};
};

Expand Down
Loading

0 comments on commit 7f32cbc

Please sign in to comment.