Skip to content

Commit

Permalink
Test if the website works correctly with these exclusions + check sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdmc committed Nov 29, 2024
1 parent 4464525 commit b2ab56f
Showing 1 changed file with 48 additions and 22 deletions.
70 changes: 48 additions & 22 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ before_script:
build-book:
stage: build
script:
# Build logic remains same
# Previous build steps...
- |
if [ "$CI_COMMIT_BRANCH" == "release" ]; then
echo "Building production version"
Expand All @@ -34,48 +34,74 @@ build-book:
teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2)
fi
# Size debugging
- echo "Initial directory sizes:"
- du -sh book/_build/* | tee build_debug.log
- echo "Files larger than 5MB:"
- find book/_build -type f -size +5M -exec ls -lh {} \; >> build_debug.log
# Size analysis
- echo "=== Size Analysis ===" | tee size_analysis.log
- echo "Directory Sizes:" | tee -a size_analysis.log
- du -sh book/_build/* | tee -a size_analysis.log

- echo -e "\nSize by File Type:" | tee -a size_analysis.log
- echo "HTML files:" | tee -a size_analysis.log
- find book/_build/html -name "*.html" -type f -exec du -ch {} + | grep total$ | tee -a size_analysis.log

- echo "JavaScript files:" | tee -a size_analysis.log
- find book/_build/html -name "*.js" -type f -exec du -ch {} + | grep total$ | tee -a size_analysis.log

- echo "CSS files:" | tee -a size_analysis.log
- find book/_build/html -name "*.css" -type f -exec du -ch {} + | grep total$ | tee -a size_analysis.log

- echo "Map files:" | tee -a size_analysis.log
- find book/_build/html -name "*.map" -type f -exec du -ch {} + | grep total$ | tee -a size_analysis.log

- echo -e "\nLargest Files (>1MB):" | tee -a size_analysis.log
- find book/_build -type f -size +1M -exec ls -lh {} \; | sort -k5 -hr | tee -a size_analysis.log

- echo -e "\nFile counts by type:" | tee -a size_analysis.log
- echo "HTML: $(find book/_build/html -name '*.html' | wc -l)" | tee -a size_analysis.log
- echo "JS: $(find book/_build/html -name '*.js' | wc -l)" | tee -a size_analysis.log
- echo "CSS: $(find book/_build/html -name '*.css' | wc -l)" | tee -a size_analysis.log
- echo "Images: $(find book/_build/html/_images -type f | wc -l)" | tee -a size_analysis.log
- echo "IPython Notebooks: $(find book/_build -name '*.ipynb' | wc -l)" | tee -a size_analysis.log

- echo $CI_JOB_ID > build_job_id.txt

artifacts:
paths:
# HTML and static content
- book/_build/html/**/*.html
- book/_build/html/**/*.css
- book/_build/html/**/*.js
# Essential web content
- book/_build/html/**/*.{html,css,js}
- book/_build/html/_images/**
- book/_build/html/_static/**
- book/_build/html/_custom_downloads/**
- book/_build/html/genindex.html
- book/_build/html/search.html

# Keep core JavaScript functionality
- book/_build/html/_static/index.js
- book/_build/html/_static/jquery.js
- book/_build/html/_static/underscore.js
# Required for interactive features
- book/_build/jupyter_execute/**/*.html
- book/_build/html/_static/scripts/**

# Build logs and ID
- book/_build/*.log
# Logs and build info
- build_job_id.txt
- build_debug.log
- stdout.log
- stderr.log

exclude:
# Large unnecessary files
# Development/build files
- "**/*.js.map"
- "**/*.doctree"
- "**/*.ipynb"
- "**/_sources/**"

# Build artifacts
- "**/__pycache__/**"
- "**/*.pyc"
- "**/*.pickle"
- book/_build/.doctrees/**
- book/_build/jupyter_cache/**
- "**/*.pickle"
# Keep notebooks for interactive features
# - "**/*.ipynb"

# # Build artifacts
# - "**/__pycache__/**"
# - "**/*.pyc"
# - book/_build/.doctrees/**
# - book/_build/jupyter_cache/**
# - "**/*.pickle"

expire_in: 1 week

Expand Down

0 comments on commit b2ab56f

Please sign in to comment.