Skip to content

Commit 80a5d45

Browse files
authored
Merge pull request #80 from guzman-raphael/diagram-test
Improve diagram generation
2 parents 7c705c0 + 67ecb42 commit 80a5d45

File tree

7 files changed

+52
-268
lines changed

7 files changed

+52
-268
lines changed

.clippy.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ allowed-duplicate-crates = [
66
"clap",
77
"clap_derive",
88
"clap_lex",
9+
"getrandom",
910
"hashbrown",
1011
"heck",
1112
"indexmap",
1213
"strsim",
1314
"syn",
15+
"thiserror",
16+
"thiserror-impl",
17+
"wasi",
1418
"windows-sys",
1519
]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build Diagram
2+
runs:
3+
using: composite
4+
steps:
5+
- shell: bash
6+
run: |
7+
: Install dependencies
8+
sudo apt-get update
9+
sudo apt-get install graphviz -y
10+
cargo install cargo-modules
11+
- shell: bash
12+
run: |
13+
: Generate crate diagram
14+
mkdir -p docs/images
15+
set -o pipefail
16+
cargo modules dependencies --lib --max-depth 0 \
17+
--no-uses --no-fns \
18+
--focus-on "
19+
orcapod::uniffi::{
20+
model::{Pod,PodJob,PodResult},
21+
store::filestore::LocalFileStore,
22+
orchestrator::{PodRun,docker::LocalDockerOrchestrator},
23+
}
24+
" \
25+
--layout dot | \
26+
dot -T svg > docs/images/orcapod_diagram.svg
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: orcapod_diagram
30+
path: docs/images/orcapod_diagram.svg
31+
retention-days: 1

.github/workflows/docs.yaml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ jobs:
66
if: github.repository_owner == 'walkerlab' && github.event.pusher.name != 'walkerlab-repo-writer[bot]'
77
runs-on: ubuntu-latest
88
steps:
9-
- name: Install dependencies
10-
run: |
11-
sudo apt-get update
12-
sudo apt-get install graphviz -y
13-
cargo install cargo-modules
149
- uses: actions/create-github-app-token@v1
1510
id: generate_app_token
1611
with:
@@ -19,20 +14,13 @@ jobs:
1914
- uses: actions/checkout@v4
2015
with:
2116
token: ${{ steps.generate_app_token.outputs.token }}
22-
- name: Generate crate diagram
23-
run: |
24-
mkdir -p docs/images
25-
set -o pipefail
26-
cargo modules dependencies --lib \
27-
--no-uses --no-fns \
28-
--focus-on "orcapod::uniffi::model::{Pod}" \
29-
--layout dot | \
30-
dot -T svg > docs/images/crate_diagram.svg
17+
- name: Build Diagram
18+
uses: ./.github/actions/build-diagram
3119
- name: Sync GitHub
3220
run: |
3321
git config user.name github-actions
3422
git config user.email [email protected]
35-
git add docs/images/crate_diagram.svg
23+
git add docs/images/*
3624
git commit -m "Update crate diagram." || echo "Diagram unchanged, skipping commit."
3725
git push
3826
api:

.github/workflows/tests.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ name: Tests
22
on:
33
- pull_request
44
jobs:
5-
tests:
5+
diagram:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Build Diagram
10+
uses: ./.github/actions/build-diagram
11+
syntax-style-format-and-integration:
612
runs-on: ubuntu-latest
713
env:
814
CARGO_TERM_COLOR: always

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# orcapod
66

7-
![orcapod crate diagram](docs/images/crate_diagram.svg "Orcapod Crate Diagram")
7+
![orcapod crate diagram](docs/images/orcapod_diagram.svg "Orcapod Crate Diagram")
88

99
## Tests
1010

@@ -23,9 +23,9 @@ cargo llvm-cov --ignore-filename-regex "bin/.*|lib\.rs" --cobertura --output-pat
2323

2424
```bash
2525
cargo doc --no-deps # gen api docs (target/doc/orcapod/index.html)
26-
cargo modules dependencies --lib --no-uses --no-fns --focus-on "orcapod::uniffi::model::{Pod}" --layout dot > docs/images/crate_diagram.dot # orcapod diagram as DOT
27-
cargo modules dependencies --lib --no-uses --no-fns --focus-on "orcapod::uniffi::model::{Pod}" --layout dot | dot -T png > docs/images/crate_diagram.png # orcapod diagram as PNG
28-
cargo modules dependencies --lib --no-uses --no-fns --focus-on "orcapod::uniffi::model::{Pod}" --layout dot | dot -T svg > docs/images/crate_diagram.svg # orcapod diagram as SVG
26+
cargo modules dependencies --lib --no-uses --no-fns --focus-on "orcapod::uniffi::{model::{Pod,PodJob,PodResult},store::filestore::LocalFileStore,orchestrator::{PodRun,docker::LocalDockerOrchestrator}}" --layout dot > docs/images/orcapod_diagram.dot # orcapod diagram as DOT
27+
cargo modules dependencies --lib --no-uses --no-fns --focus-on "orcapod::uniffi::{model::{Pod,PodJob,PodResult},store::filestore::LocalFileStore,orchestrator::{PodRun,docker::LocalDockerOrchestrator}}" --layout dot | dot -T png > docs/images/orcapod_diagram.png # orcapod diagram as PNG
28+
cargo modules dependencies --lib --no-uses --no-fns --focus-on "orcapod::uniffi::{model::{Pod,PodJob,PodResult},store::filestore::LocalFileStore,orchestrator::{PodRun,docker::LocalDockerOrchestrator}}" --layout dot | dot -T svg > docs/images/orcapod_diagram.svg # orcapod diagram as SVG
2929
```
3030

3131
## Project Management

cspell.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
"maturin",
7272
"ipykernel",
7373
"getset",
74-
"strsim"
74+
"strsim",
75+
"getrandom",
76+
"wasi"
7577
]
7678
}

0 commit comments

Comments
 (0)