Skip to content

Commit

Permalink
feat(docs): Integrate Rust docs to our general mkDocs (#173)
Browse files Browse the repository at this point in the history
* Add rust docs deployment

* fix

* fix

* update

* embed Rust docs

* add dependency graphs

* update

* fix

* update

* fix

* fix

* update Earthly versions

* fix Rust build
  • Loading branch information
Mr-Leshiy authored Dec 12, 2023
1 parent f164369 commit 301d953
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 23 deletions.
4 changes: 3 additions & 1 deletion catalyst-gateway/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ rustflags = [
]

rustdocflags = [
"--enable-index-page",
"-Z",
"unstable-options",
"-D",
"warnings",
"-D",
Expand Down Expand Up @@ -104,7 +107,6 @@ lto = "thin"
incremental = false
codegen-units = 16


[alias]
lint = "clippy -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable -D clippy::missing_docs_in_private_items"
lintfix = "clippy -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable"
Expand Down
11 changes: 6 additions & 5 deletions catalyst-gateway/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ VERSION 0.7

# Set up our target toolchains, and copy our files.
builder:
FROM github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.3+rust-base
FROM github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+rust-base

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.3+SETUP --toolchain=rust-toolchain.toml
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+SETUP --toolchain=rust-toolchain.toml

COPY --dir .cargo .config Cargo.* clippy.toml deny.toml rustfmt.toml bin crates .

# Test rust build container - Use best architecture host tools.
check-hosted:
FROM +builder

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.3+CHECK
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+CHECK

# Test which runs check with all supported host tooling. Needs qemu or rosetta to run.
# Only used to validate tooling is working across host toolsets.
Expand All @@ -27,9 +27,9 @@ build-hosted:
# Build the service
FROM +builder

RUN /scripts/std_build.sh
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+BUILD --bins="cat-gateway/cat-gateway"

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.3+SMOKE_TEST --bin=cat-gateway
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+SMOKE_TEST --bin="cat-gateway"

SAVE ARTIFACT target/$TARGETARCH/doc doc
SAVE ARTIFACT target/$TARGETARCH/release/cat-gateway cat-gateway
Expand All @@ -39,6 +39,7 @@ build-hosted:
build-all-hosts:
BUILD --platform=linux/amd64 --platform=linux/arm64 +build-hosted


## -----------------------------------------------------------------------------
##
## Standard CI targets.
Expand Down
8 changes: 0 additions & 8 deletions catalyst-gateway/bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ edition.workspace = true
license.workspace = true
repository.workspace = true

[[bin]]
name = "cat-gateway"
path = "src/main.rs"

[lib]
name = "lib"
path = "src/lib.rs"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion catalyst-gateway/clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
allow-unwrap-in-tests = true
allow-expect-in-tests = true
8 changes: 5 additions & 3 deletions docs/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ VERSION 0.7
# Copy all the source we need to build the docs
src:
# Common src setup
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.0.8+SRC
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.0.11+SRC

# Now copy into that any artifacts we pull from the builds.
COPY --dir ../+repo-docs/repo /docs/includes
# copy Rust docs
COPY ./../catalyst-gateway+build-hosted/doc /docs/src/api/catalyst-gateway/rust-docs

# Build the docs here.
docs:
FROM +src

DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.0.8+BUILD
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.0.11+BUILD

# Make a locally runable container that can serve the docs.
local:
# Build a self contained service to show built docs locally.
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.0.8+PACKAGE
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.0.11+PACKAGE

# Copy the static pages into the container
COPY +docs/ /usr/share/nginx/html
Expand Down
5 changes: 3 additions & 2 deletions docs/src/.pages
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
arrange:
- index.md
nav:
- 'Home': index.md
- getting-started
- catalyst-standards
- 'API': api
- architecture
- appendix
3 changes: 3 additions & 0 deletions docs/src/api/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nav:
- index.md
- 'Catalyst gateway': catalyst-gateway.md
46 changes: 46 additions & 0 deletions docs/src/api/catalyst-gateway.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
icon: material/gate
---

<!-- cspell: words RUSTDOC graphviz -->

# Catalyst Gateway Rust docs

<!-- markdownlint-disable no-inline-html -->
<iframe src="rust-docs/index.html" title="RUSTDOC Documentation" style="height:800px;width:100%;"></iframe>

[OPEN FULL PAGE](./catalyst-gateway/rust-docs/index.html)

## Workspace Dependency Graph

```kroki-graphviz
@from_file:./api/catalyst-gateway/rust-docs/workspace.dot
```

## External Dependencies Graph

```kroki-graphviz
@from_file:./api/catalyst-gateway/rust-docs/full.dot
```

## Build and Development Dependencies Graph

```kroki-graphviz
@from_file:./api/catalyst-gateway/rust-docs/all.dot
```

## Module trees

### cat-gateway crate

```rust
{{ include_file('src/api/catalyst-gateway/rust-docs/cat-gateway.cat-gateway.bin.modules.tree') }}
```
## Module graphs
### cat-gateway crate
```kroki-graphviz
@from_file:./api/catalyst-gateway/rust-docs/cat-gateway.cat-gateway.bin.modules.dot
```
5 changes: 5 additions & 0 deletions docs/src/api/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
icon: material/api
---

# Catalyst Voices API docs
2 changes: 1 addition & 1 deletion docs/src/appendix/important/.pages
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
arrange:
nav:
- index.md
- contributing.md
- coc.md
Expand Down
2 changes: 1 addition & 1 deletion docs/src/architecture/.pages
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
arrange:
nav:
- index.md
- 01_introduction_and_goals.md
- 02_architecture_constraints.md
Expand Down
1 change: 0 additions & 1 deletion docs/src/catalyst-standards/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
icon: material/pillar
---

<!-- markdownlint-disable MD025-->
# Catalyst Standards

These are documents that relate to standardized specifications of the catalyst stack.

0 comments on commit 301d953

Please sign in to comment.