Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Workflow for building wheels #27

Merged
merged 32 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
766e538
attempt at workflow
golanor May 30, 2024
6f52a70
Workflow deals with openCL, should build Qrack for different environm…
golanor May 31, 2024
7538a16
Workflow deals with openCL, should build Qrack for different environm…
golanor May 31, 2024
0fbb528
Merge remote-tracking branch 'origin/main'
golanor May 31, 2024
490af7e
set up environment variable to help qrack_system find the shared libr…
golanor May 31, 2024
7b71ccf
attempt to fix windows issue
golanor May 31, 2024
339ee1e
attempt to fix windows issue
golanor May 31, 2024
b89ef8d
Merge remote-tracking branch 'origin/main'
golanor May 31, 2024
1845f02
upload artifact update, remove dlib?
golanor May 31, 2024
ec1c488
dealing with warnings and errors
golanor May 31, 2024
adc2988
switch to pypa/build
golanor May 31, 2024
c18a35f
add extension
golanor May 31, 2024
f0b36a8
remove windows until linux works
golanor May 31, 2024
7cd7bc0
attempt at including the qrack library
golanor May 31, 2024
e6e3ed4
wrong path
golanor May 31, 2024
7b38c90
fix path
golanor May 31, 2024
4ee2cd8
understand the paths
golanor May 31, 2024
0012fc6
fix paths #2
golanor May 31, 2024
fa5811d
find what was built
golanor May 31, 2024
ff25453
add make step
golanor May 31, 2024
6572b4c
list files
golanor May 31, 2024
39454c7
rename file
golanor May 31, 2024
bff24bd
point to specific version
golanor May 31, 2024
932ac0b
fix path
golanor Jun 3, 2024
a1c3379
avoid installing qrack, only compile
golanor Jun 3, 2024
7386787
using cibuildwheel
golanor Jun 4, 2024
dda101c
adding MANIFEST.in
golanor Jun 4, 2024
0d13e66
remove cibuildwheels
golanor Jun 4, 2024
e8617a7
add windows
golanor Jun 4, 2024
7491f2c
set path to library in qrack_system
golanor Jun 5, 2024
8076ae0
include dll if windows
golanor Jun 5, 2024
ed587fe
remove linux from build
golanor Jun 6, 2024
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
97 changes: 97 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build PyQrack Wheels

on:
push:
branches:
- main # Trigger on pushes to the main branch (adjust if needed)

workflow_dispatch: # Allow manual triggering of the workflow


jobs:
build_wheels:
runs-on: ubuntu-latest # Use a Linux runner
env:
PYQRACK_SHARED_LIB_PATH: "/home/runner/work/pyqrack/pyqrack/qrack/build/libqrack_pinvoke.so"
strategy:
matrix:
platform:
- manylinux_2_39_x86_64
- manylinux_2_35_x86_64
- linux_aarch64
- linux_armv7l
- manylinux2014_x86_64
- macosx_10_4_universal2
steps:
- name: Checkout PyQrack
uses: actions/checkout@v4

- name: Checkout Qrack
uses: actions/checkout@v4
with:
repository: 'unitaryfund/qrack'
path: qrack

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel setuptools

- name: Prepare Build Environment (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake ocl-icd-opencl-dev opencl-headers

- name: Install Homebrew (MacOS)
if: runner.os == 'macOS'
uses: Homebrew/actions/setup-homebrew@master

- name: Prepare Build Environment (MacOS)
if: runner.os == 'macOS'
run: |
brew install cmake opencl-clhpp-headers

- name: Build Qrack Linux x86-64
if: matrix.platform == 'manylinux_2_39_x86_64' || matrix.platform == 'manylinux_2_35_x86_64' || matrix.platform == 'manylinux2014_x86_64'
run: |
cd qrack
mkdir build
cd build
cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DQBCAPPOW=12 -DCPP_STD=14 -DUINTPOW=5 ..
make all

- name: Build Qrack Linux ARM64
if: matrix.platform == 'linux_aarch64' || matrix.platform == 'linux_armv7l'
run: |
cd qrack
mkdir build
cd build
cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_COMPLEX_X2=OFF -DQBCAPPOW=12 -DUINTPOW=5 -DCPP_STD=14 ..
make all

- name: Build Qrack MacOS
if: matrix.platform == 'macosx_10_4_universal2'
run: |
cd qrack
mkdir build
cd build
cmake -DQBCAPPOW=12 -DUINTPOW=5 -DCPP_STD=14 ..
make all

- name: Build Wheel
run: |
mkdir pyqrack/qrack_system/qrack_lib
cp $PYQRACK_SHARED_LIB_PATH pyqrack/qrack_system/qrack_lib/
python setup.py bdist_wheel --plat-name=${{ matrix.platform }}

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: pyqrack-${{ matrix.platform }}
path: dist/
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.so
include pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.dll
7 changes: 6 additions & 1 deletion pyqrack/qrack_system/qrack_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@
# found in the LICENSE file or at https://opensource.org/licenses/MIT.

import os
import pathlib
from ctypes import *
from sys import platform as _platform


class QrackSystem:
def __init__(self):
shared_lib_path = "/usr/local/lib/qrack/libqrack_pinvoke.so"
path = pathlib.Path(__file__).absolute().parent
if _platform == "win32":
shared_lib_path = str(path / "qrack_lib/libqrack_pinvoke.dll")
else:
shared_lib_path = str(path / "qrack_lib/libqrack_pinvoke.so")
if os.environ.get('PYQRACK_SHARED_LIB_PATH') != None:
shared_lib_path = os.environ.get('PYQRACK_SHARED_LIB_PATH')
elif _platform == "darwin":
Expand Down