Skip to content

Commit 99bc4e1

Browse files
site: add interactive formal spec (#349)
* site: agda web * scripts: add transform script * fix: css restore; add search * fix: offset and link selection * site: add static formal spec * git: add workflow for updating formal spec
1 parent 12f211e commit 99bc4e1

File tree

552 files changed

+124426
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

552 files changed

+124426
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "formal-spec-integration"
2+
3+
on:
4+
workflow_run:
5+
workflows: ["formal-spec"]
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
11+
jobs:
12+
integrate-formal-spec:
13+
name: "Integrate Formal Spec"
14+
runs-on: ubuntu-22.04
15+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
16+
steps:
17+
- name: 📥 Checkout Leios site
18+
uses: actions/checkout@v4
19+
with:
20+
repository: input-output-hk/ouroboros-leios
21+
token: ${{ secrets.GH_PAT }}
22+
23+
- name: 📥 Download formal spec HTML
24+
uses: dawidd6/action-download-artifact@v2
25+
with:
26+
workflow: formal-spec.yaml
27+
name: formal-spec-html
28+
repo: input-output-hk/ouroboros-leios-formal-spec
29+
token: ${{ secrets.GH_PAT }}
30+
31+
- name: 🏗️ Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 22
35+
cache: "yarn"
36+
cache-dependency-path: ./site/yarn.lock
37+
38+
- name: 📦 Install dependencies
39+
working-directory: site
40+
run: yarn install
41+
42+
- name: 📝 Update formal spec
43+
run: |
44+
# Create formal spec directory if it doesn't exist
45+
mkdir -p site/static/formal-spec
46+
# Copy the HTML files
47+
cp -r formal-spec-html/* site/static/formal-spec/
48+
49+
- name: 🏗️ Build Docusaurus site
50+
working-directory: site
51+
run: |
52+
yarn build
53+
54+
- name: 🚀 Publish GitHub Pages
55+
uses: peaceiris/actions-gh-pages@v4
56+
with:
57+
github_token: ${{ secrets.GITHUB_TOKEN }}
58+
publish_dir: ./site/build
59+
cname: leios.cardano-scaling.org

site/docusaurus.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type * as Preset from "@docusaurus/preset-classic";
22
import type { Config } from "@docusaurus/types";
33
import { themes as prismThemes } from "prism-react-renderer";
4+
import path from 'path';
45

56
const config: Config = {
67
title: "Ouroboros Leios",
@@ -37,6 +38,13 @@ const config: Config = {
3738
},
3839
],
3940

41+
// Configure static file serving
42+
staticDirectories: ['static', 'public'],
43+
44+
// Configure plugins
45+
plugins: [
46+
],
47+
4048
presets: [
4149
[
4250
"classic",
@@ -87,6 +95,11 @@ const config: Config = {
8795
position: "left",
8896
label: "Development",
8997
},
98+
{
99+
to: "/formal-spec/",
100+
label: "Formal Specification",
101+
position: "left",
102+
},
90103
{ to: "/news", label: "Weekly updates", position: "right" },
91104
{
92105
type: "dropdown",
@@ -142,6 +155,10 @@ const config: Config = {
142155
label: "How it works",
143156
to: "/docs/how-it-works",
144157
},
158+
{
159+
label: "Formal Specification",
160+
to: "/formal-spec/",
161+
},
145162
{
146163
label: "FAQs",
147164
to: "/docs/faq",

site/scripts/build-agda-docs.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Exit on error
4+
set -e
5+
6+
# Get the directory of this script
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
SITE_DIR="$(dirname "$SCRIPT_DIR")"
9+
FORMAL_SPEC_DIR="$(cd "$SITE_DIR/../../../ouroboros-leios-formal-spec" && pwd)"
10+
11+
echo "Building Agda documentation..."
12+
cd "$FORMAL_SPEC_DIR"
13+
nix build .#leiosDocs
14+
15+
echo "Copying Agda HTML files..."
16+
mkdir -p "$SITE_DIR/static/agda_html"
17+
cp -r result/share/doc/agda/html/* "$SITE_DIR/static/agda_html/"
18+
19+
echo "Processing Agda HTML files..."
20+
cd "$SITE_DIR"
21+
node scripts/process-agda-html.js
22+
23+
echo "Done! The Agda specification is now available at /agda_html/"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Exit on error
4+
set -e
5+
6+
# Get the directory of this script
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
SITE_DIR="$(dirname "$SCRIPT_DIR")"
9+
FORMAL_SPEC_DIR="$(cd "$SITE_DIR/../../ouroboros-leios-formal-spec" && pwd)"
10+
11+
echo "Building Agda documentation..."
12+
cd "$FORMAL_SPEC_DIR"
13+
14+
# Add Nix configuration for trusted users
15+
export NIX_CONFIG="trusted-users = root $USER
16+
substituters = https://cache.nixos.org/
17+
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
18+
19+
# Build the docs with --impure to handle dirty git tree
20+
nix build .#leiosDocs --impure
21+
22+
echo "Copying Agda HTML files..."
23+
mkdir -p "$SITE_DIR/static/agda_html"
24+
25+
# Backup our custom CSS if it exists
26+
if [ -f "$SITE_DIR/static/agda_html/agda.css" ]; then
27+
cp "$SITE_DIR/static/agda_html/agda.css" "$SITE_DIR/static/agda_html/agda.css.bak"
28+
fi
29+
30+
# Copy all files except Agda.css
31+
cp -r result/share/doc/agda/html/* "$SITE_DIR/static/agda_html/"
32+
33+
# Restore our custom CSS
34+
if [ -f "$SITE_DIR/static/agda_html/agda.css.bak" ]; then
35+
mv "$SITE_DIR/static/agda_html/agda.css.bak" "$SITE_DIR/static/agda_html/agda.css"
36+
fi
37+
38+
echo "Processing Agda HTML files..."
39+
cd "$SITE_DIR"
40+
node scripts/process-agda-html.js
41+
42+
echo "Starting development server..."
43+
yarn start

0 commit comments

Comments
 (0)