Skip to content

Commit a3e6885

Browse files
authored
Modernize Build and Deploy (#43)
* πŸ“„ update license * πŸ”₯ remove 🐳 dockerfile * 🚨 fix unused variable warnings * πŸ™ˆ update .gitignore * ♻️ refactor how test and documentation requirements are handled * ♻️ refactor setup.py and versioning * ♻️ refactor building of wheels * πŸ‘· split up linux deployment ci * 🎨 improved naming for jobs
1 parent 5bc9cbb commit a3e6885

17 files changed

+153
-168
lines changed

β€Ž.github/dependabot.yml

-18
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,6 @@ updates:
1818
assignees:
1919
- "burgholzer"
2020

21-
- package-ecosystem: "pip"
22-
directory: "/docs"
23-
schedule:
24-
interval: "weekly"
25-
day: "friday"
26-
time: "06:00"
27-
assignees:
28-
- "burgholzer"
29-
30-
- package-ecosystem: "pip"
31-
directory: "/test/python"
32-
schedule:
33-
interval: "weekly"
34-
day: "friday"
35-
time: "06:00"
36-
assignees:
37-
- "burgholzer"
38-
3921
- package-ecosystem: "pip"
4022
directory: "/"
4123
schedule:

β€Ž.github/workflows/deploy.yml

+37-44
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,51 @@ on:
1111

1212
jobs:
1313
build_wheels:
14-
name: Build wheels on ${{ matrix.os }}
14+
name: Build ${{ matrix.os }}${{ matrix.archname }}${{ matrix.libc }} wheels
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: [ubuntu-latest, windows-latest, macos-latest]
19+
os: [ ubuntu-latest, windows-latest, macos-latest ]
20+
arch: [ x86_64 ]
21+
archname: [ "" ]
22+
skip: [ "*-musllinux_*" ]
23+
libc: [ "" ]
24+
include:
25+
- arch: arm64
26+
archname: "-arm64"
27+
os: macos-latest
28+
- arch: x86_64
29+
os: ubuntu-latest
30+
skip: "*-manylinux_*"
31+
libc: "-musl"
32+
# - arch: aarch64
33+
# archname: "-arm64"
34+
# os: ubuntu-latest
35+
# qemu: true
36+
# - arch: aarch64
37+
# archname: "-arm64"
38+
# os: ubuntu-latest
39+
# qemu: true
40+
# skip: "*-manylinux_*"
41+
# libc: "-musl"
2042

2143
steps:
2244
- uses: actions/checkout@v3
2345
with:
2446
submodules: recursive
2547
- uses: ilammy/msvc-dev-cmd@v1
48+
# - name: Install QEMU
49+
# uses: docker/setup-qemu-action@v1
50+
# if: matrix.qemu
51+
# with:
52+
# platforms: arm64
2653
- name: Build wheels
27-
uses: pypa/[email protected]
28-
- uses: actions/upload-artifact@v2
29-
with:
30-
path: ./wheelhouse/*.whl
31-
32-
build_m1_wheels:
33-
name: Build wheels for Apple Silicon
34-
runs-on: macos-11
35-
steps:
36-
- uses: actions/checkout@v3
37-
with:
38-
submodules: recursive
39-
- name: Build wheels
40-
uses: pypa/[email protected]
54+
uses: pypa/[email protected]
4155
env:
42-
CIBW_ARCHS_MACOS: arm64
56+
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
57+
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
58+
CIBW_SKIP: ${{ matrix.skip }}
4359
- uses: actions/upload-artifact@v2
4460
with:
4561
path: ./wheelhouse/*.whl
@@ -53,41 +69,18 @@ jobs:
5369
submodules: recursive
5470
- uses: actions/setup-python@v3
5571
name: Install Python
56-
with:
57-
python-version: '3.9'
5872
- name: Install dependencies
59-
run: pip install -q build
73+
run: python -m pip install build
6074
- name: Build sdist
6175
run: python -m build --sdist
62-
- name: Test sdist
63-
run: pip install --verbose dist/*.tar.gz
64-
env:
65-
CC: "gcc-10"
66-
CXX: "g++-10"
76+
- name: Install sdist
77+
run: python -m pip install --verbose dist/*.tar.gz
6778
- uses: actions/upload-artifact@v2
6879
with:
6980
path: dist/*.tar.gz
7081

71-
test_bindings:
72-
name: Test Python bindings
73-
runs-on: ubuntu-latest
74-
steps:
75-
- uses: actions/checkout@v2
76-
with:
77-
submodules: recursive
78-
- uses: actions/setup-python@v2
79-
name: Install Python
80-
with:
81-
python-version: '3.9'
82-
- name: Install package
83-
run: pip install .
84-
- name: Install test requirements
85-
run: pip install -r test/python/requirements-test.txt
86-
- name: Test package
87-
run: cd test/python && pytest .
88-
8982
upload_pypi:
90-
needs: [ build_wheels, build_m1_wheels, build_sdist, test_bindings ]
83+
needs: [ build_wheels, build_sdist ]
9184
runs-on: ubuntu-latest
9285
if: github.event_name == 'release' && github.event.action == 'published'
9386
steps:

β€Ž.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ var/
1919
*.egg-info/
2020
.installed.cfg
2121
*.egg
22+
.pytest_cache/

β€Ž.readthedocs.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ python:
1818
install:
1919
- method: pip
2020
path: .
21-
- requirements: docs/requirements.txt
21+
extra_requirements:
22+
- docs

β€ŽCMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.14...3.22)
22

33
project(qcec
44
LANGUAGES CXX
5-
VERSION 2.0.0
65
DESCRIPTION "MQT QCEC - A tool for Quantum Circuit Equivalence Checking"
76
)
87

β€ŽDockerfile

-9
This file was deleted.

β€ŽLICENSE β€ŽLICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Lukas Burgholzer, Robert Wille
3+
Copyright (c) 2022 Lukas Burgholzer, Robert Wille
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

β€ŽMANIFEST.in

+11-24
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
1-
include README.md LICENSE CMakeLists.txt
2-
graft src
3-
graft include
4-
graft mqt/qcec
5-
graft jkq
6-
include extern/qfr/CMakeLists.txt
7-
graft extern/qfr/src
8-
graft extern/qfr/include
9-
graft extern/qfr/mqt/qfr
10-
graft extern/qfr/jkq
11-
include extern/qfr/extern/dd_package/CMakeLists.txt
12-
graft extern/qfr/extern/dd_package/include
1+
prune docs
2+
prune test
3+
4+
graft extern/qfr
5+
prune **/test
6+
prune **/tests
7+
prune **/doc
8+
prune **/docs
9+
prune **/apps
10+
prune **/.github
1311

14-
graft extern/qfr/extern/json
1512
prune extern/qfr/extern/json/benchmarks
16-
prune extern/qfr/extern/json/doc
1713
prune extern/qfr/extern/json/include
18-
prune extern/qfr/extern/json/test
1914
prune extern/qfr/extern/json/third_party
20-
21-
graft extern/qfr/extern/pybind11
22-
prune extern/qfr/extern/pybind11/docs
23-
prune extern/qfr/extern/pybind11/tests
24-
25-
graft extern/qfr/extern/pybind11_json
26-
prune extern/qfr/extern/pybind11_json/test
27-
28-
prune **/.github
15+
prune extern/qfr/extern/dd_package/extern

β€Ždocs/requirements.txt

-4
This file was deleted.

β€Ždocs/source/conf.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
from importlib.metadata import version
2+
13
# -- Project information -----------------------------------------------------
24
project = 'QCEC'
3-
copyright = '2022, Lukas Burgholzer'
45
author = 'Lukas Burgholzer'
56

6-
# The full version, including alpha/beta/rc tags
7-
release = '2.0.0'
7+
release = version('mqt.qcec')
8+
version = '.'.join(release.split('.')[:3])
89

910
# -- General configuration ---------------------------------------------------
1011
extensions = [

β€Žmqt/qcec/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pybind11_add_module(py${PROJECT_NAME} bindings.cpp)
22
target_link_libraries(py${PROJECT_NAME} PUBLIC ${PROJECT_NAME} MQT::qfr_python pybind11_json)
3+
target_compile_definitions(py${PROJECT_NAME} PRIVATE VERSION_INFO=${QCEC_VERSION_INFO})

β€Žmqt/qcec/bindings.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include <exception>
1515
#include <memory>
1616

17+
#define STRINGIFY(x) #x
18+
#define MACRO_STRINGIFY(x) STRINGIFY(x)
19+
1720
namespace py = pybind11;
1821
namespace nl = nlohmann;
1922
using namespace pybind11::literals;
@@ -369,7 +372,7 @@ namespace ec {
369372
.def_readwrite("store_cex_output", &Configuration::Simulation::storeCEXoutput, "Whether to store the resulting states that prove the non-equivalence of both circuits. Since the memory required to store a full representation of a quantum state increases exponentially, this is only recommended for a small number of qubits and defaults to :code:`False`.");
370373

371374
#ifdef VERSION_INFO
372-
m.attr("__version__") = VERSION_INFO;
375+
m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
373376
#else
374377
m.attr("__version__") = "dev";
375378
#endif

β€Žpyproject.toml

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
[build-system]
2-
requires = ["setuptools", "wheel", "cmake"]
2+
requires = [
3+
"setuptools>=45",
4+
"setuptools_scm>=6.4",
5+
"wheel>=0.37",
6+
"ninja>=1.10; sys_platform != 'win32'",
7+
"cmake>=3.14",
8+
]
39
build-backend = "setuptools.build_meta"
410

11+
[tool.setuptools_scm]
12+
513
[tool.cibuildwheel]
614
build = "cp3*"
7-
skip = "*-win32 *-musllinux_i686 *-manylinux_i686 cp36-*"
8-
test-skip = "*_arm64 *_universal2:arm64"
9-
test-command = "python -c \"from mqt import qcec\""
15+
archs = "auto64"
16+
test-skip = "*-macosx_arm64 *-musllinux* *aarch64"
17+
test-extras = ["tests"]
18+
test-command = "python -m pytest {project}/test/python"
1019
environment = { DEPLOY = "ON" }
20+
build-frontend = "build"
1121
build-verbosity = 3
1222

1323
[tool.cibuildwheel.linux]
1424

1525
[tool.cibuildwheel.macos]
16-
archs = "x86_64"
1726
environment = { MACOSX_DEPLOYMENT_TARGET = "10.15", DEPLOY = "ON" }
1827

1928
[tool.cibuildwheel.windows]

0 commit comments

Comments
Β (0)