Skip to content

Commit

Permalink
Minor Updates for CI/CD (#24)
Browse files Browse the repository at this point in the history
 - πŸ—οΈ switch to PEP 517 `pyproject.toml`
 - πŸ› 🍎: deploying under macOS now produces fat binaries (i.e., for `x86_64` and `arm64` architectures). This allows to effectively build `universal2` wheels for Python 3.8 onwards and eventually makes the wheels work on M1-based Macs
 - ⬆️ updated cibuildwheel to 2.3.0
 - πŸ—οΈ increase max CMake version to 3.22
 - πŸ”– increase version to 1.7.3
  • Loading branch information
burgholzer authored Nov 30, 2021
1 parent 8f13b50 commit 06da5bc
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 28 deletions.
24 changes: 3 additions & 21 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ on:
branches: [ master ]
workflow_dispatch:

env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BUILD: cp3*
CIBW_ENVIRONMENT: "DEPLOY=ON"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_TEST_SKIP: "*_arm64"
CIBW_SKIP: "*-win32 *-musllinux_i686 *-manylinux_i686"
CIBW_BUILD_VERBOSITY: 3
CIBW_TEST_COMMAND: "python -c \"from jkq import qfr\""
CIBW_BEFORE_BUILD: "pip install cmake"

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
Expand All @@ -28,14 +17,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: ilammy/msvc-dev-cmd@v1
- name: Build wheels
uses: pypa/cibuildwheel@v2.2.2
uses: pypa/cibuildwheel@v2.3.0
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
Expand All @@ -47,24 +35,19 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: recursive

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
run: pip install -q build
- name: Build sdist
run: python setup.py sdist

run: python -m build --sdist
- name: Test sdist
run: pip install --verbose dist/*.tar.gz
env:
CC: "gcc-10"
CXX: "g++-10"

- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
Expand All @@ -78,7 +61,6 @@ jobs:
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
Expand Down
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.14...3.21)
cmake_minimum_required(VERSION 3.14...3.22)

project(qfr
LANGUAGES CXX
VERSION 1.7.2
VERSION 1.7.3
DESCRIPTION "QFR - A JKQ library for Quantum Functionality Representation"
)

Expand All @@ -21,6 +21,14 @@ if (DEFINED ENV{DEPLOY})
message(STATUS "Setting deployment configuration to '${DEPLOY}' from environment")
endif ()

# set deployment specific options
if (DEPLOY)
# build a universal macOS binary in case this is a deployment build
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "" FORCE)
# set the macOS deployment target appropriately
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "" FORCE)
endif ()

# build type settings
set(default_build_type "Release")
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ It acts as an intermediate representation and provides the facilitites to
Building (and running) is continuously tested under Linux, MacOS, and Windows using the [latest available system versions for GitHub Actions](https://github.com/actions/virtual-environments). However, the implementation should be compatible
with any current C++ compiler supporting C++17 and a minimum CMake version of 3.14.

*Disclaimer*: We noticed some issues when compiling with Microsoft's `MSCV` compiler toolchain. If you are developing under Windows, consider using the `clang` compiler toolchain. A detailed description of how to set this up can be
*Disclaimer*: We noticed some issues when compiling with Microsoft's `MSVC` compiler toolchain. If you are developing under Windows, consider using the `clang` compiler toolchain. A detailed description of how to set this up can be
found [here](https://docs.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-160).

It is recommended (although not required) to have [GraphViz](https://www.graphviz.org) installed for visualization purposes.
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[build-system]
requires = ["setuptools", "wheel", "cmake"]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
build = "cp3*"
skip = "*-win32 *-musllinux_i686 *-manylinux_i686 cp3{8,9,10}-macosx_x86_64"
test-skip = "*_arm64 *_universal2:arm64"
test-command = "python -c \"from jkq import qfr\""
environment = { DEPLOY = "ON" }
build-verbosity = 3

[tool.cibuildwheel.linux]

[tool.cibuildwheel.macos]
archs = "x86_64 universal2"
environment = { MACOSX_DEPLOYMENT_TARGET = "10.15", DEPLOY = "ON" }

[tool.cibuildwheel.windows]
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def build_extension(self, ext):

setup(
name='jkq.qfr',
version='1.7.2',
version='1.7.3',
author='Lukas Burgholzer',
author_email='lukas.burgholzer@jku.at',
description='QFR - A JKQ tool for Quantum Functionality Representation',
Expand Down Expand Up @@ -96,7 +96,5 @@ def build_extension(self, ext):
'Source': 'https://github.com/iic-jku/qfr/',
'Tracker': 'https://github.com/iic-jku/qfr/issues',
'Research': 'https://iic.jku.at/eda/research/quantum_dd',
},
python_requires='>=3.6',
setup_requires=['cmake>=3.14']
}
)

0 comments on commit 06da5bc

Please sign in to comment.