Skip to content

cargo(deps): bump cc from 1.2.25 to 1.2.26 #45

cargo(deps): bump cc from 1.2.25 to 1.2.26

cargo(deps): bump cc from 1.2.25 to 1.2.26 #45

Workflow file for this run

# Workflow: Documentation Build and Deploy
#
# This workflow builds and validates Rust documentation, and optionally
# deploys it to GitHub Pages. It ensures that documentation stays up-to-date
# and accessible to users and contributors.
name: Documentation
# Trigger conditions
on:
# Run on pushes to main branch to keep docs updated
push:
branches: [ "main", "master" ]
# Run on pull requests to validate documentation changes
pull_request:
branches: [ "main", "master" ]
# Allow manual triggering for documentation updates
workflow_dispatch:
# Set permissions for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
# Define environment variables
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Define the documentation jobs
jobs:
# Job 1: Build and validate documentation
build-docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
# Step 1: Check out the source code
- name: Checkout source code
uses: actions/checkout@v4
# Step 2: Install Rust toolchain with Cargo.lock v4 support
- name: Install Rust toolchain
uses: dtolnay/[email protected]
# Step 3: Setup Rust caching
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
# Step 4: Build documentation for all crates
# This generates HTML documentation from Rust doc comments
- name: Build Rust documentation
run: |
echo "Building Rust documentation..."
cargo doc --all --no-deps --document-private-items
env:
# Treat documentation warnings as errors to ensure quality
RUSTDOCFLAGS: "-D warnings"
# Step 5: Create comprehensive documentation website
- name: Create documentation website
run: |
echo "Creating comprehensive documentation website..."
# Create main website directory structure
mkdir -p target/doc/website
mkdir -p target/doc/tutorials
# Copy tutorial markdown files
cp README.md target/doc/website/
cp mcp_rust_tutorial.md target/doc/tutorials/ 2>/dev/null || echo "Tutorial file not found, skipping"
# Create main index page
cat > target/doc/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MCP Rust Examples - Complete Learning Resource</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
line-height: 1.6;
color: #333;
background: #f8f9fa;
}
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 60px 0;
text-align: center;
margin-bottom: 40px;
}
.header h1 { font-size: 3rem; margin-bottom: 20px; }
.header p { font-size: 1.2rem; opacity: 0.9; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-bottom: 40px; }
.card {
background: white;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: transform 0.3s ease;
}
.card:hover { transform: translateY(-5px); }
.card h3 { color: #667eea; margin-bottom: 15px; font-size: 1.4rem; }
.card p { color: #666; margin-bottom: 20px; }
.btn {
display: inline-block;
padding: 12px 24px;
background: #667eea;
color: white;
text-decoration: none;
border-radius: 6px;
transition: background 0.3s ease;
}
.btn:hover { background: #5a6fd8; }
.examples { background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.examples h3 { color: #667eea; margin-bottom: 20px; }
.example-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 15px; }
.example-item {
padding: 15px;
background: #f8f9fa;
border-radius: 8px;
border-left: 4px solid #667eea;
}
.example-item strong { color: #333; }
.footer { text-align: center; margin-top: 60px; padding: 30px; color: #666; }
code {
background: #f4f4f4;
padding: 2px 6px;
border-radius: 4px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}
.highlight { background: #fff3cd; padding: 20px; border-radius: 8px; border-left: 4px solid #ffc107; margin: 20px 0; }
</style>
</head>
<body>
<div class="header">
<div class="container">
<h1>🦀 MCP Rust Examples</h1>
<p>Complete Learning Resource for Model Context Protocol Development with Rust</p>
</div>
</div>
<div class="container">
<div class="highlight">
<strong>🚀 Ready to start?</strong> Choose your learning path and begin building amazing MCP applications with Rust!
</div>
<div class="grid">
<div class="card">
<h3>📚 API Documentation</h3>
<p>Complete Rust API documentation for all examples and utilities. Generated from source code comments.</p>
<a href="mcp_rust_examples/index.html" class="btn">Browse API Docs</a>
</div>
<div class="card">
<h3>📖 Learning Tutorials</h3>
<p>Comprehensive tutorials covering MCP development from beginner to enterprise level.</p>
<a href="tutorials/mcp_rust_tutorial.html" class="btn">Start Learning</a>
</div>
<div class="card">
<h3>🎯 Quick Start</h3>
<p>Get up and running quickly with our step-by-step setup guide and first example.</p>
<div style="margin-top: 15px;">
<code>cargo run --bin example_01_hello_world</code>
</div>
</div>
<div class="card">
<h3>🛠️ Development Tools</h3>
<p>Local testing tools and scripts for development workflow optimization.</p>
<div style="margin-top: 15px;">
<code>./scripts/test-workflows.sh</code>
</div>
</div>
</div>
<div class="examples">
<h3>🎪 20 Complete Working Examples</h3>
<div class="example-list">
<div class="example-item">
<strong>Examples 1-5:</strong> Basic MCP Concepts<br>
<small>Hello World, Calculator, Text Processor, Resource Provider</small>
</div>
<div class="example-item">
<strong>Examples 6-10:</strong> Intermediate Features<br>
<small>Configuration, File Ops, HTTP Client, Database, Streaming</small>
</div>
<div class="example-item">
<strong>Examples 11-15:</strong> Advanced Patterns<br>
<small>Monitoring, Task Queues, Auth, Notifications, Data Pipeline</small>
</div>
<div class="example-item">
<strong>Examples 16-20:</strong> Enterprise Solutions<br>
<small>Search Engine, Blockchain, ML Server, Microservices, Complete App</small>
</div>
</div>
</div>
<div class="footer">
<p>🌟 <strong>Open Source Educational Resource</strong> | Built with ❤️ for the Rust and MCP Community</p>
<p>Updated automatically from the latest codebase</p>
</div>
</div>
</body>
</html>
EOF
# Convert README to HTML if pandoc is available
if command -v pandoc >/dev/null 2>&1; then
echo "Converting README to HTML..."
pandoc README.md -o target/doc/website/readme.html --standalone --css=../style.css 2>/dev/null || cp README.md target/doc/website/
else
echo "Pandoc not available, copying README as-is"
cp README.md target/doc/website/
fi
# Step 5.5: Install markdown processing tools and create tutorial HTML
- name: Install markdown processing tools
run: |
echo "Installing markdown processing tools..."
# Install pandoc for proper markdown to HTML conversion
sudo apt-get update
sudo apt-get install -y pandoc
# Install Python markdown for fallback
pip install markdown[extra] pygments
- name: Create beautiful tutorial HTML pages
run: |
echo "Creating beautiful tutorial HTML pages..."
# Create enhanced CSS for beautiful rendering
cat > target/doc/tutorials/tutorial-style.css << 'EOF'
/* Beautiful Tutorial Styling */
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
line-height: 1.7;
color: #2c3e50;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
min-height: 100vh;
}
.container {
background: white;
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
padding: 40px;
margin: 20px auto;
}
.nav {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 12px;
margin-bottom: 40px;
text-align: center;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.nav a {
color: white;
text-decoration: none;
margin: 0 20px;
padding: 8px 16px;
border-radius: 6px;
transition: background 0.3s ease;
}
.nav a:hover {
background: rgba(255,255,255,0.2);
text-decoration: none;
}
h1 {
color: #667eea;
font-size: 2.5rem;
margin-bottom: 30px;
text-align: center;
background: linear-gradient(135deg, #667eea, #764ba2);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
h2 {
color: #4a5568;
font-size: 1.8rem;
margin: 40px 0 20px 0;
padding-bottom: 10px;
border-bottom: 3px solid #667eea;
}
h3 {
color: #667eea;
font-size: 1.4rem;
margin: 30px 0 15px 0;
}
p {
margin-bottom: 20px;
text-align: justify;
}
pre {
background: #2d3748;
color: #e2e8f0;
padding: 20px;
border-radius: 8px;
overflow-x: auto;
border-left: 4px solid #667eea;
margin: 20px 0;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
code {
background: #edf2f7;
color: #e53e3e;
padding: 3px 8px;
border-radius: 4px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
font-size: 0.9em;
}
pre code {
background: transparent;
color: inherit;
padding: 0;
}
.example {
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
border: 1px solid #dee2e6;
border-radius: 12px;
padding: 25px;
margin: 25px 0;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.toc {
background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
padding: 25px;
border-radius: 12px;
margin: 30px 0;
border-left: 5px solid #2196f3;
}
.toc ul { list-style-type: none; padding-left: 20px; }
.toc > ul { padding-left: 0; }
.toc a { color: #1976d2; text-decoration: none; font-weight: 500; }
.toc a:hover { text-decoration: underline; color: #0d47a1; }
.highlight {
background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
border: 1px solid #ffeaa7;
border-radius: 8px;
padding: 20px;
margin: 25px 0;
border-left: 5px solid #f39c12;
}
.note {
background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
border: 1px solid #c3e6cb;
border-radius: 8px;
padding: 20px;
margin: 25px 0;
border-left: 5px solid #28a745;
}
.warning {
background: linear-gradient(135deg, #f8d7da 0%, #f1b2b7 100%);
border: 1px solid #f1b2b7;
border-radius: 8px;
padding: 20px;
margin: 25px 0;
border-left: 5px solid #dc3545;
}
ul, ol {
margin-bottom: 20px;
padding-left: 30px;
}
li {
margin-bottom: 8px;
}
strong {
color: #2d3748;
font-weight: 600;
}
em {
color: #667eea;
font-style: italic;
}
blockquote {
border-left: 4px solid #667eea;
padding-left: 20px;
margin: 20px 0;
font-style: italic;
color: #4a5568;
background: #f7fafc;
padding: 15px 20px;
border-radius: 0 8px 8px 0;
}
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
border-radius: 8px;
overflow: hidden;
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #e2e8f0;
}
th {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
font-weight: 600;
}
tr:hover {
background: #f8f9fa;
}
a {
color: #667eea;
text-decoration: none;
border-bottom: 1px solid transparent;
transition: border-color 0.3s ease;
}
a:hover {
border-bottom: 1px solid #667eea;
}
.footer {
text-align: center;
margin-top: 60px;
padding: 30px;
color: #718096;
border-top: 1px solid #e2e8f0;
}
EOF
# Create complete HTML template
cat > target/doc/tutorials/template.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MCP Rust Tutorial - Complete Learning Resource</title>
<link rel="stylesheet" href="tutorial-style.css">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🦀</text></svg>">
<meta name="description" content="Complete tutorial for learning MCP (Model Context Protocol) development with Rust">
<meta name="keywords" content="Rust, MCP, Model Context Protocol, Tutorial, Programming">
</head>
<body>
<div class="nav">
<a href="../index.html">🏠 Home</a>
<a href="../mcp_rust_examples/index.html">📚 API Docs</a>
<a href="mcp_rust_tutorial.html">📖 Tutorial</a>
<a href="../website/readme.html">📄 README</a>
</div>
<div class="container">
EOF
# Convert markdown to beautiful HTML using pandoc
if [ -f "mcp_rust_tutorial.md" ]; then
echo "Converting tutorial markdown to beautiful HTML..."
# Try pandoc with advanced features first
if pandoc mcp_rust_tutorial.md \
-f markdown+smart+pipe_tables+fenced_code_blocks+definition_lists \
-t html5 \
--standalone \
--toc \
--toc-depth=4 \
--section-divs \
--html-q-tags \
--highlight-style=tango \
--template=target/doc/tutorials/template.html \
-o target/doc/tutorials/mcp_rust_tutorial.html \
--metadata title="MCP Rust Tutorial - Complete Learning Resource" 2>/dev/null; then
# Add closing tags
echo '</div><div class="footer">🦀 <strong>MCP Rust Tutorial</strong> | Built with ❤️ for the Rust Community</div></body></html>' >> target/doc/tutorials/mcp_rust_tutorial.html
echo "✅ Beautiful tutorial HTML created successfully with pandoc!"
else
echo "⚠️ Pandoc failed, trying simpler conversion..."
# Fallback to basic pandoc conversion
if pandoc mcp_rust_tutorial.md \
-f markdown \
-t html5 \
--standalone \
--toc \
--template=target/doc/tutorials/template.html \
-o target/doc/tutorials/mcp_rust_tutorial.html 2>/dev/null; then
echo '</div><div class="footer">🦀 <strong>MCP Rust Tutorial</strong> | Built with ❤️ for the Rust Community</div></body></html>' >> target/doc/tutorials/mcp_rust_tutorial.html
echo "✅ Tutorial HTML created with basic pandoc conversion!"
else
echo "⚠️ Pandoc conversion failed, creating manual HTML..."
# Manual HTML creation as ultimate fallback
cat target/doc/tutorials/template.html > target/doc/tutorials/mcp_rust_tutorial.html
# Use a simple Python one-liner for markdown conversion
python3 -c "import markdown; print(markdown.markdown(open('mcp_rust_tutorial.md').read(), extensions=['toc', 'codehilite', 'tables']))" >> target/doc/tutorials/mcp_rust_tutorial.html
echo '</div><div class="footer">🦀 <strong>MCP Rust Tutorial</strong> | Built with ❤️ for the Rust Community</div></body></html>' >> target/doc/tutorials/mcp_rust_tutorial.html
echo "✅ Tutorial HTML created with Python markdown!"
fi
fi
else
echo "⚠️ Tutorial markdown not found, creating placeholder..."
cat target/doc/tutorials/template.html > target/doc/tutorials/mcp_rust_tutorial.html
echo '<h1>🚧 Tutorial Coming Soon</h1><p>The comprehensive MCP Rust tutorial will be available soon.</p></div></body></html>' >> target/doc/tutorials/mcp_rust_tutorial.html
fi
# Step 5.6: Create additional navigation and utility pages
- name: Create site navigation and utilities
run: |
echo "Creating additional site pages..."
# Create a sitemap for better navigation
cat > target/doc/sitemap.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Site Map - MCP Rust Examples</title>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; }
h1, h2 { color: #667eea; }
ul { list-style-type: none; padding-left: 20px; }
li { margin: 10px 0; }
a { color: #667eea; text-decoration: none; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<h1>🗺️ Site Map</h1>
<ul>
<li><a href="index.html">🏠 Home</a></li>
<li><a href="mcp_rust_examples/index.html">📚 API Documentation</a></li>
<li><a href="tutorials/mcp_rust_tutorial.html">📖 Complete Tutorial</a></li>
<li><a href="website/readme.html">📄 Project README</a></li>
</ul>
<h2>📁 Examples by Category</h2>
<ul>
<li><strong>Basic (1-5):</strong> Fundamentals and Core Concepts</li>
<li><strong>Intermediate (6-10):</strong> Configuration, I/O, and Data</li>
<li><strong>Advanced (11-15):</strong> Auth, Monitoring, and Async</li>
<li><strong>Enterprise (16-20):</strong> Search, Blockchain, ML, and Production</li>
</ul>
</body>
</html>
EOF
# Create a robots.txt for search engines
cat > target/doc/robots.txt << 'EOF'
User-agent: *
Allow: /
Sitemap: https://rustsandbox.github.io/MCP-Development-with-Rust/sitemap.html
EOF
# Create a custom 404 page
cat > target/doc/404.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Not Found - MCP Rust Examples</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
text-align: center;
padding: 50px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
min-height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.container { background: rgba(255,255,255,0.1); padding: 40px; border-radius: 12px; backdrop-filter: blur(10px); }
h1 { font-size: 4rem; margin-bottom: 20px; }
p { font-size: 1.2rem; margin-bottom: 30px; }
.btn {
display: inline-block;
padding: 12px 24px;
background: rgba(255,255,255,0.2);
color: white;
text-decoration: none;
border-radius: 6px;
transition: background 0.3s ease;
border: 2px solid white;
}
.btn:hover { background: rgba(255,255,255,0.3); }
</style>
</head>
<body>
<div class="container">
<h1>🦀 404</h1>
<p>Oops! The page you're looking for doesn't exist.</p>
<p>But don't worry, there's plenty of great content to explore!</p>
<a href="/MCP-Development-with-Rust/" class="btn">🏠 Go Home</a>
</div>
</body>
</html>
EOF
# Create a CNAME file for custom domain (if needed)
# Uncomment the line below if you have a custom domain
# echo "your-domain.com" > target/doc/CNAME
echo "✅ Site structure created successfully"
# Step 5.7: Ensure 404 page is created (fix for deployment issue)
- name: Create 404 page
run: |
echo "Creating 404.html page..."
cat > target/doc/404.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Not Found - MCP Rust Examples</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
text-align: center;
padding: 50px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
min-height: 100vh;
margin: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.container { background: rgba(255,255,255,0.1); padding: 40px; border-radius: 12px; backdrop-filter: blur(10px); }
h1 { font-size: 4rem; margin-bottom: 20px; }
p { font-size: 1.2rem; margin-bottom: 30px; }
.btn {
display: inline-block;
padding: 12px 24px;
background: rgba(255,255,255,0.2);
color: white;
text-decoration: none;
border-radius: 6px;
transition: background 0.3s ease;
border: 2px solid white;
}
.btn:hover { background: rgba(255,255,255,0.3); }
</style>
</head>
<body>
<div class="container">
<h1>🦀 404</h1>
<p>Oops! The page you're looking for doesn't exist.</p>
<p>But don't worry, there's plenty of great content to explore!</p>
<a href="/MCP-Development-with-Rust/" class="btn">🏠 Go Home</a>
</div>
</body>
</html>
EOF
echo "✅ 404.html created successfully"
# Step 6: Verify documentation structure
- name: Verify documentation
run: |
echo "Verifying comprehensive documentation structure..."
# Check if main documentation was generated
if [ ! -d "target/doc" ]; then
echo "❌ Documentation directory not found!"
exit 1
fi
# Verify main site structure
echo "🔍 Checking main site files..."
required_files=(
"target/doc/index.html"
"target/doc/404.html"
"target/doc/sitemap.html"
"target/doc/robots.txt"
)
for file in "${required_files[@]}"; do
if [ -f "$file" ]; then
echo "✅ $file exists"
else
echo "❌ $file missing"
exit 1
fi
done
# Check directory structure
echo "🔍 Checking directory structure..."
required_dirs=(
"target/doc/website"
"target/doc/tutorials"
)
for dir in "${required_dirs[@]}"; do
if [ -d "$dir" ]; then
echo "✅ $dir exists"
else
echo "❌ $dir missing"
exit 1
fi
done
# Check if Rust API documentation was generated
if [ -d "target/doc/mcp_rust_examples" ]; then
echo "✅ Rust API documentation generated"
else
echo "⚠️ Rust API documentation not found (may be normal)"
fi
# Count HTML files for statistics
html_count=$(find target/doc -name "*.html" | wc -l)
echo "📊 Statistics:"
echo " - Total HTML files: $html_count"
echo " - Site structure: Complete"
echo " - Ready for GitHub Pages: ✅"
# Display site structure
echo "🌐 Site structure overview:"
tree target/doc -L 3 2>/dev/null || find target/doc -type d | head -10
echo "✅ Documentation verification complete - Ready for deployment!"
# Step 7: Upload documentation artifacts
- name: Upload documentation artifacts
uses: actions/upload-artifact@v4
with:
name: rust-documentation
path: target/doc/
retention-days: 30
# Step 8: Setup Pages (only on main branch, and only if Pages is enabled)
- name: Setup Pages
id: setup-pages
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: actions/configure-pages@v4
continue-on-error: true
# Step 9: Upload to GitHub Pages (only if Pages setup succeeded)
- name: Upload to GitHub Pages
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && steps.setup-pages.outcome == 'success'
uses: actions/upload-pages-artifact@v3
with:
path: target/doc/
# Job 2: Deploy to GitHub Pages (only on main branch)
deploy-pages:
name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
needs: build-docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# Step 1: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# Job 3: Documentation quality checks
doc-quality:
name: Documentation Quality
runs-on: ubuntu-latest
steps:
# Step 1: Check out the source code
- name: Checkout source code
uses: actions/checkout@v4
# Step 2: Install Rust toolchain with Cargo.lock v4 support
- name: Install Rust toolchain
uses: dtolnay/[email protected]
# Step 3: Setup Rust caching
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
# Step 4: Check documentation coverage
- name: Check documentation coverage
run: |
echo "Checking documentation coverage..."
# Generate documentation with coverage information
cargo doc --all --no-deps --document-private-items 2>&1 | tee doc-output.log
# Check for missing documentation warnings
if grep -i "missing documentation" doc-output.log; then
echo "⚠️ Found missing documentation warnings"
else
echo "✅ No missing documentation warnings"
fi
# Check for broken intra-doc links
if grep -i "broken.*link" doc-output.log; then
echo "❌ Found broken documentation links"
exit 1
else
echo "✅ No broken documentation links"
fi
# Step 5: Validate README files
- name: Validate README files
run: |
echo "Validating README files..."
# Check if main README exists and has content
if [ -f "README.md" ] && [ -s "README.md" ]; then
echo "✅ Main README.md exists and has content"
else
echo "❌ README.md is missing or empty"
exit 1
fi
# Step 6: Generate documentation report
- name: Generate documentation report
run: |
echo "# Documentation Quality Report" > doc-report.md
echo "" >> doc-report.md
echo "Generated on: $(date)" >> doc-report.md
echo "Repository: ${{ github.repository }}" >> doc-report.md
echo "Commit: ${{ github.sha }}" >> doc-report.md
echo "" >> doc-report.md
echo "## Documentation Build Status" >> doc-report.md
if [ -d "target/doc" ]; then
echo "✅ Documentation built successfully" >> doc-report.md
# Count documentation files
html_files=$(find target/doc -name "*.html" | wc -l)
echo "- Generated $html_files HTML files" >> doc-report.md
else
echo "❌ Documentation build failed" >> doc-report.md
fi
echo "" >> doc-report.md
echo "---" >> doc-report.md
echo "*Report generated by GitHub Actions Documentation Workflow*" >> doc-report.md
# Step 7: Upload documentation report
- name: Upload documentation report
uses: actions/upload-artifact@v4
with:
name: documentation-report
path: doc-report.md
retention-days: 90