diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml new file mode 100644 index 0000000..7012acb --- /dev/null +++ b/.github/workflows/build_release.yml @@ -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/cibuildwheel@v2.16 + + - 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/gh-action-pypi-publish@v1.8.11 + with: + # For testing, use TestPyPI + # repository-url: https://test.pypi.org/legacy/ + skip-existing: true + verbose: true diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 4cec58e..2adf36c 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -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 @@ -55,4 +55,4 @@ jobs: # name: Publish Linux binary wheels # with: # path: bridge/*.whl -# \ No newline at end of file +# diff --git a/.github/workflows/mypy.docker b/.github/workflows/mypy.docker index ba41270..0aa2a30 100644 --- a/.github/workflows/mypy.docker +++ b/.github/workflows/mypy.docker @@ -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 diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 21b3783..57c766e 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -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: | @@ -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 diff --git a/.github/workflows/pep8.docker b/.github/workflows/pep8.docker index d593bf4..f2856e2 100644 --- a/.github/workflows/pep8.docker +++ b/.github/workflows/pep8.docker @@ -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 diff --git a/.github/workflows/py2_kern6.docker b/.github/workflows/py2_kern6.docker index f764a2a..7a3dd76 100644 --- a/.github/workflows/py2_kern6.docker +++ b/.github/workflows/py2_kern6.docker @@ -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 diff --git a/.github/workflows/py3_casacore_master.docker b/.github/workflows/py3_casacore_master.docker index c0f7cec..a3cbad7 100644 --- a/.github/workflows/py3_casacore_master.docker +++ b/.github/workflows/py3_casacore_master.docker @@ -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 diff --git a/.github/workflows/py3_casacore_v3.3.docker b/.github/workflows/py3_casacore_v3.3.docker index befe104..07fdc5c 100644 --- a/.github/workflows/py3_casacore_v3.3.docker +++ b/.github/workflows/py3_casacore_v3.3.docker @@ -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 diff --git a/.github/workflows/py3_casacore_v3.4.docker b/.github/workflows/py3_casacore_v3.4.docker index 2d12b0b..ac00188 100644 --- a/.github/workflows/py3_casacore_v3.4.docker +++ b/.github/workflows/py3_casacore_v3.4.docker @@ -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 diff --git a/.github/workflows/py3_kern6.docker b/.github/workflows/py3_kern6.docker index 106c81e..16f79df 100644 --- a/.github/workflows/py3_kern6.docker +++ b/.github/workflows/py3_kern6.docker @@ -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 diff --git a/.github/workflows/py3_kern7.docker b/.github/workflows/py3_kern7.docker index 5cd7486..ddc9387 100644 --- a/.github/workflows/py3_kern7.docker +++ b/.github/workflows/py3_kern7.docker @@ -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 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2669503 --- /dev/null +++ b/pyproject.toml @@ -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"