Skip to content

Commit

Permalink
Add dependency graph (#1145)
Browse files Browse the repository at this point in the history
* Initial version

* Update condition

* Remove PR trigger

* Remove deps installation

* Update dependency graph for f3dfac8 (#1146)

* Print more info about changes

* Fix git diff call

* Update the condition again

* Update the condition again

* Test out of date .dot file

* Tweak

* Update dependency graph for eadca93 (#1147)

* Clean up

---------

Co-authored-by: Moose Jobs <[email protected]>
  • Loading branch information
pierd and moose-jobs authored Nov 8, 2023
1 parent f2c1069 commit a49904d
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/update-depgraph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Update depgraph
on:
workflow_dispatch: {}
push:
branches: ["main"]
paths-ignore:
- "docs/src/runtime_internals/dependency_graph.png"

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
DEPGRAPH_PATH: docs/src/runtime_internals/dependency_graph
# token for gh command (other operations use GITHUB_TOKEN env var)
# we are using bot here so that the PR created by it triggers all the regular CI checks
GH_TOKEN: ${{ secrets.MOOSE_JOBS_GH_TOKEN }}
BOT_NAME: "Moose Jobs"
BOT_EMAIL: ${{ secrets.MOOSE_JOBS_EMAIL }}

jobs:
depgraph:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: Leafwing-Studios/[email protected]
- uses: taiki-e/install-action@v2
with:
tool: cargo-depgraph
- run: |
cargo depgraph --workspace-only --root ambient --dedup-transitive-deps > ${{ env.DEPGRAPH_PATH }}.dot
# early exit if the graph has not changed
if git diff --exit-code ${{ env.DEPGRAPH_PATH }}.dot; then
echo "No changes to dependency graph"
exit 0
fi
# install graphviz to render the graph as PNG
sudo apt-get update
sudo apt-get install --no-install-recommends -y graphviz
# render
dot -Tpng ${{ env.DEPGRAPH_PATH }}.dot > ${{ env.DEPGRAPH_PATH }}.png
# commit
base_branch=${GITHUB_REF#refs/heads/}
branch=${base_branch}-depgraph-${{ github.sha }}
git config --global user.name "${{ env.BOT_NAME }}"
git config --global user.email "${{ env.BOT_EMAIL }}"
git checkout -b ${branch}
git commit -a -m "Update dependency graph for ${{ github.sha }}"
git push --set-upstream origin ${branch}
pr_url=$(gh pr create --title "Update dependency graph for ${{ github.sha }}" --body "Update dependency graph for ${{ github.sha }}" --base ${base_branch} --head ${branch})
gh pr merge --auto --squash --delete-branch ${pr_url}
159 changes: 159 additions & 0 deletions docs/src/runtime_internals/dependency_graph.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
digraph {
0 [ label = "ambient" shape = box]
1 [ label = "ambient_animation" shape = box]
2 [ label = "ambient_app" shape = box]
3 [ label = "ambient_audio" shape = box]
4 [ label = "ambient_build" shape = box]
5 [ label = "ambient_cameras" shape = box]
6 [ label = "ambient_client_shared" shape = box]
7 [ label = "ambient_cloud_client" shape = box]
8 [ label = "ambient_core" shape = box]
9 [ label = "ambient_debugger" shape = box]
10 [ label = "ambient_decals" shape = box]
11 [ label = "ambient_deploy" shape = box]
12 [ label = "ambient_ecs" shape = box]
13 [ label = "ambient_element" shape = box]
14 [ label = "ambient_git_rev_init" shape = box]
15 [ label = "ambient_gizmos" shape = box]
16 [ label = "ambient_model_import" shape = box]
17 [ label = "ambient_native_std" shape = box]
18 [ label = "ambient_network" shape = box]
19 [ label = "ambient_package" shape = box]
20 [ label = "ambient_package_semantic" shape = box]
21 [ label = "ambient_package_semantic_native" shape = box]
22 [ label = "ambient_physics" shape = box]
23 [ label = "ambient_prefab" shape = box]
24 [ label = "ambient_primitives" shape = box]
25 [ label = "ambient_rpc" shape = box]
26 [ label = "ambient_settings" shape = box]
27 [ label = "ambient_shared_types" shape = box]
28 [ label = "ambient_sky" shape = box]
29 [ label = "ambient_std" shape = box]
30 [ label = "ambient_sys" shape = box]
31 [ label = "ambient_ui_native" shape = box]
32 [ label = "ambient_water" shape = box]
33 [ label = "ambient_world_audio" shape = box]
34 [ label = "ambient_model" shape = box]
35 [ label = "ambient_focus" shape = box]
36 [ label = "ambient_gpu" shape = box]
37 [ label = "ambient_gpu_ecs" shape = box]
38 [ label = "ambient_input" shape = box]
39 [ label = "ambient_procedurals" shape = box]
40 [ label = "ambient_renderer" shape = box]
41 [ label = "ambient_asset_cache" shape = box]
42 [ label = "ambient_pipeline_types" shape = box]
43 [ label = "ambient_rustc" shape = box]
44 [ label = "ambient_unity_parser" shape = box]
45 [ label = "ambient_wasm" shape = box]
46 [ label = "ambient_ecs_editor" shape = box]
47 [ label = "ambient_layout" shape = box]
48 [ label = "ambient_meshes" shape = box]
49 [ label = "ambient_package_rt" shape = box]
50 [ label = "ambient_cb" shape = box]
51 [ label = "ambient_friendly_id" shape = box]
52 [ label = "ambient_guest_bridge" shape = box]
53 [ label = "ambient_git_rev" shape = box]
54 [ label = "physxx" shape = box]
55 [ label = "ambient_color" shape = box]
56 [ label = "ambient_math" shape = box]
57 [ label = "ambient_dirs" shape = box]
58 [ label = "ambient_schema" shape = box]
59 [ label = "ambient_rect" shape = box]
60 [ label = "ambient_text" shape = box]
61 [ label = "ambient_ui" shape = box]
62 [ label = "ambient_time" shape = box]
0 -> 4 [ ]
0 -> 6 [ ]
0 -> 7 [ ]
0 -> 11 [ ]
0 -> 14 [ ]
0 -> 23 [ ]
0 -> 32 [ ]
1 -> 34 [ ]
2 -> 1 [ ]
2 -> 5 [ ]
2 -> 35 [ ]
2 -> 15 [ ]
2 -> 39 [ ]
2 -> 31 [ ]
3 -> 31 [ ]
4 -> 10 [ ]
4 -> 16 [ ]
4 -> 43 [ ]
4 -> 44 [ ]
4 -> 45 [ ]
5 -> 13 [ ]
6 -> 9 [ ]
6 -> 46 [ ]
7 -> 17 [ ]
8 -> 37 [ ]
9 -> 18 [ ]
10 -> 40 [ ]
11 -> 17 [ ]
11 -> 19 [ ]
11 -> 29 [ ]
12 -> 17 [ ]
12 -> 49 [ ]
13 -> 52 [ ]
14 -> 53 [ ]
15 -> 40 [ ]
16 -> 22 [ ]
16 -> 42 [ ]
17 -> 41 [ style = dotted]
17 -> 50 [ ]
17 -> 55 [ ]
17 -> 51 [ ]
17 -> 53 [ ]
17 -> 56 [ ]
17 -> 27 [ ]
18 -> 25 [ ]
18 -> 33 [ ]
19 -> 27 [ ]
20 -> 57 [ ]
20 -> 19 [ ]
20 -> 58 [ ]
20 -> 29 [ ]
21 -> 18 [ ]
21 -> 20 [ ]
22 -> 18 [ ]
22 -> 24 [ ]
22 -> 54 [ ]
23 -> 10 [ ]
23 -> 34 [ ]
23 -> 25 [ ]
24 -> 13 [ ]
26 -> 57 [ ]
26 -> 17 [ ]
28 -> 15 [ ]
31 -> 61 [ ]
32 -> 24 [ ]
32 -> 28 [ ]
33 -> 2 [ ]
33 -> 3 [ ]
34 -> 40 [ ]
35 -> 12 [ ]
36 -> 26 [ ]
36 -> 29 [ ]
37 -> 12 [ ]
37 -> 36 [ ]
38 -> 8 [ ]
39 -> 40 [ ]
40 -> 8 [ ]
40 -> 48 [ ]
41 -> 30 [ ]
44 -> 17 [ ]
45 -> 21 [ ]
46 -> 31 [ ]
47 -> 38 [ ]
48 -> 36 [ ]
49 -> 27 [ ]
52 -> 59 [ style = dotted]
52 -> 60 [ style = dotted]
59 -> 47 [ ]
59 -> 40 [ ]
60 -> 47 [ ]
60 -> 40 [ ]
61 -> 13 [ ]
61 -> 62 [ ]
}

Binary file added docs/src/runtime_internals/dependency_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/src/runtime_internals/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ The name is based on the end of the path, so additional context can be provided
```sh
cargo cf run -r basics/primitives
```

## Dependency graph

![Dependency graph](dependency_graph.png)

0 comments on commit a49904d

Please sign in to comment.