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

feat(docs): versioned documentation between HEAD and release #470

Merged
merged 50 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e6c2ef4
wip improved website
rohanku Dec 23, 2024
0bf48b5
work on versioning
rohanku Dec 26, 2024
a7e08ac
try swizzling version dropdown
rohanku Dec 26, 2024
74a36bc
swizzle version link
rohanku Dec 26, 2024
9401ea2
push latest docs
rohanku Jan 2, 2025
ee1bc36
revert to the original workspace config
rohanku Jan 2, 2025
4df2eea
use substrate workspace plugin (#472)
rohanku Jan 2, 2025
6a8a05a
feat(release): use cargo workspace plugin (#473)
rohanku Jan 2, 2025
7763e29
use substrate workspace plugin
rohanku Jan 2, 2025
ece0c9c
fix examples
rohanku Jan 3, 2025
0ef2335
Add examples to release please
rohanku Jan 3, 2025
dcf4a57
fix versioning
rohanku Jan 3, 2025
c859ea9
try removing comments
rohanku Jan 3, 2025
baff2da
test release pleaes features
rohanku Jan 6, 2025
2573984
complete doc changes for release vs latest
rohanku Jan 9, 2025
463db3b
fix examples paths
rohanku Jan 9, 2025
77e277b
cleanup pr
rohanku Jan 9, 2025
c41b1f1
try creating workflows for deploying docs
rohanku Jan 10, 2025
4cc3c8d
test actions
rohanku Jan 10, 2025
d0b6241
get workflow registered
rohanku Jan 10, 2025
d1459a5
try again to get workflow registered
rohanku Jan 10, 2025
8993149
remove extraneous dependencies
rohanku Jan 10, 2025
8f00d28
remove docs usage
rohanku Jan 10, 2025
54fb160
temporarily use main environment
rohanku Jan 10, 2025
f6a8983
try again
rohanku Jan 10, 2025
757f567
test
rohanku Jan 10, 2025
1777d35
fix deploy docs action
rohanku Jan 10, 2025
2208816
add back checkoutv3
rohanku Jan 10, 2025
50a54dc
finalize docs deploy strategy
rohanku Jan 10, 2025
52cf706
fix copy
rohanku Jan 10, 2025
29e88c2
try removing substrate api examples until it compiles
rohanku Jan 10, 2025
ee888a7
try rerunning CI-main
rohanku Jan 10, 2025
88ba965
undo
rohanku Jan 10, 2025
ce9532f
extract deployment to bash scripts
rohanku Jan 10, 2025
c13577b
make scripts executable
rohanku Jan 10, 2025
7e25b2c
fix variable usage
rohanku Jan 10, 2025
752f021
fix argument parsing
rohanku Jan 10, 2025
d98f447
fix globs
rohanku Jan 10, 2025
f13234a
support branch docs
rohanku Jan 10, 2025
8e68d4b
fix deploy script
rohanku Jan 10, 2025
8f83ec8
fix deploy script
rohanku Jan 10, 2025
8225a22
migrate to docusaurus 3.7 and fix deploy script
rohanku Jan 10, 2025
3884fff
modify site-config.json in deploy
rohanku Jan 10, 2025
b7f02f4
fix heredoc usage
rohanku Jan 13, 2025
d4e6f20
test api doc deploy
rohanku Jan 13, 2025
af65ca4
remove push CI
rohanku Jan 13, 2025
3e75e4f
fix api deploy script
rohanku Jan 13, 2025
ada6108
clean up workflow yaml
rohanku Jan 13, 2025
2648fea
remove iarna toml
rohanku Jan 13, 2025
365ddc1
fix merge conflicts, start cleaning up compilation errors
rohanku Jan 14, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/check-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
RUSTDOCFLAGS: '-D warnings'
test:
name: test
runs-on: [bwrc, nfs]
runs-on: bwrc
steps:
- uses: actions/checkout@v3
- name: Test
Expand Down
41 changes: 6 additions & 35 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: ci-main

on:
push:
Expand Down Expand Up @@ -26,7 +26,9 @@ jobs:
with:
repository: rohanku/release-please
path: release-please
ref: dev
# Can change back to `dev` once this is merged into Substrate `main` and
# the release-please `substrate-workspace` branch is merged into `dev`.
ref: substrate-workspace
- uses: actions/setup-node@v3
with:
node-version: 18
Expand Down Expand Up @@ -84,38 +86,7 @@ jobs:
working-directory: substrate
run: ../cargo-workspaces/cargo-workspaces/target/debug/cargo-ws workspaces publish --from-git --token=${{ secrets.KTRA_TOKEN }} --registry=substrate --yes --allow-dirty
deploy-api-docs:
name: Deploy API documentation
runs-on: bwrc
environment: main
needs: [ check-workspace ]
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@ddcac349402ef55840d9870785f4df1890768078
- run: just build
working-directory: docs/api
- run: flyctl deploy --remote-only --detach
working-directory: docs/api
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_API }}
uses: ./.github/workflows/deploy-api-docs.yml
deploy-docs:
name: Deploy documentation
runs-on: ubuntu-22.04
environment: main
needs: [ check-workspace ]
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: docs/site/yarn.lock
- run: yarn install
working-directory: docs/site
- run: yarn build
working-directory: docs/site
- run: flyctl deploy --remote-only --detach
working-directory: docs/site
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_DOCS }}
uses: ./.github/workflows/deploy-docs.yml

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: ci

on:
pull_request:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/deploy-api-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: deploy-api-docs

on:
workflow_call:
workflow_dispatch:
inputs:
name:

env:
CARGO_TERM_COLOR: always
DOCS_NAME: ${{ inputs.name || github.ref.name }}
PUBLIC_DOCS_DIR: /Users/rohan/Downloads/substrate_docs_public

jobs:
deploy-api-docs:
name: Deploy API documentation
runs-on: bwrc
environment: docs
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@ddcac349402ef55840d9870785f4df1890768078
- run: ./deploy.sh ${{ env.PUBLIC_DOCS_DIR }} ${{ inputs.name || github.ref_name }}
working-directory: docs/api
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_API }}
31 changes: 31 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: deploy-docs

on:
workflow_call:
workflow_dispatch:
inputs:
name:

env:
CARGO_TERM_COLOR: always
DOCS_NAME: ${{ inputs.name || github.ref.name }}
PUBLIC_DOCS_DIR: /Users/rohan/Downloads/substrate_docs_public

jobs:
deploy-docs:
name: Deploy documentation
runs-on: bwrc
environment: docs
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: docs/docusaurus/yarn.lock
- run: ./deploy.sh ${{ env.PUBLIC_DOCS_DIR }} ${{ inputs.name || github.ref_name }}
working-directory: docs/docusaurus
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_DOCS }}

11 changes: 11 additions & 0 deletions .github/workflows/deploy-release-api-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: deploy-release-api-docs

on:
release:
types: [created]

jobs:
deploy-api-docs:
uses: ./.github/workflows/deploy-api-docs.yml
with:
name: release
4 changes: 3 additions & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"codegen": "0.8.1",
"config": "0.2.5",
"docs/snippets": "0.5.1",
"libs/atoll": "0.1.3",
"examples/latest/sky130_inverter": "0.0.0",
"examples/latest/spice_vdivider": "0.0.0",
"examples/latest/substrate_api_examples": "0.0.0",
"libs/cache": "0.5.0",
"libs/diagnostics": "0.3.0",
"libs/enumify": "0.1.0",
Expand Down
58 changes: 50 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ members = [
"codegen",
"config",
"docs/snippets",
# "libs/atoll",
# "examples/latest/sky130_inverter",
# "examples/latest/spice_vdivider",
"examples/latest/colbuf",
# "examples/latest/substrate_api_examples",
"libs/cache",
"libs/diagnostics",
"libs/layir",
Expand All @@ -29,16 +32,15 @@ members = [
"libs/verilog",
# "pdks/sky130pdk",
"substrate",
# "tests",
"tests",
"tools/magic",
"tools/netgen",
"tools/ngspice",
"tools/pegasus",
"tools/quantus",
"tools/spectre",
"tools/magic-netgen",
"examples2/colbuf", "examples2/via",
]

exclude = ["tests", "pdks/sky130pdk", "libs/atoll", "examples"]
exclude = ["pdks/sky130pdk", "examples/release"]

12 changes: 5 additions & 7 deletions codegen/build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use snippets::build_snippets;

fn main() {
println!("cargo::rerun-if-changed=examples/example.rs");
build_snippets(
concat!(
env!("CARGO_MANIFEST_DIR"),
"/../substrate/examples/substrate.rs"
),
"substrate",
let example_path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../examples/latest/substrate_api_examples/src/lib.rs"
);
println!("cargo::rerun-if-changed={example_path}");
build_snippets(example_path, "substrate");
}
22 changes: 22 additions & 0 deletions docs/api/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Print commands that are executed
set -x

# Turn on error checking options
# Running the bashrc can result in errors,
# which we'll just ignore.
set -euf -o pipefail

if [ $# -le 1 ]; then
echo "Usage: ./deploy.sh PUBLIC_DOCS_DIR REF_NAME"
exit 1
fi

PUBLIC_DOCS_DIR=$1
REF_NAME=$2

just build
rm -rf $PUBLIC_DOCS_DIR/api/static/$REF_NAME
mkdir -p $PUBLIC_DOCS_DIR/api/static/$REF_NAME
cp -r ./target/doc/. $PUBLIC_DOCS_DIR/api/static/$REF_NAME
cd $PUBLIC_DOCS_DIR/api
flyctl deploy --remote-only --detach
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions docs/docusaurus/blog/24-12-24-example-post/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
authors:
- rohanku
slug: /example-post
description: Test description
---

# Example post

Test
File renamed without changes.
5 changes: 5 additions & 0 deletions docs/docusaurus/create_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
(cd $SCRIPT_DIR \
&& yarn docusaurus docs:version $1 \
&& echo "{\"examples_path\": \"examples/$1\"}" > "versioned_docs/version-$1/docs-config.json")
35 changes: 35 additions & 0 deletions docs/docusaurus/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Print commands that are executed
set -x

# Turn on error checking options
# Running the bashrc can result in errors,
# which we'll just ignore.
set -euf -o pipefail

if [ $# -eq 0 ]
then
echo "Usage: ./deploy.sh PUBLIC_DOCS_DIR REF_NAME"
exit 1
fi

PUBLIC_DOCS_DIR=$1
REF_NAME=$2

cat << EOF > ./site-config.json
{
"branch": "$REF_NAME"
}
EOF
yarn install
yarn build
if [ $REF_NAME = "main" ]; then
find $PUBLIC_DOCS_DIR/docusaurus/static -not -path "$PUBLIC_DOCS_DIR/docusaurus/static/branch/*" -not -name "fly.toml" -not -name "Dockerfile" -delete
mkdir -p $PUBLIC_DOCS_DIR/docusaurus/static
cp -r ./build/. $PUBLIC_DOCS_DIR/docusaurus/static
else
rm -rf $PUBLIC_DOCS_DIR/docusaurus/static/branch/$REF_NAME
mkdir -p $PUBLIC_DOCS_DIR/docusaurus/static/branch/$REF_NAME
cp -r ./build/. $PUBLIC_DOCS_DIR/docusaurus/static/branch/$REF_NAME
fi
cd $PUBLIC_DOCS_DIR/docusaurus
flyctl deploy --remote-only --detach
Loading
Loading