Skip to content

Commit 6235336

Browse files
committed
docs and tests
1 parent 7e35194 commit 6235336

File tree

559 files changed

+394820
-7
lines changed

Some content is hidden

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

559 files changed

+394820
-7
lines changed

.github/workflows/ci.yml

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,15 @@ jobs:
238238
# Try to compile each .ora file (if we have a compiler binary)
239239
if [ -f "zig-out/bin/ora" ]; then
240240
echo "🚀 Testing compiler on examples..."
241-
find examples/ -name "*.ora" -exec echo "Compiling: {}" \; -exec ./zig-out/bin/ora {} \; || echo "⚠️ Some examples failed to compile"
241+
242+
# Run general examples test
243+
if [ -f "scripts/test-examples.sh" ]; then
244+
echo "📜 Running test-examples.sh script..."
245+
./scripts/test-examples.sh || echo "⚠️ Some examples failed via test script"
246+
else
247+
echo "ℹ️ No test-examples.sh script found, trying manual compilation..."
248+
find examples/ -name "*.ora" -exec echo "Compiling: {}" \; -exec ./zig-out/bin/ora {} \; || echo "⚠️ Some examples failed to compile"
249+
fi
242250
else
243251
echo "ℹ️ No compiler binary found, skipping example compilation"
244252
fi
@@ -248,6 +256,80 @@ jobs:
248256
249257
echo "✅ Examples processing completed"
250258
259+
struct-tests:
260+
name: Struct Implementation Tests
261+
runs-on: ${{ matrix.os }}
262+
needs: [lint, test]
263+
264+
strategy:
265+
matrix:
266+
os: [ubuntu-latest, macos-latest]
267+
268+
steps:
269+
- name: Checkout code
270+
uses: actions/checkout@v4
271+
with:
272+
submodules: recursive
273+
274+
- name: Setup Zig
275+
uses: goto-bus-stop/setup-zig@v2
276+
with:
277+
version: ${{ env.ZIG_VERSION }}
278+
279+
- name: Install system dependencies
280+
run: |
281+
echo "🔧 Installing system dependencies for ${{ runner.os }}..."
282+
case "${{ runner.os }}" in
283+
Linux)
284+
sudo apt-get update -qq
285+
sudo apt-get install -y \
286+
build-essential \
287+
cmake \
288+
libboost-all-dev \
289+
libssl-dev \
290+
pkg-config \
291+
git
292+
echo "✅ Linux dependencies installed"
293+
;;
294+
macOS)
295+
brew update
296+
brew install boost openssl cmake
297+
echo "✅ macOS dependencies installed"
298+
;;
299+
Windows)
300+
choco install boost-msvc-14.3 cmake openssl
301+
echo "✅ Windows dependencies installed"
302+
;;
303+
esac
304+
305+
- name: Cache Zig artifacts
306+
uses: actions/cache@v4
307+
with:
308+
path: |
309+
~/.cache/zig
310+
.zig-cache
311+
key: ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}-${{ hashFiles('build.zig', 'build.zig.zon') }}
312+
restore-keys: |
313+
${{ runner.os }}-zig-${{ env.ZIG_VERSION }}-
314+
315+
- name: Run struct tests
316+
run: |
317+
echo "🏗️ Running comprehensive struct tests..."
318+
./scripts/test-struct-examples.sh
319+
320+
- name: Run struct performance benchmarks
321+
run: |
322+
echo "⚡ Running struct performance benchmarks..."
323+
./scripts/test-struct-examples.sh --benchmark
324+
325+
- name: Upload test results
326+
uses: actions/upload-artifact@v4
327+
if: always()
328+
with:
329+
name: struct-test-results-${{ matrix.os }}
330+
path: test-results/
331+
retention-days: 30
332+
251333
- name: Upload build artifacts
252334
uses: actions/upload-artifact@v4
253335
if: success()
@@ -372,7 +454,7 @@ jobs:
372454
name: Release Check
373455
runs-on: ubuntu-latest
374456
if: github.ref == 'refs/heads/main'
375-
needs: [lint, test, examples, security]
457+
needs: [lint, test, examples, struct-tests, security]
376458

377459
steps:
378460
- name: Checkout code
@@ -444,11 +526,11 @@ jobs:
444526
name: Notification
445527
runs-on: ubuntu-latest
446528
if: always()
447-
needs: [lint, test, examples, security]
529+
needs: [lint, test, examples, struct-tests, security]
448530

449531
steps:
450532
- name: Notify on success
451-
if: needs.lint.result == 'success' && needs.test.result == 'success' && needs.examples.result == 'success'
533+
if: needs.lint.result == 'success' && needs.test.result == 'success' && needs.examples.result == 'success' && needs.struct-tests.result == 'success'
452534
run: |
453535
echo "✅ 🎉 All CI checks passed successfully!"
454536
echo "📊 Results:"

scripts/generate-docs.sh

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,52 @@ echo "🔨 Generating Zig documentation..."
1010
# Generate Zig docs
1111
zig build docs
1212

13-
echo "📁 Copying documentation to website..."
13+
echo "📁 Processing documentation for website..."
1414

1515
# Create target directory if it doesn't exist
1616
mkdir -p website/static/api-docs
1717

1818
# Copy generated docs to website static folder
1919
cp -r zig-out/docs/* website/static/api-docs/
2020

21-
echo "✅ API documentation generated and copied to website/static/api-docs/"
21+
# Extract sources.tar if it exists for better accessibility
22+
if [ -f "website/static/api-docs/sources.tar" ]; then
23+
echo "📦 Extracting sources.tar for better web accessibility..."
24+
cd website/static/api-docs
25+
tar -xf sources.tar
26+
# Create a simple redirect index for the extracted content
27+
if [ -d "src" ]; then
28+
echo '<!DOCTYPE html>
29+
<html>
30+
<head>
31+
<meta charset="utf-8">
32+
<title>Ora API Documentation</title>
33+
<style>
34+
body { font-family: system-ui, -apple-system, sans-serif; margin: 40px; }
35+
h1 { color: #2563eb; }
36+
.links { margin-top: 20px; }
37+
.links a { display: block; margin: 10px 0; color: #1d4ed8; text-decoration: none; }
38+
.links a:hover { text-decoration: underline; }
39+
</style>
40+
</head>
41+
<body>
42+
<h1>Ora API Documentation</h1>
43+
<div class="links">
44+
<a href="src/root.zig.html">Root Module</a>
45+
<a href="src/ast.zig.html">AST Module</a>
46+
<a href="src/typer.zig.html">Type System</a>
47+
<a href="src/ir.zig.html">IR (HIR) Module</a>
48+
<a href="src/codegen_yul.zig.html">Yul Code Generation</a>
49+
<a href="src/parser.zig.html">Parser Module</a>
50+
<a href="src/lexer.zig.html">Lexer Module</a>
51+
</div>
52+
</body>
53+
</html>' > docs-index.html
54+
fi
55+
cd ../../..
56+
fi
57+
58+
echo "✅ API documentation generated and processed for website/static/api-docs/"
2259
echo "📖 Documentation will be available at /api-docs/ when the website is built"
2360

2461
# Optional: Start development server if requested

0 commit comments

Comments
 (0)