test case without docs
#5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Blueprint | |
# Trigger the workflow on push events to the main / master branch | |
on: | |
push: | |
branches: ["main"] # Trigger on pushes to the "main" branch (replace "main" with your default branch if different) | |
workflow_dispatch: # Allow manual triggering of the workflow from the GitHub Actions interface | |
# Set permissions for the workflow | |
permissions: | |
contents: read # Read access to repository contents | |
pages: write # Write access to GitHub Pages | |
id-token: write # Write access to ID tokens | |
jobs: | |
build_project: | |
runs-on: ubuntu-latest | |
name: Build project | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags | |
- name: Install elan | |
run: curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none | |
- name: Get cache | |
run: ~/.elan/bin/lake -Kenv=dev exe cache get || true | |
- name: Build project | |
run: ~/.elan/bin/lake -Kenv=dev build Project | |
- name: Cache mathlib documentation | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.lake/build/doc/Init | |
.lake/build/doc/Lake | |
.lake/build/doc/Lean | |
.lake/build/doc/Std | |
.lake/build/doc/Mathlib | |
.lake/build/doc/declarations | |
.lake/build/doc/find | |
.lake/build/doc/*.* | |
!.lake/build/doc/declarations/declaration-data-Project* | |
key: MathlibDoc-${{ hashFiles('lake-manifest.json') }} | |
restore-keys: MathlibDoc- | |
- name: Build project documentation | |
run: ~/.elan/bin/lake -Kenv=dev build Project:docs | |
- name: Check for existing `docs` folder | |
id: check_docs | |
run: | | |
if [ -d docs ]; then | |
echo "The 'docs' folder already exists in the repository." | |
echo "DOCS_EXIST=true" >> $GITHUB_ENV | |
else | |
echo "The 'docs' folder does not exist in the repository." | |
echo "DOCS_EXIST=false" >> $GITHUB_ENV | |
fi | |
- name: Build blueprint and copy to `docs/blueprint` | |
uses: xu-cheng/texlive-action@v2 | |
with: | |
docker_image: ghcr.io/xu-cheng/texlive-full:20231201 | |
run: | | |
# Install necessary dependencies and build the blueprint | |
export PIP_BREAK_SYSTEM_PACKAGES=1 | |
apk update | |
apk add --update make py3-pip git pkgconfig graphviz graphviz-dev gcc musl-dev | |
git config --global --add safe.directory $GITHUB_WORKSPACE | |
git config --global --add safe.directory `pwd` | |
python3 -m venv env | |
source env/bin/activate | |
pip install --upgrade pip requests wheel | |
pip install pygraphviz --global-option=build_ext --global-option="-L/usr/lib/graphviz/" --global-option="-R/usr/lib/graphviz/" | |
pip install leanblueprint | |
leanblueprint pdf | |
if [ ! -d docs ]; then mkdir docs; fi | |
cp blueprint/print/print.pdf docs/blueprint.pdf | |
leanblueprint web | |
cp -r blueprint/web docs/blueprint | |
- name: Check declarations | |
run: ~/.elan/bin/lake exe checkdecls blueprint/lean_decls | |
- name: Copy documentation to `docs/docs` | |
run: | | |
# Change ownership and copy documentation to the docs directory | |
sudo chown -R runner docs | |
cp -r .lake/build/doc docs/docs | |
- name: Remove lake files from documentation in `docs/docs` | |
run: | | |
# Remove unnecessary trace and hash files from the documentation | |
find docs/docs -name "*.trace" -delete | |
find docs/docs -name "*.hash" -delete | |
- name: Bundle dependencies | |
uses: ruby/setup-ruby@v1 | |
with: | |
working-directory: docs | |
ruby-version: "3.0" # Specify Ruby version | |
bundler-cache: true # Enable caching for bundler | |
- name: Bundle website | |
working-directory: docs | |
run: JEKYLL_ENV=production bundle exec jekyll build # Build the website using Jekyll | |
- name: Upload docs & blueprint artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ${{ env.DOCS_EXIST == 'true' && 'docs/_site' || 'docs/' }} | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 # Deploy the site to GitHub Pages | |
- name: Make sure the cache works | |
run: mv docs/docs .lake/build/doc # Verify that the cache is functioning correctly |