| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  | version: 2.1
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-15 19:30:35 -06:00
										 |  |  | orbs:
 | 
					
						
							|  |  |  |   apple: ml-explore/pr-approval@0.1.0
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  | parameters:
 | 
					
						
							|  |  |  |   nightly_build:
 | 
					
						
							|  |  |  |     type: boolean
 | 
					
						
							|  |  |  |     default: false
 | 
					
						
							|  |  |  |   weekly_build:
 | 
					
						
							|  |  |  |     type: boolean
 | 
					
						
							|  |  |  |     default: false
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |   test_release:
 | 
					
						
							|  |  |  |     type: boolean
 | 
					
						
							|  |  |  |     default: false
 | 
					
						
							| 
									
										
										
										
											2024-10-14 06:21:44 -07:00
										 |  |  |   linux_release:
 | 
					
						
							|  |  |  |     type: boolean
 | 
					
						
							|  |  |  |     default: false
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | jobs:
 | 
					
						
							| 
									
										
										
										
											2024-10-15 17:40:00 -07:00
										 |  |  |   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
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |   linux_build_and_test:
 | 
					
						
							|  |  |  |     docker:
 | 
					
						
							|  |  |  |       - image: cimg/python:3.9
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     steps:
 | 
					
						
							|  |  |  |       - checkout
 | 
					
						
							|  |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Run style checks
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							|  |  |  |             pip install pre-commit
 | 
					
						
							|  |  |  |             pre-commit run --all
 | 
					
						
							|  |  |  |             if ! git diff --quiet; then echo 'Style checks failed, please install pre-commit and run pre-commit run --all and push the change'; exit 1; fi
 | 
					
						
							|  |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Install dependencies
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							|  |  |  |             pip install --upgrade cmake
 | 
					
						
							| 
									
										
										
										
											2024-10-07 16:52:40 -07:00
										 |  |  |             pip install nanobind==2.2.0
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |             pip install numpy
 | 
					
						
							|  |  |  |             sudo apt-get update
 | 
					
						
							| 
									
										
										
										
											2024-01-26 09:27:31 -08:00
										 |  |  |             sudo apt-get install libblas-dev liblapack-dev liblapacke-dev
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |       - run:
 | 
					
						
							| 
									
										
										
										
											2024-01-21 17:53:12 -03:00
										 |  |  |           name: Install Python package
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |             CMAKE_ARGS="-DMLX_BUILD_METAL=OFF" \
 | 
					
						
							|  |  |  |               CMAKE_BUILD_PARALLEL_LEVEL=`nproc` \
 | 
					
						
							|  |  |  |               python3 setup.py build_ext --inplace
 | 
					
						
							|  |  |  |             CMAKE_ARGS="-DMLX_BUILD_METAL=OFF" \
 | 
					
						
							|  |  |  |               CMAKE_BUILD_PARALLEL_LEVEL=`nproc` \
 | 
					
						
							|  |  |  |               python3 setup.py develop
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |       - run:
 | 
					
						
							| 
									
										
										
										
											2024-01-21 17:53:12 -03:00
										 |  |  |           name: Generate package stubs
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-03-18 20:12:25 -07:00
										 |  |  |             echo "stubs"
 | 
					
						
							| 
									
										
										
										
											2024-08-22 14:07:27 -07:00
										 |  |  |             pip install typing_extensions
 | 
					
						
							| 
									
										
										
										
											2024-03-24 15:03:27 -07:00
										 |  |  |             python setup.py generate_stubs 
 | 
					
						
							| 
									
										
										
										
											2024-01-21 17:53:12 -03:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Run Python tests
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-01-29 11:19:38 -08:00
										 |  |  |             python3 -m unittest discover python/tests -v
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Build CPP only
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |             mkdir -p build && cd build 
 | 
					
						
							|  |  |  |             cmake .. -DMLX_BUILD_METAL=OFF -DCMAKE_BUILD_TYPE=DEBUG
 | 
					
						
							|  |  |  |             make -j `nproc`
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Run CPP tests
 | 
					
						
							|  |  |  |           command: ./build/tests/tests
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   mac_build_and_test:
 | 
					
						
							| 
									
										
										
										
											2024-03-07 08:19:43 -08:00
										 |  |  |     parameters:
 | 
					
						
							|  |  |  |       xcode_version:
 | 
					
						
							|  |  |  |         type: string
 | 
					
						
							|  |  |  |         default: "15.2.0"
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |     macos:
 | 
					
						
							| 
									
										
										
										
											2024-03-07 08:19:43 -08:00
										 |  |  |       xcode: << parameters.xcode_version >>
 | 
					
						
							| 
									
										
										
										
											2024-05-13 21:40:19 -05:00
										 |  |  |     resource_class: macos.m1.medium.gen1
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |     steps:
 | 
					
						
							|  |  |  |       - checkout
 | 
					
						
							|  |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Install dependencies
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-10-14 10:40:32 -07:00
										 |  |  |             brew install python@3.9
 | 
					
						
							| 
									
										
										
										
											2024-05-23 17:04:02 -07:00
										 |  |  |             brew install openmpi
 | 
					
						
							| 
									
										
										
										
											2024-10-14 10:40:32 -07:00
										 |  |  |             python3.9 -m venv env
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             source env/bin/activate
 | 
					
						
							|  |  |  |             pip install --upgrade pip
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |             pip install --upgrade cmake
 | 
					
						
							| 
									
										
										
										
											2024-10-07 16:52:40 -07:00
										 |  |  |             pip install nanobind==2.2.0
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |             pip install numpy
 | 
					
						
							|  |  |  |             pip install torch
 | 
					
						
							| 
									
										
										
										
											2024-01-06 00:58:33 +01:00
										 |  |  |             pip install tensorflow
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |             pip install unittest-xml-reporting
 | 
					
						
							|  |  |  |       - run:
 | 
					
						
							| 
									
										
										
										
											2024-01-21 17:53:12 -03:00
										 |  |  |           name: Install Python package
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             source env/bin/activate
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |             DEBUG=1 CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.ncpu` pip install -e . -v
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |       - run:
 | 
					
						
							| 
									
										
										
										
											2024-01-21 17:53:12 -03:00
										 |  |  |           name: Generate package stubs
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             source env/bin/activate
 | 
					
						
							| 
									
										
										
										
											2024-08-22 14:07:27 -07:00
										 |  |  |             pip install typing_extensions
 | 
					
						
							| 
									
										
										
										
											2024-03-24 15:03:27 -07:00
										 |  |  |             python setup.py generate_stubs 
 | 
					
						
							| 
									
										
										
										
											2024-01-21 17:53:12 -03:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Run Python tests
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             source env/bin/activate
 | 
					
						
							|  |  |  |             LOW_MEMORY=1 DEVICE=cpu python -m xmlrunner discover -v python/tests -o test-results/cpu
 | 
					
						
							| 
									
										
										
										
											2024-03-07 08:19:43 -08:00
										 |  |  |             LOW_MEMORY=1 DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 python -m xmlrunner discover -v python/tests -o test-results/gpu
 | 
					
						
							| 
									
										
										
										
											2024-10-06 06:09:17 -07:00
										 |  |  |             mpirun --bind-to none -host localhost:8 -np 8 -x DYLD_LIBRARY_PATH=/opt/homebrew/lib/ python python/tests/mpi_test_distributed.py
 | 
					
						
							| 
									
										
										
										
											2024-05-16 15:36:25 -07:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Build example extension
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-05-17 15:09:28 -07:00
										 |  |  |             source env/bin/activate
 | 
					
						
							|  |  |  |             cd examples/extensions
 | 
					
						
							|  |  |  |             pip install -r requirements.txt
 | 
					
						
							|  |  |  |             python setup.py build_ext -j8
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |       - store_test_results:
 | 
					
						
							|  |  |  |           path: test-results
 | 
					
						
							| 
									
										
										
										
											2024-01-11 11:57:24 -08:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Build CPP only
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             source env/bin/activate
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |             mkdir -p build && cd build && cmake .. && make -j `sysctl -n hw.ncpu`
 | 
					
						
							| 
									
										
										
										
											2024-01-11 11:57:24 -08:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Run CPP tests
 | 
					
						
							| 
									
										
										
										
											2024-02-14 13:42:13 -08:00
										 |  |  |           command: |
 | 
					
						
							|  |  |  |             DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 ./build/tests/tests
 | 
					
						
							| 
									
										
										
										
											2024-05-22 12:57:13 -07:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Build small binary
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							|  |  |  |             source env/bin/activate
 | 
					
						
							|  |  |  |             cd build/
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |             cmake .. -DCMAKE_BUILD_TYPE=MinSizeRel \
 | 
					
						
							|  |  |  |               -DBUILD_SHARED_LIBS=ON \
 | 
					
						
							|  |  |  |               -DMLX_BUILD_CPU=OFF \
 | 
					
						
							|  |  |  |               -DMLX_BUILD_SAFETENSORS=OFF \
 | 
					
						
							|  |  |  |               -DMLX_BUILD_GGUF=OFF \
 | 
					
						
							|  |  |  |               -DMLX_METAL_JIT=ON
 | 
					
						
							|  |  |  |             make -j `sysctl -n hw.ncpu`
 | 
					
						
							| 
									
										
										
										
											2024-08-28 16:39:11 -07:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Run Python tests with JIT
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							|  |  |  |             source env/bin/activate
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |             CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.ncpu` \
 | 
					
						
							|  |  |  |               CMAKE_ARGS="-DMLX_METAL_JIT=ON" \
 | 
					
						
							|  |  |  |               pip install -e . -v
 | 
					
						
							|  |  |  |             LOW_MEMORY=1 DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 \
 | 
					
						
							|  |  |  |               METAL_DEBUG_ERROR_MODE=0 \
 | 
					
						
							|  |  |  |               python -m xmlrunner discover -v python/tests -o test-results/gpu_jit
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   build_release:
 | 
					
						
							|  |  |  |     parameters:
 | 
					
						
							|  |  |  |       python_version:
 | 
					
						
							|  |  |  |         type: string
 | 
					
						
							|  |  |  |         default: "3.9"
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |       xcode_version:
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |         type: string
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |         default: "15.2.0"
 | 
					
						
							|  |  |  |       build_env:
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |         type: string
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |         default: ""
 | 
					
						
							|  |  |  |     macos:
 | 
					
						
							|  |  |  |       xcode: << parameters.xcode_version >>
 | 
					
						
							| 
									
										
										
										
											2024-05-13 21:40:19 -05:00
										 |  |  |     resource_class: macos.m1.medium.gen1
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |     steps:
 | 
					
						
							|  |  |  |       - checkout
 | 
					
						
							|  |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Install dependencies
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             brew install python@<< parameters.python_version >>
 | 
					
						
							| 
									
										
										
										
											2024-06-10 10:09:32 -07:00
										 |  |  |             brew install openmpi
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             python<< parameters.python_version >> -m venv env
 | 
					
						
							|  |  |  |             source env/bin/activate
 | 
					
						
							|  |  |  |             pip install --upgrade pip
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |             pip install --upgrade cmake
 | 
					
						
							| 
									
										
										
										
											2024-10-07 16:52:40 -07:00
										 |  |  |             pip install nanobind==2.2.0
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             pip install --upgrade setuptools
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |             pip install numpy
 | 
					
						
							|  |  |  |             pip install twine
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             pip install build
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |       - run:
 | 
					
						
							| 
									
										
										
										
											2024-01-21 17:53:12 -03:00
										 |  |  |           name: Install Python package
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             source env/bin/activate
 | 
					
						
							|  |  |  |             DEV_RELEASE=1 \
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |               CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.ncpu` \
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |               pip install . -v
 | 
					
						
							| 
									
										
										
										
											2024-01-21 17:53:12 -03:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Generate package stubs
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             source env/bin/activate
 | 
					
						
							| 
									
										
										
										
											2024-08-22 14:07:27 -07:00
										 |  |  |             pip install typing_extensions
 | 
					
						
							| 
									
										
										
										
											2024-03-24 15:03:27 -07:00
										 |  |  |             python setup.py generate_stubs 
 | 
					
						
							| 
									
										
										
										
											2024-01-21 17:53:12 -03:00
										 |  |  |       - run:
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |           name: Build Python package
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |           command: |
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |             source env/bin/activate
 | 
					
						
							|  |  |  |             << parameters.build_env >> \
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |               CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.ncpu` \
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |               python -m build -w
 | 
					
						
							|  |  |  |       - when:
 | 
					
						
							|  |  |  |           condition: << parameters.build_env >>
 | 
					
						
							|  |  |  |           steps:
 | 
					
						
							|  |  |  |             - run:
 | 
					
						
							|  |  |  |                 name: Upload package
 | 
					
						
							|  |  |  |                 command: |
 | 
					
						
							|  |  |  |                   source env/bin/activate
 | 
					
						
							|  |  |  |                   twine upload dist/*
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |       - store_artifacts:
 | 
					
						
							|  |  |  |           path: dist/
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-14 06:21:44 -07:00
										 |  |  |   build_linux_release:
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |     parameters:
 | 
					
						
							|  |  |  |       python_version:
 | 
					
						
							|  |  |  |         type: string
 | 
					
						
							|  |  |  |         default: "3.9"
 | 
					
						
							|  |  |  |       extra_env:
 | 
					
						
							|  |  |  |         type: string
 | 
					
						
							|  |  |  |         default: "DEV_RELEASE=1"
 | 
					
						
							|  |  |  |     docker:
 | 
					
						
							|  |  |  |       - image: ubuntu:20.04
 | 
					
						
							|  |  |  |     steps:
 | 
					
						
							|  |  |  |       - checkout
 | 
					
						
							|  |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Build wheel
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							|  |  |  |             PYTHON=python<< parameters.python_version >>
 | 
					
						
							|  |  |  |             apt-get update
 | 
					
						
							|  |  |  |             apt-get upgrade -y
 | 
					
						
							|  |  |  |             DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
 | 
					
						
							|  |  |  |             apt-get install -y apt-utils
 | 
					
						
							|  |  |  |             apt-get install -y software-properties-common
 | 
					
						
							|  |  |  |             add-apt-repository -y ppa:deadsnakes/ppa
 | 
					
						
							|  |  |  |             apt-get install -y $PYTHON $PYTHON-dev $PYTHON-full
 | 
					
						
							|  |  |  |             apt-get install -y libblas-dev liblapack-dev liblapacke-dev
 | 
					
						
							|  |  |  |             apt-get install -y build-essential git
 | 
					
						
							|  |  |  |             $PYTHON -m venv env
 | 
					
						
							|  |  |  |             source env/bin/activate
 | 
					
						
							|  |  |  |             pip install --upgrade pip
 | 
					
						
							|  |  |  |             pip install --upgrade cmake
 | 
					
						
							| 
									
										
										
										
											2024-10-07 16:52:40 -07:00
										 |  |  |             pip install nanobind==2.2.0
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |             pip install --upgrade setuptools
 | 
					
						
							|  |  |  |             pip install numpy
 | 
					
						
							|  |  |  |             pip install auditwheel
 | 
					
						
							|  |  |  |             pip install patchelf
 | 
					
						
							|  |  |  |             pip install build
 | 
					
						
							| 
									
										
										
										
											2024-10-14 06:21:44 -07:00
										 |  |  |             pip install twine
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |             << parameters.extra_env >> \
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |               CMAKE_BUILD_PARALLEL_LEVEL=`nproc` \
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |               pip install . -v
 | 
					
						
							| 
									
										
										
										
											2024-08-22 14:07:27 -07:00
										 |  |  |             pip install typing_extensions
 | 
					
						
							| 
									
										
										
										
											2024-03-24 15:03:27 -07:00
										 |  |  |             python setup.py generate_stubs 
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |             << parameters.extra_env >> \
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |               CMAKE_BUILD_PARALLEL_LEVEL=`nproc` \
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |               python -m build --wheel
 | 
					
						
							|  |  |  |             auditwheel show dist/*
 | 
					
						
							|  |  |  |             auditwheel repair dist/* --plat manylinux_2_31_x86_64
 | 
					
						
							| 
									
										
										
										
											2024-10-14 06:21:44 -07:00
										 |  |  |       - run:
 | 
					
						
							|  |  |  |           name: Upload package
 | 
					
						
							|  |  |  |           command: |
 | 
					
						
							|  |  |  |             source env/bin/activate
 | 
					
						
							|  |  |  |             twine upload wheelhouse/*
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |       - store_artifacts:
 | 
					
						
							|  |  |  |           path: wheelhouse/
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  | workflows:
 | 
					
						
							|  |  |  |   build_and_test:
 | 
					
						
							|  |  |  |     when:
 | 
					
						
							|  |  |  |       and:
 | 
					
						
							| 
									
										
										
										
											2024-02-14 13:42:13 -08:00
										 |  |  |         - matches:
 | 
					
						
							|  |  |  |             pattern: "^(?!pull/)[-\\w]+$"
 | 
					
						
							|  |  |  |             value: << pipeline.git.branch >>
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |         - not: << pipeline.parameters.nightly_build >>
 | 
					
						
							|  |  |  |         - not: << pipeline.parameters.weekly_build >>
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |         - not: << pipeline.parameters.test_release >>
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |     jobs:
 | 
					
						
							| 
									
										
										
										
											2024-03-07 08:19:43 -08:00
										 |  |  |       - mac_build_and_test:
 | 
					
						
							|  |  |  |           matrix:
 | 
					
						
							|  |  |  |             parameters:
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |               xcode_version: ["15.0.0", "15.2.0", "16.0.0"]
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |       - linux_build_and_test
 | 
					
						
							| 
									
										
										
										
											2024-10-15 17:40:00 -07:00
										 |  |  |       - build_documentation 
 | 
					
						
							| 
									
										
										
										
											2024-02-22 14:09:13 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   build_pypi_release:
 | 
					
						
							|  |  |  |     when:
 | 
					
						
							|  |  |  |       and:
 | 
					
						
							|  |  |  |         - not: << pipeline.parameters.nightly_build >>
 | 
					
						
							|  |  |  |         - not: << pipeline.parameters.weekly_build >>
 | 
					
						
							|  |  |  |         - not: << pipeline.parameters.test_release >>
 | 
					
						
							|  |  |  |     jobs:
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |       - build_release:
 | 
					
						
							|  |  |  |           filters:
 | 
					
						
							|  |  |  |             tags:
 | 
					
						
							|  |  |  |               only: /^v.*/
 | 
					
						
							|  |  |  |             branches:
 | 
					
						
							|  |  |  |               ignore: /.*/
 | 
					
						
							|  |  |  |           matrix:
 | 
					
						
							|  |  |  |             parameters:
 | 
					
						
							| 
									
										
										
										
											2024-11-01 20:55:35 -07:00
										 |  |  |               python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
 | 
					
						
							| 
									
										
										
										
											2024-03-07 08:19:43 -08:00
										 |  |  |               xcode_version: ["15.0.0", "15.2.0"]
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |               build_env: ["PYPI_RELEASE=1"]
 | 
					
						
							| 
									
										
										
										
											2024-10-15 17:40:00 -07:00
										 |  |  |       - build_documentation:
 | 
					
						
							|  |  |  |           filters:
 | 
					
						
							|  |  |  |             tags:
 | 
					
						
							|  |  |  |               only: /^v.*/
 | 
					
						
							|  |  |  |             branches:
 | 
					
						
							|  |  |  |               ignore: /.*/
 | 
					
						
							|  |  |  |           upload-docs: true
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-12 19:47:21 -06:00
										 |  |  |   prb:
 | 
					
						
							|  |  |  |     when:
 | 
					
						
							|  |  |  |       matches:
 | 
					
						
							|  |  |  |         pattern: "^pull/\\d+(/head)?$"
 | 
					
						
							|  |  |  |         value: << pipeline.git.branch >>
 | 
					
						
							|  |  |  |     jobs:
 | 
					
						
							|  |  |  |       - hold:
 | 
					
						
							|  |  |  |           type: approval
 | 
					
						
							| 
									
										
										
										
											2024-02-15 19:30:35 -06:00
										 |  |  |       - apple/authenticate:
 | 
					
						
							|  |  |  |           context: pr-approval
 | 
					
						
							| 
									
										
										
										
											2024-02-12 19:47:21 -06:00
										 |  |  |       - mac_build_and_test:
 | 
					
						
							|  |  |  |           requires: [ hold ]
 | 
					
						
							| 
									
										
										
										
											2024-03-12 05:14:44 +01:00
										 |  |  |           matrix:
 | 
					
						
							|  |  |  |             parameters:
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |               xcode_version: ["15.0.0", "15.2.0", "16.0.0"]
 | 
					
						
							| 
									
										
										
										
											2024-02-12 19:47:21 -06:00
										 |  |  |       - linux_build_and_test:
 | 
					
						
							|  |  |  |           requires: [ hold ]
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |   nightly_build:
 | 
					
						
							| 
									
										
										
										
											2024-02-12 19:47:21 -06:00
										 |  |  |     when:
 | 
					
						
							|  |  |  |       and:
 | 
					
						
							|  |  |  |         - equal: [ main, << pipeline.git.branch >> ]
 | 
					
						
							|  |  |  |         - << pipeline.parameters.nightly_build >>
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |     jobs:
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |       - build_release:
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |           matrix:
 | 
					
						
							|  |  |  |             parameters:
 | 
					
						
							| 
									
										
										
										
											2024-11-01 20:55:35 -07:00
										 |  |  |               python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
 | 
					
						
							| 
									
										
										
										
											2024-03-07 08:19:43 -08:00
										 |  |  |               xcode_version: ["15.0.0", "15.2.0"]
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |   weekly_build:
 | 
					
						
							| 
									
										
										
										
											2024-02-12 19:47:21 -06:00
										 |  |  |     when:
 | 
					
						
							|  |  |  |       and:
 | 
					
						
							|  |  |  |         - equal: [ main, << pipeline.git.branch >> ]
 | 
					
						
							|  |  |  |         - << pipeline.parameters.weekly_build >>
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |     jobs:
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |       - build_release:
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:04:11 -08:00
										 |  |  |           matrix:
 | 
					
						
							|  |  |  |             parameters:
 | 
					
						
							| 
									
										
										
										
											2024-11-01 20:55:35 -07:00
										 |  |  |               python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
 | 
					
						
							| 
									
										
										
										
											2024-09-10 15:15:17 -07:00
										 |  |  |               xcode_version: ["15.0.0", "15.2.0", "16.0.0"]
 | 
					
						
							| 
									
										
										
										
											2024-02-07 06:04:34 -08:00
										 |  |  |               build_env: ["DEV_RELEASE=1"]
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |   linux_test_release:
 | 
					
						
							| 
									
										
										
										
											2024-02-12 19:47:21 -06:00
										 |  |  |     when:
 | 
					
						
							|  |  |  |       and:
 | 
					
						
							|  |  |  |         - equal: [ main, << pipeline.git.branch >> ]
 | 
					
						
							| 
									
										
										
										
											2024-10-14 06:21:44 -07:00
										 |  |  |         - << pipeline.parameters.linux_release >>
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |     jobs:
 | 
					
						
							| 
									
										
										
										
											2024-10-14 06:21:44 -07:00
										 |  |  |       - build_linux_release:
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |           matrix:
 | 
					
						
							|  |  |  |             parameters:
 | 
					
						
							| 
									
										
										
										
											2024-11-01 20:55:35 -07:00
										 |  |  |               python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
 | 
					
						
							| 
									
										
										
										
											2024-02-09 18:17:04 -08:00
										 |  |  |               extra_env: ["PYPI_RELEASE=1"]
 |