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

Use cibuildwheel to build and test wheels #805

Merged
merged 5 commits into from
Dec 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
use cibuildwheel
  • Loading branch information
zariiii9003 committed Dec 30, 2022
commit 754f3d32c26d540f7334142df0a305642adc24fa
2 changes: 1 addition & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
sudo apt update
sudo apt install libegl1 libopengl0
fi
python -m nuitka ./asammdf/gui/asammdfgui.py --standalone --enable-plugin=numpy --enable-plugin=pyside6 --disable-console
python -m nuitka ./src/asammdf/gui/asammdfgui.py --standalone --enable-plugin=numpy --enable-plugin=pyside6 --disable-console
cp asammdfd.dist dist/${RUNNER_OS}

# see: https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
Expand Down
52 changes: 32 additions & 20 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,45 @@ name: wheels
on: [push, pull_request]

jobs:
test:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
# Used to host cibuildwheel
- uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install packages
run: |
pip install build numpy wheel
python setup.py bdist_wheel
python setup.py sdist

# see: https://github.com/ymyzk/tox-gh-actions

- name: Archive dist artifacts
uses: actions/upload-artifact@v2
python-version: "3.10"

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/**
if-no-files-found: error
path: dist/*.tar.gz
6 changes: 3 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include LICENSE
include requirements.txt
recursive-include asammdf *.ui
recursive-include asammdf *.c
recursive-include asammdf *.qrc
recursive-include src/asammdf *.ui
recursive-include src/asammdf *.c
recursive-include src/asammdf *.qrc
2 changes: 1 addition & 1 deletion asammdf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from pathlib import Path
import site
import sys

asammdf_path = Path.cwd() / "asammdf" / "gui" / "asammdfgui.py"
asammdf_path = Path.cwd() / "src" / "asammdf" / "gui" / "asammdfgui.py"


block_cipher = None
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# BASE_DIR = os.path.abspath("..")
# sys.path.insert(0, BASE_DIR)

with open(os.path.join("..", "asammdf", "version.py"), "r") as f:
with open(os.path.join("..", "src", "asammdf", "version.py"), "r") as f:
for line in f:
if line.startswith("__version__"):
asam_version = line.split("=")[-1].strip().strip("'")
Expand Down
11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ build-backend = "setuptools.build_meta"

[tool.black]
extend-exclude = '''
^/asammdf/gui/ui
^/src/asammdf/gui/ui
'''

[tool.isort]
force_sort_within_sections = true
order_by_type = false
profile = "black"
skip_glob = ["asammdf/gui/ui"]
skip_glob = ["src/asammdf/gui/ui"]

[tool.cibuildwheel]
test-requires = "pytest"
test-command = "pytest {project}/test"
build-frontend = "build"
archs = ["auto64"] # only build for 64bit architectures
skip = "pp*" # skip pypy
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


def _get_version():
with PROJECT_PATH.joinpath("asammdf", "version.py").open() as f:
with PROJECT_PATH.joinpath("src", "asammdf", "version.py").open() as f:
line = next(line for line in f if line.startswith("__version__"))

version = line.partition("=")[2].strip()[1:-1]
Expand All @@ -33,7 +33,7 @@ def _get_ext_modules():
modules = [
Extension(
"asammdf.blocks.cutils",
["asammdf/blocks/cutils.c"],
["src/asammdf/blocks/cutils.c"],
include_dirs=[get_include()],
)
]
Expand Down Expand Up @@ -77,11 +77,14 @@ def _get_ext_modules():
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
# Supported python versions
python_requires=">=3.8",
# What does your project relate to?
keywords="read reader edit editor parse parser asam mdf measurement",
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=find_packages(include=("asammdf*",)),
packages=find_packages("src"),
package_dir={"": "src"},
# Alternatively, if you want to distribute just a my_module.py, uncomment
# this:
# py_modules=["my_module"],
Expand Down Expand Up @@ -118,7 +121,7 @@ def _get_ext_modules():
# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.
package_data={"asammdf": ["asammdf/gui/ui/*.ui"]},
package_data={"asammdf.gui.ui": ["*.ui"]},
include_package_data=True,
# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages. See:
Expand Down
File renamed without changes.
File renamed without changes.
Loading