Skip to content

Remove println, move to logging #529

Remove println, move to logging

Remove println, move to logging #529

Workflow file for this run

# .github/workflows/rust.yml
#
# Two modes:
#
# - ci: Runs on push/PR, builds everything, runs tests, creates artifacts
# - deploy: Manual trigger, downloads CI artifacts, deploys to GitHub Pages
name: build
on:
push:
branches:
- 'master'
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
pull_request:
workflow_dispatch:
inputs:
run_mode:
description: 'Select the workflow to run'
type: choice
options:
- ci
- deploy
required: true
default: 'ci'
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# =============================================================================
# CI Jobs - Run on push, PR, or manual 'ci' mode
# =============================================================================
lint_and_check:
name: Lint & Static Checks
if: github.event_name != 'workflow_dispatch' || github.event.inputs.run_mode == 'ci' || github.event.inputs.run_mode == 'deploy'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.87.0
- name: Run autofix and normalize
run: |
cargo run -r -p azul-doc autofix
cargo run -r -p azul-doc autofix explain
cargo run -r -p azul-doc patch safe target/autofix/patches
cargo run -r -p azul-doc patch target/autofix/patches
cargo run -r -p azul-doc normalize
- name: Check for uncommitted changes after autofix
run: |
if ! git diff --quiet; then
echo "There are uncommitted content changes after running autofix:"
git diff --stat
git diff
exit 1
elif [[ -n $(git status --porcelain) ]]; then
echo "Files touched but no content changes - resetting:"
git checkout -- .
echo "Reset complete, continuing..."
else
echo "No uncommitted changes after autofix."
fi
- name: Generate DLL API bindings and run tests
run: |
cargo run -r -p azul-doc codegen all
cd dll && cargo test
- name: Check crates
run: |
cargo check -p azul-css
cargo check -p azul-core
cargo check -p azul-layout
cargo check -p azul-dll --no-default-features --features "link-static,logging,ico,tga,hdr,webp,pnm,gif,png,tiff,bmp,a11y"
test_heavy:
name: Run Heavy Tests (Miri + Reftests)
if: github.event_name != 'workflow_dispatch' || github.event.inputs.run_mode == 'ci' || github.event.inputs.run_mode == 'deploy'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.87.0
- name: Install Miri
run: |
rustup toolchain install nightly --component miri
cargo +nightly miri setup
- name: Run Miri tests
run: cargo +nightly miri test --lib -p azul-core
- name: Generate DLL API bindings
run: cargo run -r -p azul-doc codegen all
- name: Setup Chrome
uses: browser-actions/setup-chrome@v1
- name: Cache Chrome reference images
uses: actions/cache@v4
with:
path: doc/target/reftest/reftest_img/*_chrome.webp
key: reftest-chrome-images-${{ hashFiles('doc/working/*.xhtml') }}
restore-keys: reftest-chrome-images-
- name: Run reftests
run: cargo run -r -p azul-doc reftest
- name: Upload reftest results
uses: actions/upload-artifact@v4
if: always()
with:
name: reftest-results
path: |
doc/target/reftest/index.html
doc/target/reftest/results.json
doc/target/reftest/reftest_img/
retention-days: 30
if-no-files-found: warn
ffi_safety_tests:
name: FFI Safety Tests (${{ matrix.os }})
if: github.event_name != 'workflow_dispatch' || github.event.inputs.run_mode == 'ci' || github.event.inputs.run_mode == 'deploy'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
timeout_cmd: timeout
- os: macos-14
timeout_cmd: gtimeout
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.87.0
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get update && sudo apt-get install -y clang lldb
- name: Install dependencies (macOS)
if: matrix.os == 'macos-14'
run: brew install coreutils
- name: Install Miri
run: |
rustup toolchain install nightly --component miri
cargo +nightly miri setup
- name: Generate DLL API bindings
run: cargo run -r -p azul-doc codegen all
- name: Build azul-dll (debug)
run: cargo build -p azul-dll --features build-dll
- name: Compile C hello-world with ASan
run: |
cp target/codegen/v2/azul.h examples/c/
cd examples/c
clang -g -O0 -fsanitize=address -I. hello-world.c -L../../target/debug -lazul -o hello-world-asan
- name: Run C hello-world with ASan
working-directory: examples/c
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/target/debug
DYLD_LIBRARY_PATH: ${{ github.workspace }}/target/debug
ASAN_OPTIONS: detect_leaks=0,abort_on_error=1
AZUL_EXIT_SUCCESS_AFTER_FRAME_RENDER: "1"
run: ${{ matrix.timeout_cmd }} 30 ./hello-world-asan || [ $? -eq 124 ]
- name: Run Miri on azul-dll
run: cargo +nightly miri test --lib -p azul-dll -- --nocapture
build_binaries:
name: Build Binaries (${{ matrix.os }})
if: github.event_name != 'workflow_dispatch' || github.event.inputs.run_mode == 'ci' || github.event.inputs.run_mode == 'deploy'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
artifact_name: azul-linux-amd64
artifact_path: |
target/release/libazul.so
target/release/libazul.a
target/release/azul.so
- os: macos-14
artifact_name: azul-macos-amd64
artifact_path: |
target/release/libazul.dylib
target/release/libazul.a
target/release/azul.so
- os: windows-2022
artifact_name: azul-windows-amd64
artifact_path: |
target/release/azul.dll
target/release/azul.lib
target/release/azul.dll.lib
target/release/azul.pyd
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.87.0
- name: Install clang (Linux)
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get update && sudo apt-get install -y clang libgl1-mesa-dev libx11-dev xvfb
- name: Install MinGW (Windows)
if: matrix.os == 'windows-2022'
shell: bash
run: choco install mingw -y
- name: Install coreutils (macOS)
if: matrix.os == 'macos-14'
run: brew install coreutils
- name: Generate DLL API bindings
run: cargo run -r -p azul-doc codegen all
- name: Validate C header syntax (Linux)
if: matrix.os == 'ubuntu-22.04'
run: |
cd target/codegen/v2
clang -fsyntax-only -std=c99 -x c azul.h
echo "C header (C99) compiles successfully"
- name: Validate C++ headers (Linux)
if: matrix.os == 'ubuntu-22.04'
run: |
cd target/codegen/v2
clang++ -std=c++03 -fsyntax-only -I. azul03.hpp && echo "C++03 ✓"
clang++ -std=c++11 -fsyntax-only -I. azul11.hpp && echo "C++11 ✓"
clang++ -std=c++14 -fsyntax-only -I. azul14.hpp && echo "C++14 ✓"
clang++ -std=c++17 -fsyntax-only -I. azul17.hpp && echo "C++17 ✓"
clang++ -std=c++20 -fsyntax-only -I. azul20.hpp && echo "C++20 ✓"
clang++ -std=c++2b -fsyntax-only -I. azul23.hpp && echo "C++23 ✓"
- name: Compile C examples (syntax check)
if: matrix.os != 'windows-2022'
shell: bash
run: |
cd examples/c
for example in *.c; do
[ -f "$example" ] && clang -fsyntax-only -std=c99 -I../../target/codegen/v2 "$example" && echo "✓ $example"
done
- name: Compile C++ examples (syntax check)
if: matrix.os != 'windows-2022'
shell: bash
run: |
for std in cpp03:c++03 cpp11:c++11 cpp14:c++14 cpp17:c++17 cpp23:c++2b; do
dir="${std%:*}"
flag="${std#*:}"
if [ -d "examples/cpp/$dir" ]; then
cd "examples/cpp/$dir"
for example in *.cpp; do
[ -f "$example" ] && clang++ -fsyntax-only -std=$flag -I../../../target/codegen/v2 "$example" && echo "✓ $dir/$example"
done
cd ../../..
fi
done
- name: Build DLL (for C/C++ examples)
run: cargo build --release -p azul-dll --features="build-dll"
- name: Build Rust examples
run: cargo check --verbose --examples --all-features
- name: Take screenshots (Linux)
if: matrix.os == 'ubuntu-22.04'
continue-on-error: true
run: |
chmod +x scripts/screenshot_single.sh
mkdir -p target/screenshots
PORT=8780
for example in hello-world widgets opengl infinity async xhtml calc; do
echo "=== Taking screenshot for $example on port $PORT ==="
xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" \
./scripts/screenshot_single.sh "$example" "$PORT" || echo "Screenshot for $example failed"
# Copy screenshot to target/screenshots with OS suffix
if [ -f "target/examples-temp/$example/${example}_screenshot.png" ]; then
cp "target/examples-temp/$example/${example}_screenshot.png" "target/screenshots/${example}-linux.png"
echo " -> Saved target/screenshots/${example}-linux.png"
fi
PORT=$((PORT + 1))
done
ls -la target/screenshots/ || echo "No screenshots directory"
- name: Take screenshots (macOS)
if: matrix.os == 'macos-14'
continue-on-error: true
run: |
chmod +x scripts/screenshot_single.sh
mkdir -p target/screenshots
PORT=8780
for example in hello-world widgets opengl infinity async xhtml calc; do
echo "=== Taking screenshot for $example on port $PORT ==="
./scripts/screenshot_single.sh "$example" "$PORT" || echo "Screenshot for $example failed"
# Copy screenshot to target/screenshots with OS suffix
if [ -f "target/examples-temp/$example/${example}_screenshot.png" ]; then
cp "target/examples-temp/$example/${example}_screenshot.png" "target/screenshots/${example}-macos.png"
echo " -> Saved target/screenshots/${example}-macos.png"
fi
PORT=$((PORT + 1))
done
ls -la target/screenshots/ || echo "No screenshots directory"
- name: Take screenshots (Windows)
if: matrix.os == 'windows-2022'
continue-on-error: true
shell: bash
run: |
chmod +x scripts/screenshot_single.sh
mkdir -p target/screenshots
PORT=8780
for example in hello-world widgets opengl infinity async xhtml calc; do
echo "=== Taking screenshot for $example on port $PORT ==="
./scripts/screenshot_single.sh "$example" "$PORT" || echo "Screenshot for $example failed"
# Copy screenshot to target/screenshots with OS suffix
if [ -f "target/examples-temp/$example/${example}_screenshot.png" ]; then
cp "target/examples-temp/$example/${example}_screenshot.png" "target/screenshots/${example}-windows.png"
echo " -> Saved target/screenshots/${example}-windows.png"
fi
PORT=$((PORT + 1))
done
ls -la target/screenshots/ || echo "No screenshots directory"
- name: Build Python extension
run: cargo build --release -p azul-dll --lib --features="python-extension"
- name: Rename Python extension (Windows)
if: matrix.os == 'windows-2022'
shell: bash
run: cp target/release/azul.dll target/release/azul.pyd
- name: Rename Python extension (Linux)
if: matrix.os == 'ubuntu-22.04'
run: cp target/release/libazul.so target/release/azul.so
- name: Rename Python extension (macOS)
if: matrix.os == 'macos-14'
run: cp target/release/libazul.dylib target/release/azul.so
- name: Test Python extension import
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-2022" ]; then
export PATH=$PATH:$(pwd)/target/release
python3 -c "import sys; sys.path.insert(0, 'target/release'); import azul; print('Python extension loaded!')"
else
cp target/release/azul.so examples/python/
cd examples/python && python3 -c "import azul; print('Python extension loaded!')"
fi
- name: Upload Screenshots
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: screenshots-${{ matrix.os }}
path: target/screenshots/*.png
retention-days: 7
if-no-files-found: ignore
- name: Debug - Tree before upload
shell: bash
run: |
echo "=== target/release ==="
ls -la target/release/ 2>/dev/null | head -30 || echo "Not found"
echo "=== target/codegen/v2 ==="
ls -la target/codegen/v2/ 2>/dev/null | head -20 || echo "Not found"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_path }}
retention-days: 30
if-no-files-found: error
- name: Upload Headers (Linux only)
if: matrix.os == 'ubuntu-22.04'
uses: actions/upload-artifact@v4
with:
name: azul-headers
path: |
target/codegen/v2/azul.h
target/codegen/v2/azul03.hpp
target/codegen/v2/azul11.hpp
target/codegen/v2/azul14.hpp
target/codegen/v2/azul17.hpp
target/codegen/v2/azul20.hpp
target/codegen/v2/azul23.hpp
retention-days: 30
if-no-files-found: error
build_linux_packages:
name: Build Linux Packages (.deb/.rpm)
if: github.event_name != 'workflow_dispatch' || github.event.inputs.run_mode == 'ci' || github.event.inputs.run_mode == 'deploy'
needs: [build_binaries, build_website_skeleton]
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download Linux binaries
uses: actions/download-artifact@v4
with:
name: azul-linux-amd64
path: artifacts
- name: Download NFPM config
uses: actions/download-artifact@v4
with:
name: nfpm-config
path: nfpm-config
- name: Install NFPM
run: |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt-get update
sudo apt-get install -y nfpm tree
- name: Debug - Tree after download
run: |
echo "=== Downloaded artifacts ==="
tree artifacts/ nfpm-config/ 2>/dev/null || ls -laR artifacts/ nfpm-config/
- name: Prepare package files
run: |
mkdir -p target/packages
find artifacts -name "libazul.so" -exec cp {} target/packages/ \;
find nfpm-config -name "azul.h" -exec cp {} target/packages/ \;
find nfpm-config -name "nfpm.yaml" -exec cp {} target/packages/ \;
cp LICENSE target/packages/
ls -la target/packages/
- name: Build .deb and .rpm packages
run: |
cd target/packages
nfpm pkg --packager deb --target .
nfpm pkg --packager rpm --target .
- name: Debug - Tree before upload
run: |
echo "=== target/packages ==="
tree target/packages/ 2>/dev/null || ls -la target/packages/
- name: Upload .deb package
uses: actions/upload-artifact@v4
with:
name: azul-linux-amd64-deb
path: target/packages/*.deb
retention-days: 30
if-no-files-found: error
- name: Upload .rpm package
uses: actions/upload-artifact@v4
with:
name: azul-linux-amd64-rpm
path: target/packages/*.rpm
retention-days: 30
if-no-files-found: error
build_website_skeleton:
name: Build Website Skeleton
if: github.event_name != 'workflow_dispatch' || github.event.inputs.run_mode == 'ci' || github.event.inputs.run_mode == 'deploy'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.87.0
- name: Generate codegen and NFPM config
run: |
cargo run -r -p azul-doc codegen all
cargo run -r -p azul-doc nfpm
- name: Create placeholder binaries
run: |
# Create placeholder files where real binaries will be inserted later
mkdir -p doc/target/deploy/release/1.0.0-alpha1
touch doc/target/deploy/release/1.0.0-alpha1/libazul.so
touch doc/target/deploy/release/1.0.0-alpha1/libazul.linux.a
touch doc/target/deploy/release/1.0.0-alpha1/azul.cpython.so
touch doc/target/deploy/release/1.0.0-alpha1/libazul.dylib
touch doc/target/deploy/release/1.0.0-alpha1/libazul.macos.a
touch doc/target/deploy/release/1.0.0-alpha1/azul.macos.so
touch doc/target/deploy/release/1.0.0-alpha1/azul.dll
touch doc/target/deploy/release/1.0.0-alpha1/azul.lib
touch doc/target/deploy/release/1.0.0-alpha1/azul.dll.lib
touch doc/target/deploy/release/1.0.0-alpha1/azul.pyd
# Placeholder reftest
mkdir -p doc/target/reftest/reftest_img
echo '[]' > doc/target/reftest/results.json
echo '<html><body>Placeholder</body></html>' > doc/target/reftest/index.html
- name: Build website with placeholders
run: cargo run --manifest-path doc/Cargo.toml --release -- deploy
- name: Debug - Tree before upload
run: |
sudo apt-get update && sudo apt-get install -y tree
tree doc/target/deploy/ 2>/dev/null | head -100 || ls -laR doc/target/deploy/ | head -100
- name: Upload website skeleton
uses: actions/upload-artifact@v4
with:
name: website-skeleton
path: doc/target/deploy/
retention-days: 30
if-no-files-found: error
- name: Upload NFPM config and headers
uses: actions/upload-artifact@v4
with:
name: nfpm-config
path: |
target/packages/nfpm.yaml
target/codegen/v2/azul.h
retention-days: 30
if-no-files-found: error
# =============================================================================
# Deploy Job - Only runs on manual 'deploy' mode
# Downloads all artifacts and merges them (NO compilation)
# =============================================================================
deploy_pages:
name: Deploy to GitHub Pages
if: github.event.inputs.run_mode == 'deploy'
needs: [test_heavy, build_binaries, build_linux_packages, build_website_skeleton]
runs-on: ubuntu-22.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository (for fallback assets)
uses: actions/checkout@v4
with:
sparse-checkout: |
examples/assets/screenshots
sparse-checkout-cone-mode: false
- name: Download website skeleton
uses: actions/download-artifact@v4
with:
name: website-skeleton
path: website
- name: Download Linux binaries
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: azul-linux-amd64
path: artifacts-linux
- name: Download macOS binaries
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: azul-macos-amd64
path: artifacts-macos
- name: Download Windows binaries
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: azul-windows-amd64
path: artifacts-windows
- name: Download .deb package
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: azul-linux-amd64-deb
path: artifacts-deb
- name: Download .rpm package
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: azul-linux-amd64-rpm
path: artifacts-rpm
- name: Download headers
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: azul-headers
path: artifacts-headers
- name: Download reftest results
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: reftest-results
path: artifacts-reftest
- name: Download Linux screenshots
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: screenshots-ubuntu-22.04
path: artifacts-screenshots-linux
- name: Download macOS screenshots
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: screenshots-macos-14
path: artifacts-screenshots-macos
- name: Download Windows screenshots
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: screenshots-windows-2022
path: artifacts-screenshots-windows
- name: Debug - Tree after download
run: |
sudo apt-get update && sudo apt-get install -y tree
echo "=== Website skeleton ==="
tree website/ 2>/dev/null | head -50 || ls -laR website/ | head -50
echo ""
echo "=== Artifacts ==="
tree artifacts-* 2>/dev/null || ls -laR artifacts-* 2>/dev/null || true
- name: Merge real artifacts into website
run: |
RELEASE_DIR="website/release/1.0.0-alpha1"
mkdir -p "$RELEASE_DIR"
# Replace placeholder binaries with real ones
# Linux
find artifacts-linux -name "libazul.so" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
find artifacts-linux -name "libazul.a" -exec cp {} "$RELEASE_DIR/libazul.linux.a" \; 2>/dev/null || true
find artifacts-linux -name "azul.so" -exec cp {} "$RELEASE_DIR/azul.cpython.so" \; 2>/dev/null || true
# macOS
find artifacts-macos -name "libazul.dylib" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
find artifacts-macos -name "libazul.a" -exec cp {} "$RELEASE_DIR/libazul.macos.a" \; 2>/dev/null || true
find artifacts-macos -name "azul.so" -exec cp {} "$RELEASE_DIR/azul.macos.so" \; 2>/dev/null || true
# Windows
find artifacts-windows -name "azul.dll" ! -name "*.lib" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
find artifacts-windows -name "azul.lib" ! -name "azul.dll.lib" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
find artifacts-windows -name "azul.dll.lib" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
find artifacts-windows -name "azul.pyd" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
# Headers
find artifacts-headers -name "*.h" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
find artifacts-headers -name "*.hpp" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
# Packages
find artifacts-deb -name "*.deb" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
find artifacts-rpm -name "*.rpm" -exec cp {} "$RELEASE_DIR/" \; 2>/dev/null || true
# Replace placeholder reftest with real results
if [ -d artifacts-reftest ]; then
rm -rf website/reftest 2>/dev/null || true
mkdir -p website/reftest
cp -r artifacts-reftest/* website/reftest/
# Also copy index.html to reftest.html in website root
if [ -f website/reftest/index.html ]; then
cp website/reftest/index.html website/reftest.html
echo " [OK] Created reftest.html from reftest results"
fi
# Copy reftest_img to website root so ./reftest_img/ paths work from reftest.html
if [ -d website/reftest/reftest_img ]; then
cp -r website/reftest/reftest_img website/reftest_img
echo " [OK] Copied reftest_img to website root"
fi
fi
# Copy screenshots to website images directory
# Screenshots are named like "hello-world-linux.png" and need to be renamed to "hello-world.linux.png"
mkdir -p website/images
# First, copy CI-generated screenshots
for screenshot_dir in artifacts-screenshots-linux artifacts-screenshots-macos artifacts-screenshots-windows; do
if [ -d "$screenshot_dir" ]; then
for png in "$screenshot_dir"/*.png; do
if [ -f "$png" ]; then
filename=$(basename "$png")
# Extract OS from directory name
case "$screenshot_dir" in
*linux*) os="linux" ;;
*macos*) os="mac" ;;
*windows*) os="windows" ;;
esac
# Convert "hello-world-linux.png" to "hello-world.linux.png"
# The filename already has the OS in it, so we just rename
newname=$(echo "$filename" | sed "s/-${os}/.${os}/")
cp "$png" "website/images/$newname"
echo " [OK] Copied screenshot: $newname"
fi
done
fi
done
# Then, copy fallback screenshots from examples/assets/screenshots for any missing images
echo "Checking for missing screenshots, using fallbacks from examples/assets/screenshots..."
for example in hello-world widgets opengl infinity async xhtml calc; do
for os in linux mac windows; do
target="website/images/${example}.${os}.png"
if [ ! -f "$target" ]; then
# Try to find a fallback
fallback="examples/assets/screenshots/${example}.${os}.png"
if [ -f "$fallback" ]; then
cp "$fallback" "$target"
echo " [FALLBACK] Copied $fallback -> $target"
else
# Try mac screenshot as fallback for all platforms
mac_fallback="examples/assets/screenshots/${example}.mac.png"
if [ -f "$mac_fallback" ]; then
cp "$mac_fallback" "$target"
echo " [FALLBACK] Copied $mac_fallback -> $target (mac as fallback)"
else
echo " [MISSING] No screenshot for ${example}.${os}.png"
fi
fi
fi
done
done
ls -la website/images/ || echo "No images directory"
# Update file sizes in release HTML
# The HTML contains placeholder sizes like "86B" that need to be replaced with real sizes
# Format in HTML: "filename - 86B)" needs to become "filename - 80.5MB)"
if [ -d "$RELEASE_DIR" ]; then
echo "Updating file sizes in release HTML..."
for file in "$RELEASE_DIR"/*; do
if [ -f "$file" ]; then
filename=$(basename "$file")
# Get size in bytes and format it
size_bytes=$(stat -f%z "$file" 2>/dev/null || stat -c%s "$file" 2>/dev/null || echo "0")
if [ "$size_bytes" -lt 1024 ]; then
size="${size_bytes}B"
elif [ "$size_bytes" -lt 1048576 ]; then
size="$(echo "scale=1; $size_bytes / 1024" | bc)KB"
else
size="$(echo "scale=1; $size_bytes / 1048576" | bc)MB"
fi
echo " $filename: $size"
# Find and update the size in release HTML files
# Match pattern: "filename - XXXB)" or "filename - X.XKB)" etc.
for html in website/release/*.html; do
if [ -f "$html" ]; then
# Use sed to replace any size pattern for this filename
sed -i "s|${filename} - [0-9.]*[BKMG]B*)|${filename} - ${size})|g" "$html" 2>/dev/null || \
sed -i '' "s|${filename} - [0-9.]*[BKMG]B*)|${filename} - ${size})|g" "$html" 2>/dev/null || true
# Also replace "not available"
sed -i "s|${filename} - not available|${filename} - ${size}|g" "$html" 2>/dev/null || \
sed -i '' "s|${filename} - not available|${filename} - ${size}|g" "$html" 2>/dev/null || true
fi
done
fi
done
fi
echo "=== Final release artifacts ==="
ls -la "$RELEASE_DIR/"
- name: Debug - Final website tree
run: tree website/ 2>/dev/null | head -100 || ls -laR website/ | head -100
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'website'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4