From ad457c72e09a20ff8b25bfa5c6d716e8ae2e893b Mon Sep 17 00:00:00 2001 From: Bill Little Date: Sat, 9 Jul 2022 01:50:19 +0100 Subject: [PATCH 1/8] add macos x86_64 wheel support --- .github/workflows/ci-wheels.yml | 45 ++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-wheels.yml b/.github/workflows/ci-wheels.yml index 09d13ade..e5fbdb3b 100644 --- a/.github/workflows/ci-wheels.yml +++ b/.github/workflows/ci-wheels.yml @@ -25,13 +25,11 @@ concurrency: cancel-in-progress: true jobs: - build_bdist: + build_bdist_linux: name: "Build bdist ${{ matrix.arch }} ${{ matrix.os }}" runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: - # TBD: extend to support osx and windows os: [ubuntu-latest] arch: [auto64] @@ -63,6 +61,41 @@ jobs: path: ${{ github.workspace }}/wheelhouse/*.whl + build_bdist_macos: + name: "Build bdist ${{ matrix.arch }} ${{ matrix.os }}" + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest] + arch: [x86_64] + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: "Building bdist" + uses: pypa/cibuildwheel@v2.8.0 + env: + CIBW_SKIP: "cp36-* cp37-* pp*" + CIBW_ARCHS: ${{ matrix.arch }} + CIBW_BUILD_FRONTEND: build + CIBW_BEFORE_BUILD_MACOS: brew install udunits + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: > + python -c 'import cf_units; print(f"cf-units v{cf_units.__version__}")' && + python -m pytest --pyargs cf_units + UDUNITS2_INCDIR: /usr/local/Cellar/udunits/2.2.28/include + UDUNITS2_LIBDIR: /usr/local/Cellar/udunits/2.2.28/lib + UDUNITS2_XML_PATH: /usr/local/Cellar/udunits/2.2.28/share/udunits/udunits2-common.xml + + + - uses: actions/upload-artifact@v3 + with: + name: pypi-artifacts + path: ${{ github.workspace }}/wheelhouse/*.whl + + build_sdist: name: "Build sdist" runs-on: ubuntu-latest @@ -83,7 +116,7 @@ jobs: show-artifacts: - needs: [build_bdist, build_sdist] + needs: [build_bdist_linux, build_bdist_macos, build_sdist] name: "Show artifacts" runs-on: ubuntu-latest steps: @@ -98,7 +131,7 @@ jobs: publish-artifacts-test-pypi: - needs: [build_bdist, build_sdist] + needs: [build_bdist_linux, build_bdist_macos, build_sdist] name: "Publish to Test PyPI" runs-on: ubuntu-latest # upload to Test PyPI for every commit on main branch @@ -119,7 +152,7 @@ jobs: publish-artifacts-pypi: - needs: [build_bdist, build_sdist] + needs: [build_bdist_linux, build_bdist_macos, build_sdist] name: "Publish to PyPI" runs-on: ubuntu-latest # upload to PyPI for every tag starting with 'v' From fdadc536e539ceaa665d3bd627d6fb56234f201a Mon Sep 17 00:00:00 2001 From: Bill Little Date: Sat, 9 Jul 2022 02:48:58 +0100 Subject: [PATCH 2/8] add macos-12 --- .github/workflows/ci-wheels.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-wheels.yml b/.github/workflows/ci-wheels.yml index e5fbdb3b..cf64c18f 100644 --- a/.github/workflows/ci-wheels.yml +++ b/.github/workflows/ci-wheels.yml @@ -26,19 +26,19 @@ concurrency: jobs: build_bdist_linux: - name: "Build bdist ${{ matrix.arch }} ${{ matrix.os }}" + name: "Build bdist ${{ matrix.os }}" runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] - arch: [auto64] + arch: [x86_64] steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: "Building bdist" + - name: "Building ${{ matrix.os }} ${{ matrix.arch }} wheels" uses: pypa/cibuildwheel@v2.8.0 env: CIBW_SKIP: "cp36-* cp37-* pp* *-musllinux*" @@ -62,11 +62,12 @@ jobs: build_bdist_macos: - name: "Build bdist ${{ matrix.arch }} ${{ matrix.os }}" + name: "Build bdist ${{ matrix.os }}" runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [macos-latest] + os: [macos-11, macos-12] arch: [x86_64] steps: @@ -74,7 +75,7 @@ jobs: with: fetch-depth: 0 - - name: "Building bdist" + - name: "Building ${{ matrix.os }} ${{ matrix.arch }} wheels" uses: pypa/cibuildwheel@v2.8.0 env: CIBW_SKIP: "cp36-* cp37-* pp*" From c8c8ee1d425c2bd34babd98f80edba3492e51ebd Mon Sep 17 00:00:00 2001 From: Bill Little Date: Sat, 9 Jul 2022 03:06:23 +0100 Subject: [PATCH 3/8] use setuptools find_namespace --- .github/workflows/ci-wheels.yml | 18 ++++++++---------- setup.cfg | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-wheels.yml b/.github/workflows/ci-wheels.yml index cf64c18f..be34c0d6 100644 --- a/.github/workflows/ci-wheels.yml +++ b/.github/workflows/ci-wheels.yml @@ -25,7 +25,7 @@ concurrency: cancel-in-progress: true jobs: - build_bdist_linux: + build_linux: name: "Build bdist ${{ matrix.os }}" runs-on: ${{ matrix.os }} strategy: @@ -38,7 +38,7 @@ jobs: with: fetch-depth: 0 - - name: "Building ${{ matrix.os }} ${{ matrix.arch }} wheels" + - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" uses: pypa/cibuildwheel@v2.8.0 env: CIBW_SKIP: "cp36-* cp37-* pp* *-musllinux*" @@ -61,13 +61,13 @@ jobs: path: ${{ github.workspace }}/wheelhouse/*.whl - build_bdist_macos: + build_macos: name: "Build bdist ${{ matrix.os }}" runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [macos-11, macos-12] + os: [macos-latest] arch: [x86_64] steps: @@ -75,7 +75,7 @@ jobs: with: fetch-depth: 0 - - name: "Building ${{ matrix.os }} ${{ matrix.arch }} wheels" + - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" uses: pypa/cibuildwheel@v2.8.0 env: CIBW_SKIP: "cp36-* cp37-* pp*" @@ -90,7 +90,6 @@ jobs: UDUNITS2_LIBDIR: /usr/local/Cellar/udunits/2.2.28/lib UDUNITS2_XML_PATH: /usr/local/Cellar/udunits/2.2.28/share/udunits/udunits2-common.xml - - uses: actions/upload-artifact@v3 with: name: pypi-artifacts @@ -117,7 +116,7 @@ jobs: show-artifacts: - needs: [build_bdist_linux, build_bdist_macos, build_sdist] + needs: [build_linux, build_macos, build_sdist] name: "Show artifacts" runs-on: ubuntu-latest steps: @@ -132,7 +131,7 @@ jobs: publish-artifacts-test-pypi: - needs: [build_bdist_linux, build_bdist_macos, build_sdist] + needs: [build_linux, build_macos, build_sdist] name: "Publish to Test PyPI" runs-on: ubuntu-latest # upload to Test PyPI for every commit on main branch @@ -153,7 +152,7 @@ jobs: publish-artifacts-pypi: - needs: [build_bdist_linux, build_bdist_macos, build_sdist] + needs: [build_linux, build_macos, build_sdist] name: "Publish to PyPI" runs-on: ubuntu-latest # upload to PyPI for every tag starting with 'v' @@ -169,4 +168,3 @@ jobs: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} print_hash: true - diff --git a/setup.cfg b/setup.cfg index 375f17ff..81ed8b86 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,7 @@ install_requires = numpy # udunits2 cannot be installed with pip, and it is expected to be # installed separately. -packages = find: +packages = find_namespace: python_requires = >=3.8 zip_safe = False From b5ea1f755d7ad8efbbad7dea47ceedb48b414d14 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Sat, 9 Jul 2022 03:44:14 +0100 Subject: [PATCH 4/8] update manifest --- MANIFEST.in | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 9fdd77f3..312f34cb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,9 +1,13 @@ -include *.txt -include *.md -recursive-include cf_units *.py *.pxd *.pyx *.c -include cf_units/etc/site.cfg.template -include CHANGES COPYING COPYING.LESSER INSTALL -exclude cf_units/etc/site.cfg -graft requirements +# Top-level files +include CHANGES COPYING COPYING.LESSER INSTALL README.md prune .github -exclude cf_units/_version.py +exclude .gitignore + +# Files required for conda package management +recursive-include requirements * + +# Files required to build docs +recursive-include docs * +prune docs/build + +exclude cf_units/etc/site.cfg \ No newline at end of file From d896f5dffeeb28285f97502496549f001f4221f4 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Sat, 9 Jul 2022 04:18:32 +0100 Subject: [PATCH 5/8] remove redundant fail-fast --- .github/workflows/ci-wheels.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-wheels.yml b/.github/workflows/ci-wheels.yml index be34c0d6..98c9a2c1 100644 --- a/.github/workflows/ci-wheels.yml +++ b/.github/workflows/ci-wheels.yml @@ -65,7 +65,6 @@ jobs: name: "Build bdist ${{ matrix.os }}" runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: os: [macos-latest] arch: [x86_64] From 2517ca815060b80fbd5a146447656ccd93555d32 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Sat, 9 Jul 2022 21:46:31 +0100 Subject: [PATCH 6/8] rationalise --- .github/workflows/ci-wheels.yml | 94 +++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci-wheels.yml b/.github/workflows/ci-wheels.yml index 98c9a2c1..e51f14f8 100644 --- a/.github/workflows/ci-wheels.yml +++ b/.github/workflows/ci-wheels.yml @@ -25,13 +25,24 @@ concurrency: cancel-in-progress: true jobs: - build_linux: + build_bdist: name: "Build bdist ${{ matrix.os }}" runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [ubuntu-latest] - arch: [x86_64] + os: [ubuntu-latest, macos-latest] + include: + - os: ubuntu-latest + arch: x86_64 + incdir: /usr/include/udunits2 + libdir: /usr/lib64 + xml_path: /usr/share/udunits/udunits2.xml + - os: macos-latest + arch: x86_64 + incdir: /usr/local/Cellar/udunits/2.2.28/include + libdir: /usr/local/Cellar/udunits/2.2.28/lib + xml_path: /usr/local/Cellar/udunits/2.2.28/share/udunits/udunits2-common.xml steps: - uses: actions/checkout@v3 @@ -46,13 +57,14 @@ jobs: CIBW_BUILD_FRONTEND: build CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_BEFORE_BUILD_LINUX: yum install -y udunits2-devel + CIBW_BEFORE_BUILD_MACOS: brew install udunits CIBW_TEST_REQUIRES: pytest CIBW_TEST_COMMAND: > python -c 'import cf_units; print(f"cf-units v{cf_units.__version__}")' && python -m pytest --pyargs cf_units - UDUNITS2_INCDIR: /usr/include/udunits2 - UDUNITS2_LIBDIR: /usr/lib64 - UDUNITS2_XML_PATH: /usr/share/udunits/udunits2.xml + UDUNITS2_INCDIR: ${{ matrix.incdir }} + UDUNITS2_LIBDIR: ${{ matrix.libdir }} + UDUNITS2_XML_PATH: ${{ matrix.xml_path }} CIBW_ENVIRONMENT_PASS_LINUX: UDUNITS2_INCDIR UDUNITS2_LIBDIR UDUNITS2_XML_PATH - uses: actions/upload-artifact@v3 @@ -61,38 +73,38 @@ jobs: path: ${{ github.workspace }}/wheelhouse/*.whl - build_macos: - name: "Build bdist ${{ matrix.os }}" - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest] - arch: [x86_64] - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" - uses: pypa/cibuildwheel@v2.8.0 - env: - CIBW_SKIP: "cp36-* cp37-* pp*" - CIBW_ARCHS: ${{ matrix.arch }} - CIBW_BUILD_FRONTEND: build - CIBW_BEFORE_BUILD_MACOS: brew install udunits - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: > - python -c 'import cf_units; print(f"cf-units v{cf_units.__version__}")' && - python -m pytest --pyargs cf_units - UDUNITS2_INCDIR: /usr/local/Cellar/udunits/2.2.28/include - UDUNITS2_LIBDIR: /usr/local/Cellar/udunits/2.2.28/lib - UDUNITS2_XML_PATH: /usr/local/Cellar/udunits/2.2.28/share/udunits/udunits2-common.xml - - - uses: actions/upload-artifact@v3 - with: - name: pypi-artifacts - path: ${{ github.workspace }}/wheelhouse/*.whl + # build_macos: + # name: "Build bdist ${{ matrix.os }}" + # runs-on: ${{ matrix.os }} + # strategy: + # matrix: + # os: [macos-latest] + # arch: [x86_64] + + # steps: + # - uses: actions/checkout@v3 + # with: + # fetch-depth: 0 + + # - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" + # uses: pypa/cibuildwheel@v2.8.0 + # env: + # CIBW_SKIP: "cp36-* cp37-* pp*" + # CIBW_ARCHS: ${{ matrix.arch }} + # CIBW_BUILD_FRONTEND: build + # CIBW_BEFORE_BUILD_MACOS: brew install udunits + # CIBW_TEST_REQUIRES: pytest + # CIBW_TEST_COMMAND: > + # python -c 'import cf_units; print(f"cf-units v{cf_units.__version__}")' && + # python -m pytest --pyargs cf_units + # UDUNITS2_INCDIR: /usr/local/Cellar/udunits/2.2.28/include + # UDUNITS2_LIBDIR: /usr/local/Cellar/udunits/2.2.28/lib + # UDUNITS2_XML_PATH: /usr/local/Cellar/udunits/2.2.28/share/udunits/udunits2-common.xml + + # - uses: actions/upload-artifact@v3 + # with: + # name: pypi-artifacts + # path: ${{ github.workspace }}/wheelhouse/*.whl build_sdist: @@ -115,7 +127,7 @@ jobs: show-artifacts: - needs: [build_linux, build_macos, build_sdist] + needs: [build_bdist, build_sdist] name: "Show artifacts" runs-on: ubuntu-latest steps: @@ -130,7 +142,7 @@ jobs: publish-artifacts-test-pypi: - needs: [build_linux, build_macos, build_sdist] + needs: [build_bdist, build_sdist] name: "Publish to Test PyPI" runs-on: ubuntu-latest # upload to Test PyPI for every commit on main branch @@ -151,7 +163,7 @@ jobs: publish-artifacts-pypi: - needs: [build_linux, build_macos, build_sdist] + needs: [build_bdist, build_sdist] name: "Publish to PyPI" runs-on: ubuntu-latest # upload to PyPI for every tag starting with 'v' From 21c87da37b5def0cbdf6f07c55b7f202bf64a220 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Sat, 9 Jul 2022 22:02:05 +0100 Subject: [PATCH 7/8] add macos arm64 --- .github/workflows/ci-wheels.yml | 52 +++++++-------------------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci-wheels.yml b/.github/workflows/ci-wheels.yml index e51f14f8..3b63385d 100644 --- a/.github/workflows/ci-wheels.yml +++ b/.github/workflows/ci-wheels.yml @@ -26,20 +26,22 @@ concurrency: jobs: build_bdist: - name: "Build bdist ${{ matrix.os }}" - runs-on: ${{ matrix.os }} + name: "Build ${{ matrix.os }} (${{ matrix.arch }}) wheels" + runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: ["ubuntu", "macos"] + arch: ["x86_64", "arm64"] + exclude: + - os: ubuntu + arch: arm64 include: - - os: ubuntu-latest - arch: x86_64 + - os: ubuntu incdir: /usr/include/udunits2 libdir: /usr/lib64 xml_path: /usr/share/udunits/udunits2.xml - - os: macos-latest - arch: x86_64 + - os: macos incdir: /usr/local/Cellar/udunits/2.2.28/include libdir: /usr/local/Cellar/udunits/2.2.28/lib xml_path: /usr/local/Cellar/udunits/2.2.28/share/udunits/udunits2-common.xml @@ -58,6 +60,8 @@ jobs: CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_BEFORE_BUILD_LINUX: yum install -y udunits2-devel CIBW_BEFORE_BUILD_MACOS: brew install udunits + # https://cibuildwheel.readthedocs.io/en/stable/faq/#apple-silicon + CIBW_TEST_SKIP: "*_arm64" CIBW_TEST_REQUIRES: pytest CIBW_TEST_COMMAND: > python -c 'import cf_units; print(f"cf-units v{cf_units.__version__}")' && @@ -73,40 +77,6 @@ jobs: path: ${{ github.workspace }}/wheelhouse/*.whl - # build_macos: - # name: "Build bdist ${{ matrix.os }}" - # runs-on: ${{ matrix.os }} - # strategy: - # matrix: - # os: [macos-latest] - # arch: [x86_64] - - # steps: - # - uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - - # - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" - # uses: pypa/cibuildwheel@v2.8.0 - # env: - # CIBW_SKIP: "cp36-* cp37-* pp*" - # CIBW_ARCHS: ${{ matrix.arch }} - # CIBW_BUILD_FRONTEND: build - # CIBW_BEFORE_BUILD_MACOS: brew install udunits - # CIBW_TEST_REQUIRES: pytest - # CIBW_TEST_COMMAND: > - # python -c 'import cf_units; print(f"cf-units v{cf_units.__version__}")' && - # python -m pytest --pyargs cf_units - # UDUNITS2_INCDIR: /usr/local/Cellar/udunits/2.2.28/include - # UDUNITS2_LIBDIR: /usr/local/Cellar/udunits/2.2.28/lib - # UDUNITS2_XML_PATH: /usr/local/Cellar/udunits/2.2.28/share/udunits/udunits2-common.xml - - # - uses: actions/upload-artifact@v3 - # with: - # name: pypi-artifacts - # path: ${{ github.workspace }}/wheelhouse/*.whl - - build_sdist: name: "Build sdist" runs-on: ubuntu-latest From 248ce8e8574fc9c4bc15b58de279e5980950caea Mon Sep 17 00:00:00 2001 From: Bill Little Date: Mon, 11 Jul 2022 11:23:21 +0100 Subject: [PATCH 8/8] review actions --- .github/workflows/ci-wheels.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-wheels.yml b/.github/workflows/ci-wheels.yml index 3b63385d..357cae46 100644 --- a/.github/workflows/ci-wheels.yml +++ b/.github/workflows/ci-wheels.yml @@ -31,6 +31,7 @@ jobs: strategy: fail-fast: false matrix: + # TBD: extend to support windows os: ["ubuntu", "macos"] arch: ["x86_64", "arm64"] exclude: