Skip to content

Commit b794472

Browse files
author
Derek Hower
committed
Add landing for GitHub pages, add index to resolved arch
1 parent 3d4ad09 commit b794472

File tree

6 files changed

+160
-73
lines changed

6 files changed

+160
-73
lines changed

.github/workflows/pages.yml

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -43,52 +43,8 @@ jobs:
4343
run: ./bin/build_container
4444
- name: Setup project
4545
run: ./bin/setup
46-
- name: Build manual
47-
run: ./do gen:html_manual MANUAL_NAME=isa VERSIONS=all
48-
- name: Build html documentation for generic_rv64
49-
run: ./do gen:html[generic_rv64]
50-
- name: Generate YARD docs
51-
run: ./do gen:tool_doc
52-
- name: Create _site/example_cfg
53-
run: mkdir -p _site/example_cfg
54-
- name: Create _site/manual
55-
run: mkdir -p _site/manual
56-
- name: Create _site/pdfs
57-
run: mkdir -p _site/pdfs
58-
- name: Create _site/htmls
59-
run: mkdir -p _site/htmls
60-
- name: Copy cfg html
61-
run: cp -R gen/cfg_html_doc/generic_rv64/html _site/example_cfg
62-
- name: Create RVA20 Profile Release PDF Spec
63-
run: ./do gen:profile[RVA20]
64-
- name: Copy RVA20 Profile Release PDF
65-
run: cp gen/profile_doc/pdf/RVA20.pdf _site/pdfs/RVA20.pdf
66-
- name: Create RVA22 Profile Release PDF Spec
67-
run: ./do gen:profile[RVA22]
68-
- name: Copy RVA22 Profile Release PDF
69-
run: cp gen/profile_doc/pdf/RVA22.pdf _site/pdfs/RVA22.pdf
70-
- name: Create RVI20 Profile Release PDF Spec
71-
run: ./do gen:profile[RVI20]
72-
- name: Copy RVI20 Profile Release PDF
73-
run: cp gen/profile_doc/pdf/RVA20.pdf _site/pdfs/RVI20.pdf
74-
- name: Create MC100-32 PDF Spec
75-
run: ./do gen:cert_model_pdf[MC100-32]
76-
- name: Copy MC100-32 PDF
77-
run: cp gen/certificate_doc/pdf/MC100-32.pdf _site/pdfs/MC100-32.pdf
78-
- name: Create MC100-32 HTML Spec
79-
run: ./do gen:cert_model_html[MC100-32]
80-
- name: Copy MC100-32 HTML
81-
run: cp gen/certificate_doc/html/MC100-32.html _site/htmls/MC100-32.html
82-
- name: Create MC100-64 PDF Spec
83-
run: ./do gen:cert_model_pdf[MC100-64]
84-
- name: Copy MC100-64 PDF
85-
run: cp gen/certificate_doc/pdf/MC100-64.pdf _site/pdfs/MC100-64.pdf
86-
- name: Create MC100-64 HTML Spec
87-
run: ./do gen:cert_model_html[MC100-64]
88-
- name: Copy MC100-64 HTML
89-
run: cp gen/certificate_doc/html/MC100-64.html _site/htmls/MC100-64.html
90-
- name: Copy manual html
91-
run: cp -R gen/manual/isa/top/all/html _site/manual
46+
- name: Create deploy dir
47+
run: /bin/bash lib/deploy.sh
9248
- name: Setup Pages
9349
uses: actions/configure-pages@v5
9450
- name: Upload artifact

README.adoc

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,8 @@
22

33
== Generated artifacts
44

5-
The following artifacts have been generated from the top of the `main` branch:
6-
7-
* https://riscv-software-src.github.io/riscv-unified-db/manual/html/index.html[ISA Manual with instruction and CSR appendix]
8-
* https://riscv-software-src.github.io/riscv-unified-db/example_cfg/html/index.html[configuration-specific documentation]
9-
* https://riscv-software-src.github.io/riscv-unified-db/ruby/arch_def/index.html[Ruby API documentation (database interface)]
10-
* https://riscv-software-src.github.io/riscv-unified-db/ruby/idl/index.html[Ruby IDL API documentation (IDL compiler)]
11-
* https://riscv-software-src.github.io/riscv-unified-db/pdfs/RVI20.pdf[RVI20 Profile Release]
12-
* https://riscv-software-src.github.io/riscv-unified-db/pdfs/RVA20.pdf[RVA20 Profile Release]
13-
* https://riscv-software-src.github.io/riscv-unified-db/pdfs/RVA22.pdf[RVA22 Profile Release]
14-
* https://riscv-software-src.github.io/riscv-unified-db/pdfs/MC100-32.pdf[MC100-32 Certification Requirements Document]
15-
* https://riscv-software-src.github.io/riscv-unified-db/pdfs/MC100-64.pdf[MC100-64 Certification Requirements Document]
5+
The latest documentation artifacts generated from the HEAD of main, include ISA manuals, profiles, etc.,
6+
can be found https://riscv-software-src.github.io/riscv-unified-db/index.html[on the GitHub pages site].
167

178
== Overview
189

Rakefile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ namespace :gen do
4848
end
4949
end
5050

51-
desc "Resolve the standard in arch/, and write it to resolved_arch/"
52-
task "resolved_arch" do
53-
sh "#{$root}/.home/.venv/bin/python3 lib/yaml_resolver.py resolve arch resolved_arch"
54-
end
51+
desc "Resolve the standard in arch/, and write it to gen/resolved_arch/_"
52+
task "resolved_arch" => "#{$root}/.stamps/resolve-_.stamp"
5553
end
5654

5755
# rule to generate standard for any configurations with an overlay
@@ -121,12 +119,12 @@ namespace :test do
121119
end
122120
puts "All instruction encodings pass basic sanity tests"
123121
end
124-
task schema: "gen:resolved_arch" do
122+
task schema: "#{$root}/.stamps/resolve-_.stamp" do
125123
puts "Checking arch files against schema.."
126-
Architecture.new("#{$root}/resolved_arch").validate(show_progress: true)
124+
Architecture.new("#{$root}/gen/resolved_arch/_").validate(show_progress: true)
127125
puts "All files validate against their schema"
128126
end
129-
task idl: ["gen:resolved_arch", "#{$root}/.stamps/resolve-rv32.stamp", "#{$root}/.stamps/resolve-rv64.stamp"] do
127+
task idl: ["#{$root}/.stamps/resolve-rv32.stamp", "#{$root}/.stamps/resolve-rv64.stamp"] do
130128
print "Parsing IDL code for RV32..."
131129
cfg_arch32 = cfg_arch_for("rv32")
132130
puts "done"

bin/setup

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,15 @@ else
205205
exit 1
206206
fi
207207

208-
if [ ! -f $ROOT/.git/hooks/pre-commit ]; then
209-
cat << HOOK > $ROOT/.git/hooks/pre-commit
208+
GIT_REPO_ROOT=`git rev-parse --path-format=absolute --git-common-dir | tr -d '\n'`
209+
if [ ! -f $GIT_REPO_ROOT/hooks/pre-commit ]; then
210+
cat << HOOK > $GIT_REPO_ROOT/hooks/pre-commit
210211
#!/usr/bin/env bash
211212
# File generated by pre-commit: https://pre-commit.com
212213
# ID: 138fd403232d2ddd5efb44317e38bf03
213214
214215
# start templated
215-
INSTALL_PYTHON=$ROOT/bin/python
216+
INSTALL_PYTHON=\$(realpath ./bin/python)
216217
ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit)
217218
# end templated
218219
@@ -228,5 +229,5 @@ else
228229
exit 1
229230
fi
230231
HOOK
231-
chmod +x $ROOT/.git/hooks/pre-commit
232+
chmod +x $GIT_REPO_ROOT/hooks/pre-commit
232233
fi

lib/deploy.sh

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#!/bin/bash
2+
3+
# deploy artifacts to a directory, in preparation for GitHub deployment
4+
5+
ROOT=$(dirname $(dirname $(realpath $BASH_SOURCE[0])))
6+
7+
DEPLOY_DIR="$ROOT/_site"
8+
PAGES_URL="https://riscv-software-src.github.io/riscv-unified-db"
9+
10+
mkdir -p $DEPLOY_DIR
11+
12+
echo "Resolve / Create Index"
13+
./do gen:resolved_arch
14+
15+
echo "Build manual"
16+
./do gen:html_manual MANUAL_NAME=isa VERSIONS=all
17+
18+
echo "Build html documentation for generic_rv64"
19+
./do gen:html[generic_rv64]
20+
21+
echo "Generate YARD docs"
22+
./do gen:tool_doc
23+
24+
echo "Create _site/example_cfg"
25+
mkdir -p $DEPLOY_DIR/example_cfg
26+
27+
echo "Create _site/manual"
28+
mkdir -p $DEPLOY_DIR/manual
29+
30+
echo "Create _site/pdfs"
31+
mkdir -p $DEPLOY_DIR/pdfs
32+
33+
echo "Create _site/htmls"
34+
mkdir mkdir -p $DEPLOY_DIR/htmls
35+
36+
echo "Copy cfg html"
37+
cp -R gen/cfg_html_doc/generic_rv64/html $DEPLOY_DIR/example_cfg
38+
39+
echo "Create RVA20 Profile Release PDF Spec"
40+
./do gen:profile[RVA20]
41+
42+
echo "Copy RVA20 Profile Release PDF"
43+
cp gen/profile_doc/pdf/RVA20.pdf $DEPLOY_DIR/pdfs/RVA20.pdf
44+
45+
echo "Create RVA22 Profile Release PDF Spec"
46+
./do gen:profile[RVA22]
47+
48+
echo "Copy RVA22 Profile Release PDF"
49+
cp gen/profile_doc/pdf/RVA22.pdf $DEPLOY_DIR/pdfs/RVA22.pdf
50+
51+
echo "Create RVI20 Profile Release PDF Spec"
52+
./do gen:profile[RVI20]
53+
54+
echo "Copy RVI20 Profile Release PDF"
55+
cp gen/profile_doc/pdf/RVA20.pdf $DEPLOY_DIR/pdfs/RVI20.pdf
56+
57+
echo "Create MC100-32 PDF Spec"
58+
./do gen:cert_model_pdf[MC100-32]
59+
60+
echo "Copy MC100-32 PDF"
61+
cp gen/certificate_doc/pdf/MC100-32.pdf $DEPLOY_DIR/pdfs/MC100-32.pdf
62+
63+
echo "Create MC100-32 HTML Spec"
64+
cp ./do gen:cert_model_html[MC100-32]
65+
66+
echo "Copy MC100-32 HTML"
67+
cp gen/certificate_doc/html/MC100-32.html $DEPLOY_DIR/htmls/MC100-32.html
68+
69+
echo "Create MC100-64 PDF Spec"
70+
./do gen:cert_model_pdf[MC100-64]
71+
72+
echo "Copy MC100-64 PDF"
73+
cp gen/certificate_doc/pdf/MC100-64.pdf $DEPLOY_DIR/pdfs/MC100-64.pdf
74+
75+
echo "Create MC100-64 HTML Spec"
76+
./do gen:cert_model_html[MC100-64]
77+
78+
echo "Copy MC100-64 HTML"
79+
cp gen/certificate_doc/html/MC100-64.html $DEPLOY_DIR/htmls/MC100-64.html
80+
81+
echo "Copy manual html"
82+
cp -R gen/manual/isa/top/all/html $DEPLOY_DIR/manual
83+
84+
echo "Create index"
85+
cat <<- EOF > $DEPLOY_DIR/index.html
86+
<!doctype html>
87+
<html lang="en-us">
88+
<head>
89+
<title>Release artifacts for $GITHUB_REF_NAME</title>
90+
</head>
91+
<body>
92+
<h1>Release artifacts for <code>riscv-unified-db</code>, ref $GITHUB_REF_NAME</h1>
93+
<h2>Commit $GITHUB_SHA</h2>
94+
<p>Created on $(date)</p>
95+
96+
<br/>
97+
<h3>Resolved architecture</h3>
98+
<ul>
99+
<li><a href="$PAGES_URL/resolved_arch/index.yaml">index.yaml</a> Database index, as array of relative paths from $PAGES_URL/resolved_arch</li>
100+
</ul>
101+
102+
<br/>
103+
<h3>ISA Manual</h3>
104+
<ul>
105+
<li><a href="$PAGES_URL/manual/html/index.html">Generated HTML ISA manuals, all versions</a></li>
106+
</ul>
107+
108+
<br/>
109+
<h3>Profiles</h3>
110+
<ul>
111+
<li><a href="$PAGES_URL/pdfs/RVI20.pdf">RVI20</a></li>
112+
<li><a href="$PAGES_URL/pdfs/RVA20.pdf">RVA20</a></li>
113+
<li><a href="$PAGES_URL/pdfs/RVA22.pdf">RVA22</a></li>
114+
</ul>
115+
116+
<br/>
117+
<h3>Certification Requirements Documents</h3>
118+
<ul>
119+
<li><a href="$PAGES_URL/pdfs/MC100-32.pdf">MC100-32</a></li>
120+
<li><a href="$PAGES_URL/pdfs/MC100-64.pdf">MC100-64</a></li>
121+
</ul>
122+
123+
<br/>
124+
<h3>Configuration-specific documentation</h3>
125+
<ul>
126+
<li><a href="$PAGES_URL/example_cfg/html/index.html">Architecture documentation for example RV64 config</a></li>
127+
</ul>
128+
129+
<br/>
130+
<h3>UDB Tool Documentation</h3>
131+
<ul>
132+
<li><a href="$PAGES_URL/ruby/idl/index.html">IDL language documentation</a></li>
133+
<li><a href="$PAGES_URL/ruby/arch_def/index.html">Ruby UDB interface documentation</a></li>
134+
</ul>
135+
</body>
136+
</html>
137+
EOF

lib/yaml_resolver.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,15 +597,19 @@ def resolve_file(
597597
if args.no_progress
598598
else tqdm(arch_paths, ascii=True, desc="Resolving arch")
599599
)
600+
abs_resolved_dir = (
601+
f"{UDB_ROOT}/{args.resolved_dir}"
602+
if not os.path.isabs(args.resolved_dir)
603+
else f"{args.resolved_dir}"
604+
)
600605
for arch_path in iter:
601-
resolved_arch_path = (
602-
f"{UDB_ROOT}/{args.resolved_dir}/{arch_path}"
603-
if not os.path.isabs(args.resolved_dir)
604-
else f"{args.resolved_dir}/{arch_path}"
605-
)
606+
resolved_arch_path = f"{abs_resolved_dir}/{arch_path}"
606607
os.makedirs(os.path.dirname(resolved_arch_path), exist_ok=True)
607608
resolve_file(
608609
arch_path, args.arch_dir, args.resolved_dir, not args.no_checks
609610
)
610611

612+
# create index
613+
write_yaml(f"{abs_resolved_dir}/index.yaml", arch_paths)
614+
611615
print(f"[INFO] Resolved architecture files written to {args.resolved_dir}")

0 commit comments

Comments
 (0)