Skip to content

Commit 888ebd4

Browse files
nahocnategraf
andauthored
WEB3-321: feat: deploy steel docs on github pages (#419)
This deploys a custom docs.rs like doc site for steel using GitHub pages and `cargo doc` --------- Co-authored-by: Victor Snyder-Graf <[email protected]>
1 parent 88cce0f commit 888ebd4

File tree

3 files changed

+104
-21
lines changed

3 files changed

+104
-21
lines changed

Diff for: .github/workflows/steel-documentation.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Deploy Steel Documentation
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+*' # matches v1.0, v1.1, v2.0, v2.1.0, etc.
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
19+
env:
20+
RISC0_TOOLCHAIN_VERSION: r0.1.81.0
21+
RISC0_MONOREPO_REF: "main"
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
28+
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
29+
- uses: actions/checkout@v4
30+
31+
- name: Setup Pages
32+
uses: actions/configure-pages@v4
33+
34+
- uses: risc0/risc0/.github/actions/rustup@main
35+
with:
36+
toolchain: nightly-2024-09-04
37+
38+
- name: Build documentation
39+
run: |
40+
if ! cargo +nightly-2024-09-04 doc -p risc0-steel --all-features --no-deps; then
41+
echo "Documentation build failed"
42+
exit 1
43+
fi
44+
env:
45+
RISC0_SKIP_BUILD: true
46+
RISC0_SKIP_BUILD_KERNEL: true
47+
RUSTDOCFLAGS: "--cfg docsrs -D warnings"
48+
49+
- name: Setup doc directory structure
50+
run: |
51+
cd target/doc || exit 1
52+
53+
# Create the risc0_steel directory first
54+
mkdir -p risc0_steel
55+
56+
# Find all image references and create symlinks with proper relative paths
57+
for img in $(find ../../crates -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif" -o -name "*.svg" \)); do
58+
filename=$(basename $img)
59+
# Create absolute path symlinks in root doc directory
60+
ln -sf $(realpath $img) $filename
61+
# Create relative path symlinks in risc0_steel directory
62+
ln -sf $(realpath $img) risc0_steel/$filename
63+
done
64+
65+
- name: Create index.html redirect
66+
run: |
67+
echo '<meta http-equiv="refresh" content="0; url=risc0_steel/index.html">' > target/doc/index.html
68+
69+
- name: Upload artifact
70+
uses: actions/upload-pages-artifact@v3
71+
with:
72+
path: target/doc
73+
74+
deploy:
75+
environment:
76+
name: github-pages
77+
url: ${{ steps.deployment.outputs.page_url }}
78+
runs-on: ubuntu-latest
79+
needs: build
80+
steps:
81+
- name: Deploy to GitHub Pages
82+
id: deployment
83+
uses: actions/deploy-pages@v4

Diff for: crates/steel/README.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,25 @@ This documentation covers the core concepts of Steel. After reading, you will un
4747

4848
The RISC Zero [dev docs][dev-docs] are a great place to start to understand the zkVM in detail. If you have any questions, and/or just want to hang out with other builders, please join the [RISC Zero Discord][risczero-discord].
4949

50-
[Steel examples]: ../../examples
51-
[ERC20 Counter]: ../../examples/erc20-counter
52-
[create-steel-app]: docs/create-steel-app
50+
[Steel examples]: https://github.com/risc0/risc0-ethereum/blob/main/examples
51+
[ERC20 Counter]: https://github.com/risc0/risc0-ethereum/blob/main/examples/erc20-counter
52+
[create-steel-app]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/create-steel-app
5353
[video tutorial]: https://www.loom.com/share/0e2ede7b9d50464fb729819a8bd24e05?sid=3009618b-38ea-449a-90dc-9b39ef569c67
5454
[Introducing Steel 1.0]: https://risczero.com/blog/introducing-steel-1.0
55-
[What is Steel?]: docs/what-is-steel.md
56-
[How does Steel work?]: docs/how-does-steel-work.md
57-
[Proving EVM execution within the zkVM]: docs/how-does-steel-work.md#proving-evm-execution-within-the-zkvm
58-
[Verifying the Proof On-Chain]: docs/how-does-steel-work.md#verifying-the-proof-on-chain
59-
[Steel Commitments]: docs/steel-commitments.md
60-
[Trust Anchor: The Blockhash]: docs/steel-commitments.md#steels-trust-anchor-the-blockhash
61-
[What is a Steel Commitment?]: docs/steel-commitments.md#what-is-a-steel-commitment
62-
[Validation of Steel Commitments]: docs/steel-commitments.md#validation-of-steel-commitments
63-
[Steel History]: docs/steel-history.md
64-
[Why use Steel history?]: docs/steel-history.md#why-use-steel-history
65-
[Overview]: docs/steel-history.md#overview
66-
[How does Steel history work?]: docs/steel-history.md#how-does-steel-history-work
67-
[How far can you go back?]: docs/steel-history.md#how-far-can-you-go-back
68-
[How much does Steel history cost?]: docs/steel-history.md#how-much-does-steel-history-cost
69-
[Enabling Steel history]: docs/steel-history.md#enabling-steel-history
55+
[What is Steel?]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/what-is-steel.md
56+
[How does Steel work?]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/how-does-steel-work.md
57+
[Proving EVM execution within the zkVM]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/how-does-steel-work.md#proving-evm-execution-within-the-zkvm
58+
[Verifying the Proof On-Chain]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/how-does-steel-work.md#verifying-the-proof-on-chain
59+
[Steel Commitments]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-commitments.md
60+
[Trust Anchor: The Blockhash]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-commitments.md#steels-trust-anchor-the-blockhash
61+
[What is a Steel Commitment?]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-commitments.md#what-is-a-steel-commitment
62+
[Validation of Steel Commitments]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-commitments.md#validation-of-steel-commitments
63+
[Steel History]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-history.md
64+
[Why use Steel history?]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-history.md#why-use-steel-history
65+
[Overview]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-history.md#overview
66+
[How does Steel history work?]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-history.md#how-does-steel-history-work
67+
[How far can you go back?]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-history.md#how-far-can-you-go-back
68+
[How much does Steel history cost?]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-history.md#how-much-does-steel-history-cost
69+
[Enabling Steel history]: https://github.com/risc0/risc0-ethereum/blob/main/crates/steel/docs/steel-history.md#enabling-steel-history
7070
[dev-docs]: https://dev.risczero.com/api/
7171
[risczero-discord]: https://discord.com/invite/risczero

Diff for: crates/steel/src/contract.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use revm::{
3030
///
3131
/// ### Usage
3232
/// - **Preflight calls on the Host:** To prepare calls on the host environment and build the
33-
/// necessary proof, use [Contract::preflight]. The environment can be initialized using the
33+
/// necessary proof, use [Contract::preflight][Contract]. The environment can be initialized using the
3434
/// [EthEvmEnv::builder] or [EvmEnv::builder].
3535
/// - **Calls in the Guest:** To initialize the contract in the guest environment, use
3636
/// [Contract::new]. The environment should be constructed using [EvmInput::into_env].
@@ -69,8 +69,8 @@ use revm::{
6969
/// # }
7070
/// ```
7171
///
72-
/// [EthEvmEnv::builder]: crate::ethereum::EthEvmEnv::builder
73-
/// [EvmEnv::builder]: crate::EvmEnv::builder
72+
/// [EthEvmEnv::builder]: crate::ethereum::EthEvmEnv
73+
/// [EvmEnv::builder]: crate::EvmEnv
7474
/// [EvmInput::into_env]: crate::EvmInput::into_env
7575
pub struct Contract<E> {
7676
address: Address,

0 commit comments

Comments
 (0)