Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions .github/workflows/build-docs-optimized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,17 @@ jobs:
fi
done

# Create shared failure tracking file
failures_file="$(pwd)/../build_failures.txt"
touch "$failures_file"
export failures_file

# Create build script for parallel execution
cat > ../build_project.sh << 'EOF'
cat > ../build_project.sh << 'BUILDEOF'
#!/bin/bash
project="$1"
branch_slug="$2"
failures_file="$3"

echo "🔨 Building $project..."
cd "projects/$project"
Expand All @@ -190,9 +196,10 @@ jobs:
if [ $build_status -eq 0 ]; then
echo "✅ $project built successfully"
else
echo "⚠️ $project build failed, continuing..."
echo "⚠️ $project build failed (exit code: $build_status)"
echo "$project" >> "$failures_file"
fi
EOF
BUILDEOF

chmod +x ../build_project.sh

Expand All @@ -211,10 +218,24 @@ jobs:
# Use GNU parallel if available, otherwise use xargs with limited parallelism
if command -v parallel >/dev/null 2>&1; then
echo "Using GNU parallel for optimal performance..."
echo "$project_list" | tr ' ' '\n' | parallel -j4 ./build_project.sh {} "${{ env.BRANCH_SLUG }}"
echo "$project_list" | tr ' ' '\n' | parallel -j4 ./build_project.sh {} "${{ env.BRANCH_SLUG }}" "$failures_file"
else
echo "Using xargs for parallel builds..."
echo "$project_list" | tr ' ' '\n' | xargs -n1 -P4 -I{} ./build_project.sh {} "${{ env.BRANCH_SLUG }}"
echo "$project_list" | tr ' ' '\n' | xargs -n1 -P4 -I{} ./build_project.sh {} "${{ env.BRANCH_SLUG }}" "$failures_file"
fi

# Report build failure summary
if [ -s "$failures_file" ]; then
echo ""
echo "::group::Build Failure Summary"
echo "⚠️ The following projects had build failures:"
while IFS= read -r failed_project; do
echo " - $failed_project"
echo "::warning::Sphinx build failed for project: $failed_project"
done < "$failures_file"
echo "::endgroup::"
echo ""
echo "Note: Other projects built successfully and will be deployed."
fi

# For PRs, copy branch builds to main for version comparison
Expand Down Expand Up @@ -275,6 +296,14 @@ jobs:
cp -r versioned-docs/${{ env.BRANCH_SLUG }}/* versioned-docs/
fi

- name: Upload build artifact (for push deployments)
if: inputs.deployment_type == 'push'
uses: actions/upload-artifact@v4
with:
name: production-build
path: _build
retention-days: 1

- name: Setup Pages (for PR deployments)
if: inputs.deployment_type == 'pr'
uses: actions/configure-pages@v5
Expand Down
65 changes: 4 additions & 61 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,69 +38,12 @@ jobs:
environment:
name: ${{ github.ref_name }}
url: ${{ needs.build-docs.outputs.deploy-url }}
defaults:
run:
shell: bash -el {0}
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Upgrade conda
run: |
conda update -n base -c conda-forge conda -y -q
conda --version
shell: bash

- name: Setup Conda (for deployment)
uses: conda-incubator/setup-miniconda@v3
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
auto-update-conda: false
python-version: "3.13"
channels: conda-forge,defaults
channel-priority: true
environment-file: environment.yml
activate-environment: edbook
use-mamba: true

- name: Build for production deployment
run: |
# Use the optimized build for production
mkdir -p _build
cd projects

# Build projects in parallel with optimizations
project_list=""
for project in */; do
if [ -d "$project" ] && [ -f "$project/conf.py" ]; then
project_name=${project%/}
project_list="$project_list $project_name"

# Pre-create hover terms file
if [ ! -f "$project/LIST_OF_HOVER_TERMS.json" ]; then
echo "[]" > "$project/LIST_OF_HOVER_TERMS.json"
fi
fi
done

# Use xargs for parallel builds (more reliable than GNU parallel)
echo "$project_list" | tr ' ' '\n' | xargs -n1 -P4 -I{} bash -c '
project="{}"
echo "Building $project for production..."
cd "$project"
sphinx-build -b html -j auto -q --keep-going \
-D html_show_sourcelink=0 \
-D html_copy_source=0 \
. "../../_build/$project" || echo "Build failed for $project, continuing..."
'

cd ..

# Move forsida to root for production
if [ -d "_build/forsida" ]; then
echo "Moving forsida to root for production"
cp -r _build/forsida/* _build/
rm -rf _build/forsida
fi
name: production-build
path: _build

- name: Checkout edbook.github.io
uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions projects/forsida/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,7 @@ Háskóla Íslands og aðstoðar Stræðfræðistofu Raunvísindastofnunar.

Ábyrgðarmaður: Benedikt Magnússon <bsm@hi.is>.

.. raw:: html

<!-- deploy-verify: 002-fix-deploy-artifacts -->

Loading