-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from casacore/use-cibuildwheel
Use cibuildwheel This PR adds support for building `python-casacore` using [cibuildwheel](https://cibuildwheel.readthedocs.io/en/stable/), and a GitHub workflow that builds and uploads these wheels to [PyPI](https://pypi.org/project/python-casacore/).
- Loading branch information
Showing
12 changed files
with
151 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Build and upload to PyPI | ||
|
||
# Only build and upload when a new release tag is created | ||
# on: | ||
# push: | ||
# tags: | ||
# - "v[0-9]+.[0-9]+.[0-9]+" | ||
# - "v[0-9]+.[0-9]+.[0-9]+[a-z]+[0-9]+" | ||
# Alternatively, build on every branch push, tag push, and pull request change | ||
on: [push] #, pull_request] | ||
|
||
jobs: | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] #, macos-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: wheelhouse/*.whl | ||
# Temporary allow overwrite until we use setuptools_scm to | ||
# generate unique version numbers on every push | ||
overwrite: true | ||
|
||
upload_pypi: | ||
name: Upload release to PyPI | ||
runs-on: ubuntu-latest | ||
needs: [build_sdist, build_wheels] | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/python-casacore | ||
# For testing, use TestPyPI | ||
# url: https://test.pypi.org/p/python-casacore | ||
permissions: | ||
id-token: write | ||
# Upload to PyPI on every tag starting with 'v' | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
# Alternatively, to publish when a GitHub Release is created, use the following rule: | ||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
# unpacks default artifact into dist/ | ||
# if `name: artifact` is omitted, the action will create extra parent dir | ||
name: artifact | ||
path: dist | ||
|
||
- uses: pypa/[email protected] | ||
with: | ||
# For testing, use TestPyPI | ||
# repository-url: https://test.pypi.org/legacy/ | ||
skip-existing: true | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
FROM kernsuite/base:7 | ||
RUN docker-apt-install python3-pip | ||
RUN pip3 install mypy | ||
ADD . /code | ||
WORKDIR /code | ||
ADD . /src | ||
WORKDIR /src | ||
RUN mypy --ignore-missing-imports casacore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
FROM kernsuite/base:7 | ||
RUN docker-apt-install python3-pip | ||
RUN pip3 install pycodestyle | ||
ADD . /code | ||
WORKDIR /code | ||
ADD . /src | ||
WORKDIR /src | ||
RUN pycodestyle casacore --ignore=E501 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[build-system] | ||
requires = [ | ||
"build", | ||
"cmake>=3.18", | ||
"oldest-supported-numpy", | ||
"setuptools", | ||
"wheel", | ||
] | ||
|
||
[tool.cibuildwheel] | ||
build = "cp3{7,8,9,10,11,12}-*_x86_64" | ||
build-verbosity = 1 | ||
environment = """ \ | ||
CFLAGS="-I/usr/include/cfitsio" \ | ||
LD_LIBRARY_PATH=/opt/boost/lib \ | ||
""" | ||
test-command = "cd {package}/tests && pytest" | ||
test-requires = "pytest" | ||
|
||
[tool.cibuildwheel.macos] | ||
repair-wheel-command = """\ | ||
DYLD_LIBRARY_PATH=${BOOST_INSTALL_DIR}/lib delocate-wheel \ | ||
--require-archs {delocate_archs} -w {dest_dir} -v {wheel}\ | ||
""" | ||
|
||
[tool.cibuildwheel.linux] | ||
skip = ["*-musllinux_*"] | ||
|
||
[[tool.cibuildwheel.overrides]] | ||
select="cp37-*" | ||
manylinux-x86_64-image = "quay.io/casacore/casacore:py37_master" | ||
|
||
[[tool.cibuildwheel.overrides]] | ||
select="cp38-*" | ||
manylinux-x86_64-image = "quay.io/casacore/casacore:py38_master" | ||
|
||
[[tool.cibuildwheel.overrides]] | ||
select="cp39-*" | ||
manylinux-x86_64-image = "quay.io/casacore/casacore:py39_master" | ||
|
||
[[tool.cibuildwheel.overrides]] | ||
select="cp310-*" | ||
manylinux-x86_64-image = "quay.io/casacore/casacore:py310_master" | ||
|
||
[[tool.cibuildwheel.overrides]] | ||
select="cp311-*" | ||
manylinux-x86_64-image = "quay.io/casacore/casacore:py311_master" | ||
|
||
[[tool.cibuildwheel.overrides]] | ||
select="cp312-*" | ||
manylinux-x86_64-image = "quay.io/casacore/casacore:py312_master" |