From b8ab89b41385012b7ade4e13cac5d5e1899ce4ca Mon Sep 17 00:00:00 2001 From: Awni Hannun Date: Tue, 15 Oct 2024 17:40:00 -0700 Subject: [PATCH] Docs in ci (#1491) * docs in circle --- .circleci/config.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index baaffb582..98c987001 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,6 +18,57 @@ parameters: default: false jobs: + build_documentation: + parameters: + upload-docs: + type: boolean + default: false + macos: + xcode: "15.2.0" + resource_class: macos.m1.medium.gen1 + steps: + - checkout + - run: + name: Install + command: | + brew install python@3.9 + brew install doxygen + python3.9 -m venv env + source env/bin/activate + pip install --upgrade pip + pip install --upgrade cmake + pip install -r docs/requirements.txt + CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.ncpu` pip install . -v + - when: + condition: + not: << parameters.upload-docs >> + steps: + - run: + name: Build documentation + command: | + source env/bin/activate + cd docs && doxygen && make html O=-W + - when: + condition: << parameters.upload-docs >> + steps: + - add_ssh_keys: + fingerprints: + - "SHA256:OhcVVMovbT0pkgMeiVRyxMnjV9R2t+hKBsNcuxq9h+0" + - run: + name: Upload documentation + command: | + source env/bin/activate + git config user.email "mlx@group.apple.com" + git config user.name "CircleCI Docs" + git checkout gh-pages + git rebase main + cd docs + git rm -rf build/html + doxygen && make html O=-W + git add -f build/html + git commit -m "rebase" + git push -f origin gh-pages + linux_build_and_test: docker: - image: cimg/python:3.9 @@ -281,6 +332,7 @@ workflows: parameters: xcode_version: ["15.0.0", "15.2.0", "16.0.0"] - linux_build_and_test + - build_documentation build_pypi_release: when: @@ -300,6 +352,14 @@ workflows: python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"] xcode_version: ["15.0.0", "15.2.0"] build_env: ["PYPI_RELEASE=1"] + - build_documentation: + filters: + tags: + only: /^v.*/ + branches: + ignore: /.*/ + upload-docs: true + prb: when: matches: