Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating multichip docs with GitHub Pages #1243

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

WORKSPACE=${GITHUB_WORKSPACE:-$(pwd)}

CHIPS=("esp32" "esp32c2" "esp32c3" "esp32c6" "esp32h2" "esp32p4" "esp32s2" "esp32s3")
for CHIP in "${CHIPS[@]}"; do
if [ "$CHIP" == "esp32" ] || [ "$CHIP" == "esp32s2" ] || [ "$CHIP" == "esp32s3" ]; then
cargo +esp xtask build-documentation --output-path=docs/"$CHIP"/ esp-hal "$CHIP"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+esp has the riscv targets too, so can't we always use the esp toolchain?

else
cargo +nightly xtask build-documentation --output-path=docs/"$CHIP"/ esp-hal "$CHIP"
fi
done

cp resources/esp-rs.svg "${WORKSPACE}"
cp resources/index.html "${WORKSPACE}"

find . -maxdepth 1 -mindepth 1 ! -name 'docs' ! -name '.git' ! -name 'index.html' ! -name 'esp-rs.svg' ! -name '.' -exec rm -rf {} +
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,28 @@ jobs:
run: cargo fmt --all --manifest-path=esp-riscv-rt/Cargo.toml -- --check
- name: rustfmt (examples)
run: cargo fmt --all --manifest-path=examples/Cargo.toml -- --check

build-docs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be running for every commit pushed to every PR. We should either create a proper release workflow, or just create a new documentation workflow which is triggered by the workflow_dispatch event for now, so we can manually invoke it.

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf, riscv32imafc-unknown-none-elf
toolchain: ${{ env.MSRV }}
components: rust-src

- uses: esp-rs/[email protected]
with:
default: true
ldproxy: false

- name: Build and Clone Documentation
run: ./.github/build_docs.sh

- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: .
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ensuring that the random number generator is TRNG. (#1200)
- ESP32-C6: Add timer wakeup source for deepsleep (#1201)
- Introduce `InterruptExecutor::spawner()` (#1211)
- Creating multichip docs with GitHub Pages (#1243)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation does not affect the user-facing API in any way, there is no need for a CHANGELOG.md entry in this PR.


### Fixed

Expand Down
4 changes: 4 additions & 0 deletions resources/esp-rs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
132 changes: 132 additions & 0 deletions resources/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>esp-rs docs</title>
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,400;0,600;1,400;1,600&display=swap" rel="stylesheet">
<style>
body {
background-color: rgb(53, 53, 53);
font-family: 'Fira Sans', sans-serif;
color: white;
margin: 0;
padding: 40px 20px;
display: flex;
height: 100vh;
width: 100vw;
justify-content: center;
box-sizing: border-box;
}
.logo {
text-align: center;
margin-bottom: 50px;
font-size: 2em;
font-weight: 500;
}
.logo img {
width: 100px;
height: auto;
margin-bottom: 20px;
}
.content {
width: 900px;
}
.crate {
display: flex;
align-items: center;
padding: 10px;
border-bottom: 2px solid #454444;
}
.crate-description {
flex: 1;
font-family: 'Source Serif 4', serif;
color: #C0C0C0;
text-align: center;
}
.crate-name {
color: #D6991D;
width: 120px;
}
/* Ensure the link color does not change after being clicked */
.crate-name a:link,
.crate-name a:visited,
.crate-name a:hover,
.crate-name a:active,
.crate-name a:focus {
color: #D6991D;
}
.crate-version {
color: #C0C0C0;
text-align: center;
width: 120px;
}

@media screen and (min-height: 650px) {
body {
align-items: center;
}
}
</style>
</head>
<body>



<div class="content">
<div class="logo">
<img src="esp-rs.svg" alt="esp-rs logo">
<div>esp-rs docs</div>
</div>
<!-- Crate entry -->
<div class="crate">
<span class="crate-name"><a href="docs/esp32/esp_hal/index.html">esp32</a></span>
<span class="crate-description">Crate esp-hal (targeting ESP32)</span>
<span class="crate-version">0.18.0</span>
</div>

<div class="crate">
<span class="crate-name"><a href="docs/esp32c2/esp_hal/index.html">esp32c2</a></span>
<span class="crate-description">Crate esp-hal (targeting ESP32-C2)</span>
<span class="crate-version">0.13.0</span>
</div>

<div class="crate">
<span class="crate-name"><a href="docs/esp32c3/esp_hal/index.html">esp32c3</a></span>
<span class="crate-description">Crate esp-hal (targeting ESP32-C3)</span>
<span class="crate-version">0.15.0</span>
</div>

<div class="crate">
<span class="crate-name"><a href="docs/esp32c6/esp_hal/index.html">esp32c6</a></span>
<span class="crate-description">Crate esp-hal (targeting ESP32-C6)</span>
<span class="crate-version">0.8.0</span>
</div>

<div class="crate">
<span class="crate-name"><a href="docs/esp32h2/esp_hal/index.html">esp32h2</a></span>
<span class="crate-description">Crate esp-hal (targeting ESP32-H2)</span>
<span class="crate-version">0.6.0</span>
</div>

<div class="crate">
<span class="crate-name"><a href="docs/esp32p4/esp_hal/index.html">esp32p4</a></span>
<span class="crate-description">Work in progress...</span>
<span class="crate-version">-</span>
</div>
<div class="crate">
<span class="crate-name"><a href="docs/esp32s2/esp_hal/index.html">esp32s2</a></span>
<span class="crate-description">Crate esp-hal (targeting ESP32-S2)</span>
<span class="crate-version">0.15.0</span>
</div>

<div class="crate">
<span class="crate-name"><a href="docs/esp32s3/esp_hal/index.html">esp32s3</a></span>
<span class="crate-description">Crate esp-hal (targeting ESP32-S3)</span>
<span class="crate-version">0.15.0</span>
</div>
</div>

</body>
</html>
Loading