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 #259

Merged
merged 49 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d64f2fb
WIP: Use cibuildwheel to build binary wheels
gmloose Nov 27, 2023
3045b47
WIP: Use cibuildwheel in github workflow
gmloose Nov 27, 2023
a1c1f03
Revert "WIP: Use cibuildwheel in github workflow"
gmloose Nov 27, 2023
3112c6c
Explicitly add Homebrew libs to support Apple M1
ludwigschwardt Dec 4, 2023
b657965
Merge branch 'master' into use-cibuildwheel
gmloose Jan 8, 2024
fa616fc
Disable python 3.6 based steps
gmloose Jan 8, 2024
cb15b62
Update py3_casacore_v3.4.docker
gmloose Jan 8, 2024
8d8e2f3
Revert "Update py3_casacore_v3.4.docker"
gmloose Jan 9, 2024
91e0cb7
WIP: Use new docker image naming scheme
gmloose Jan 16, 2024
d2a5087
Add new workflow to build releases using cibuildwheel
gmloose Jan 19, 2024
e49c194
WIP: Only build for Ubuntu for now
gmloose Jan 19, 2024
856df59
WIP: Only sdist, try upload
gmloose Jan 19, 2024
8fdea62
WIP: Only sdist, try upload (again)
gmloose Jan 19, 2024
a9d7dac
WIP: Only sdist, try upload to TestPyPI
gmloose Jan 19, 2024
0631c32
WIP: Try new trusted publishing
gmloose Jan 19, 2024
398cf1f
WIP: Try new trusted publishing (2nd try)
gmloose Jan 19, 2024
e25220f
WIP: Try new trusted publishing (3rd try)
gmloose Jan 19, 2024
e6f0362
WIP: Try new trusted publishing (4th try)
gmloose Jan 19, 2024
f448a4b
WIP: Try new trusted publishing (5th try)
gmloose Jan 19, 2024
5cb66db
WIP: Try new trusted publishing (needs sdist & wheels)
gmloose Jan 19, 2024
a4cad76
WIP: Try building for MacOS
gmloose Jan 19, 2024
82a91a1
WIP: MacOS doesn't work yet; not base image available
gmloose Jan 19, 2024
1486876
WIP: Revert to 4th try
gmloose Jan 19, 2024
e3163e1
WIP: Revert to 5th try
gmloose Jan 19, 2024
50bdd8e
WIP: Build sdist & wheels
gmloose Jan 19, 2024
51bf35f
WIP: Allow overwriting wheelhouse artifacts
gmloose Jan 19, 2024
72ff06c
WIP: Build for Python 3.9 only
gmloose Feb 5, 2024
f502ac4
WIP: Build for all Python versions
gmloose Feb 5, 2024
cc21cc3
WIP: Try to push to PyPI (Python 3.7 only)
gmloose Feb 5, 2024
531509b
WIP: Should now only upload when tag is created
gmloose Feb 5, 2024
0340341
WIP: Should now only upload when tag is created (Python 3.7 only)
gmloose Feb 5, 2024
1d90bf7
WIP: Should now only upload when tag is created (Python 3.7 only)
gmloose Feb 5, 2024
e34b4a5
WIP: Build for all python versions; upload only when tag is created
gmloose Feb 5, 2024
e049f8e
WIP: Upload to TestPyPI (but only when tag is created)
gmloose Feb 5, 2024
d6fa59f
WIP: Final tweaks
gmloose Feb 5, 2024
b4ce399
WIP: Revert 'fixes' to Linux workflow
gmloose Feb 5, 2024
20f8f8c
WIP: Try to build for MacOS (only)
gmloose Feb 5, 2024
51a4c42
Revert "WIP: Try to build for MacOS (only)"
gmloose Feb 5, 2024
0875119
Disable use of old docker images
gmloose Feb 12, 2024
e0ddcee
Bump version of actions checkout and upload-artifact
gmloose Feb 12, 2024
cbb8e2c
WIP: Replace ADD with COPY to see if that solves the failing build issue
gmloose Feb 12, 2024
ff707f1
WIP: Set WORKDIR before ADDing directory
gmloose Feb 12, 2024
8342379
WIP: Is there something special about the directory /code?
gmloose Feb 12, 2024
17ec058
WIP: Looks like /code is a forbidden directory name for GitHub workflows
gmloose Feb 12, 2024
1d70712
WIP: Replace /code with /src in Docker files
gmloose Feb 12, 2024
c9c1eb8
WIP: Bump MacOS version; 10.15 is no longer supported
gmloose Feb 12, 2024
72a7edf
WIP: Bump MacOS version to latest
gmloose Feb 12, 2024
5ead41a
Revert "WIP: Bump MacOS version to latest"
gmloose Feb 12, 2024
2820655
WIP: Fix wheel build: temporarily allow overwriting of generated wheels
gmloose Feb 12, 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
76 changes: 76 additions & 0 deletions .github/workflows/build_release.yml
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
10 changes: 5 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
dist:
# - pep8
# - mypy
- py2_kern6
- py3_kern6
# - py2_kern6
# - py3_kern6
- py3_kern7
- py3_casacore_master
- py3_casacore_v3.3
# - py3_casacore_v3.3
- py3_casacore_v3.4
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build container
run: docker build . -t ${{ matrix.dist }} -f .github/workflows/${{ matrix.dist }}.docker
Expand Down Expand Up @@ -55,4 +55,4 @@ jobs:
# name: Publish Linux binary wheels
# with:
# path: bridge/*.whl
#
#
4 changes: 2 additions & 2 deletions .github/workflows/mypy.docker
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

6 changes: 3 additions & 3 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:

jobs:
osx:
runs-on: macos-10.15
runs-on: macos-11
continue-on-error: true

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: install homebrew packages
run: |
Expand All @@ -40,6 +40,6 @@ jobs:
run: venv/bin/delocate-wheel -v dist/*.whl

- name: Publish OS X binary wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: dist/*.whl
4 changes: 2 additions & 2 deletions .github/workflows/pep8.docker
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

4 changes: 2 additions & 2 deletions .github/workflows/py2_kern6.docker
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ RUN docker-apt-install \
python-six \
python-pip \
python-nose
ADD . /code
WORKDIR /code
ADD . /src
WORKDIR /src
RUN pip install -e .
RUN pip install -r tests/requirements.txt
RUN nosetests --with-coverage --verbose --cover-package=casacore
4 changes: 2 additions & 2 deletions .github/workflows/py3_casacore_master.docker
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ RUN docker-apt-install \
python3-six \
python3-pip \
python3-nose
ADD . /code
WORKDIR /code
ADD . /src
WORKDIR /src
RUN pip3 install -e .
RUN pip3 install -r tests/requirements.txt
RUN nosetests3 --with-coverage --verbose --cover-package=casacore
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/py3_casacore_v3.3.docker
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ RUN docker-apt-install \
python3-six \
python3-pip \
python3-nose
ADD . /code
WORKDIR /code
ADD . /src
WORKDIR /src
RUN pip3 install -e .
RUN pip3 install -r tests/requirements.txt
RUN nosetests3 --with-coverage --verbose --cover-package=casacore
4 changes: 2 additions & 2 deletions .github/workflows/py3_casacore_v3.4.docker
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ RUN docker-apt-install \
python3-six \
python3-pip \
python3-nose
ADD . /code
WORKDIR /code
ADD . /src
WORKDIR /src
RUN pip3 install -e .
RUN pip3 install -r tests/requirements.txt
RUN nosetests3 --with-coverage --verbose --cover-package=casacore
4 changes: 2 additions & 2 deletions .github/workflows/py3_kern6.docker
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ RUN docker-apt-install \
python3-six \
python3-pip \
python3-nose
ADD . /code
WORKDIR /code
ADD . /src
WORKDIR /src
RUN pip3 install -e .
RUN pip3 install -r tests/requirements.txt
RUN nosetests3 --with-coverage --verbose --cover-package=casacore
4 changes: 2 additions & 2 deletions .github/workflows/py3_kern7.docker
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ RUN docker-apt-install \
python3-six \
python3-pip \
python3-nose
ADD . /code
WORKDIR /code
ADD . /src
WORKDIR /src
RUN pip3 install -e .
RUN pip3 install -r tests/requirements.txt
RUN nosetests3 --with-coverage --verbose --cover-package=casacore
51 changes: 51 additions & 0 deletions pyproject.toml
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"
Loading