From b34dab8e76c7d10d87f1b782a06d0f30a164c54c Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 16 Oct 2023 12:57:30 -0300 Subject: [PATCH 01/18] cibuildwheel --- .github/workflows/cibuildwheel.yml | 164 +++++++++++++++++++++++++++++ pyproject.toml | 1 + 2 files changed, 165 insertions(+) create mode 100644 .github/workflows/cibuildwheel.yml diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml new file mode 100644 index 000000000..6ff0b5378 --- /dev/null +++ b/.github/workflows/cibuildwheel.yml @@ -0,0 +1,164 @@ +name: Wheels + +on: + pull_request: + push: + tags: + - "v*" + release: + types: + - published + +permissions: + contents: read + +jobs: + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v4 + name: Install Python + with: + python-version: 3.x + + - name: Install APT packages + if: contains(${{ matrix.os }}, 'ubuntu') + run: | + sudo apt update + sudo apt install libhdf5-dev libnetcdf-dev + + - name: Build sdist + run: > + pip install build + && python -m build --sdist . --outdir dist + + - uses: actions/upload-artifact@v3 + with: + path: dist/*.tar.gz + + + build_bdist: + name: "Build ${{ matrix.os }} (${{ matrix.arch }}) wheels" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macos-latest"] + arch: ["x86_64", "arm64"] + exclude: + - os: ubuntu-latest + arch: arm64 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" + uses: pypa/cibuildwheel@v2.15.0 + env: + # Skips pypy and musllinux for now. + CIBW_SKIP: "pp* cp36-* cp37-* *-musllinux*" + CIBW_ARCHS: ${{ matrix.arch }} + CIBW_BUILD_FRONTEND: build + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + CIBW_BEFORE_BUILD_LINUX: yum install -y hdf5-devel netcdf-devel + CIBW_BEFORE_BUILD_MACOS: brew install hdf5 netcdf + CIBW_TEST_SKIP: "*_arm64" + CIBW_TEST_REQUIRES: pytest cython + CIBW_TEST_COMMAND: > + python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" && + cd {project}/test && python run_all.py + + - uses: actions/upload-artifact@v3 + with: + name: pypi-artifacts + path: ${{ github.workspace }}/wheelhouse/*.whl + + + build_wheels_windows: + name: Build wheels for ${{matrix.arch}} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest] + arch: [win_amd64] + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v4 + name: Install Python + with: + python-version: 3.x + + - name: Setup Micromamba Python ${{ matrix.python-version }} + uses: mamba-org/setup-micromamba@v1 + with: + environment-name: build + init-shell: bash + create-args: >- + python=${{ matrix.python-version }} hdf5 libnetcdf --channel conda-forge + + - name: Install cibuildwheel + run: | + python -m pip install --upgrade cibuildwheel + + - name: Build wheels for Windows (${{ matrix.arch }}) + run: cibuildwheel --output-dir wheelhouse + env: + CIBW_BUILD: "cp39-${{ matrix.arch }} cp310-${{ matrix.arch }} cp311-${{ matrix.arch }} cp312-${{ matrix.arch }}" + CIBW_ENVIRONMENT_WINDOWS: > + HDF5_DIR="C:\\Users\\runneradmin\\micromamba\\envs\\build\\Library" + netCDF4_DIR="C:\\Users\\runneradmin\\micromamba\\envs\\build\\Library" + PATH="C:\\Users\\runneradmin\\micromamba\\envs\\build\\Library\\bin;${PATH}" + CIBW_BEFORE_BUILD: "python -m pip install delvewheel" + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" + CIBW_TEST_COMMAND: > + python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" + && xcopy {project}\\test . /E/H + && python -m pip install --upgrade numpy cython packaging + && python run_all.py + + - uses: actions/upload-artifact@v3 + with: + name: pypi-artifacts + path: ${{ github.workspace }}/wheelhouse/*.whl + + + show-artifacts: + needs: [build_bdist, build_sdist, build_wheels_windows] + name: "Show artifacts" + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: pypi-artifacts + path: ${{ github.workspace }}/dist + + - shell: bash + run: | + ls -l ${{ github.workspace }}/dist + + + publish-artifacts-pypi: + needs: [build_bdist, build_sdist, build_wheels_windows] + name: "Publish to PyPI" + runs-on: ubuntu-latest + # upload to PyPI for every tag starting with 'v' + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') + steps: + - uses: actions/download-artifact@v3 + with: + name: pypi-artifacts + path: ${{ github.workspace }}/dist + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} + print_hash: true diff --git a/pyproject.toml b/pyproject.toml index e58ccd16e..30ac51ca0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ requires = [ "oldest-supported-numpy ; python_version < '3.9'", "numpy>=2.0.0rc1 ; python_version >= '3.9'", "setuptools>=61", + "packaging", ] build-backend = "setuptools.build_meta" From da5b2417934331ad050eed49850b2aae54fd9e6d Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Sun, 22 Oct 2023 15:45:09 -0300 Subject: [PATCH 02/18] show DLLs and pin libnetcdf for more control --- .github/workflows/cibuildwheel.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 6ff0b5378..455637caf 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -102,7 +102,7 @@ jobs: environment-name: build init-shell: bash create-args: >- - python=${{ matrix.python-version }} hdf5 libnetcdf --channel conda-forge + python=${{ matrix.python-version }} libnetcdf=4.9.2 --channel conda-forge - name: Install cibuildwheel run: | @@ -117,7 +117,9 @@ jobs: netCDF4_DIR="C:\\Users\\runneradmin\\micromamba\\envs\\build\\Library" PATH="C:\\Users\\runneradmin\\micromamba\\envs\\build\\Library\\bin;${PATH}" CIBW_BEFORE_BUILD: "python -m pip install delvewheel" - CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: > + delvewheel show {wheel} + && delvewheel repair -w {dest_dir} {wheel} CIBW_TEST_COMMAND: > python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" && xcopy {project}\\test . /E/H From ffb47d842123c1b73acf6f4088cfdc6fbaec6235 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 23 Oct 2023 08:30:48 -0300 Subject: [PATCH 03/18] build netcdf-c --- .ci/build_deps.sh | 28 ++++++++++++++++++++++++++++ .github/workflows/cibuildwheel.yml | 9 +++++---- 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 .ci/build_deps.sh diff --git a/.ci/build_deps.sh b/.ci/build_deps.sh new file mode 100644 index 000000000..74f1b89f3 --- /dev/null +++ b/.ci/build_deps.sh @@ -0,0 +1,28 @@ +#!/usr/bin/bash + +set -ex + + +download_and_build_netcdf() { + if [ ! -d "netcdf-c" ]; then + netcdf_url=https://github.com/Unidata/netcdf-c + netcdf_src=netcdf-c + netcdf_build=netcdf-build + + git clone ${netcdf_url} -b v4.9.2 ${netcdf_src} + + cmake ${netcdf_src} -B ${netcdf_build} \ + -DENABLE_NETCDF4=on \ + -DENABLE_HDF5=on \ + -DENABLE_DAP=on \ + -DENABLE_TESTS=off \ + -DENABLE_PLUGIN_INSTALL=off \ + -DBUILD_SHARED_LIBS=on \ + -DCMAKE_BUILD_TYPE=Release + + cmake --build ${netcdf_build} \ + --target install +fi +} + +download_and_build_netcdf diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 455637caf..742789ad7 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -55,8 +55,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" uses: pypa/cibuildwheel@v2.15.0 @@ -65,8 +63,11 @@ jobs: CIBW_SKIP: "pp* cp36-* cp37-* *-musllinux*" CIBW_ARCHS: ${{ matrix.arch }} CIBW_BUILD_FRONTEND: build - CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 - CIBW_BEFORE_BUILD_LINUX: yum install -y hdf5-devel netcdf-devel + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 + CIBW_BEFORE_BUILD_LINUX: > + dnf install -y epel-release + && dnf install -y hdf5-devel libcurl-devel + && sh .ci/build_deps.sh CIBW_BEFORE_BUILD_MACOS: brew install hdf5 netcdf CIBW_TEST_SKIP: "*_arm64" CIBW_TEST_REQUIRES: pytest cython From 83dbdc72e600765ffd50b367d510f596c50ff5e8 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 23 Oct 2023 14:47:33 -0300 Subject: [PATCH 04/18] declare test deps --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 30ac51ca0..fc24775e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ requires = [ "oldest-supported-numpy ; python_version < '3.9'", "numpy>=2.0.0rc1 ; python_version >= '3.9'", "setuptools>=61", - "packaging", ] build-backend = "setuptools.build_meta" @@ -48,7 +47,6 @@ tests = [ "pytest", ] - [project.readme] text = """\ netCDF version 4 has many features not found in earlier versions of the library, From 49ddb96d0cdf73cb03e52f7c44f8772fee328a7e Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 23 Oct 2023 15:06:24 -0300 Subject: [PATCH 05/18] Condense a bit --- .github/workflows/cibuildwheel.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 742789ad7..b9578b71f 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -70,7 +70,7 @@ jobs: && sh .ci/build_deps.sh CIBW_BEFORE_BUILD_MACOS: brew install hdf5 netcdf CIBW_TEST_SKIP: "*_arm64" - CIBW_TEST_REQUIRES: pytest cython + CIBW_TEST_REQUIRES: pytest cython packaging CIBW_TEST_COMMAND: > python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" && cd {project}/test && python run_all.py @@ -107,7 +107,7 @@ jobs: - name: Install cibuildwheel run: | - python -m pip install --upgrade cibuildwheel + python -m pip install --upgrade cibuildwheel delvewheel - name: Build wheels for Windows (${{ matrix.arch }}) run: cibuildwheel --output-dir wheelhouse @@ -117,14 +117,13 @@ jobs: HDF5_DIR="C:\\Users\\runneradmin\\micromamba\\envs\\build\\Library" netCDF4_DIR="C:\\Users\\runneradmin\\micromamba\\envs\\build\\Library" PATH="C:\\Users\\runneradmin\\micromamba\\envs\\build\\Library\\bin;${PATH}" - CIBW_BEFORE_BUILD: "python -m pip install delvewheel" CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: > delvewheel show {wheel} && delvewheel repair -w {dest_dir} {wheel} + CIBW_TEST_REQUIRES: pytest cython packaging CIBW_TEST_COMMAND: > python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" && xcopy {project}\\test . /E/H - && python -m pip install --upgrade numpy cython packaging && python run_all.py - uses: actions/upload-artifact@v3 From ab4381f3093533c6e3e7d5ac346658d8797476cd Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 24 Oct 2023 14:37:14 -0300 Subject: [PATCH 06/18] human readable sizes --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index b9578b71f..82396e037 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -144,7 +144,7 @@ jobs: - shell: bash run: | - ls -l ${{ github.workspace }}/dist + ls -lh ${{ github.workspace }}/dist publish-artifacts-pypi: From dcce9e02e81cd337b37b3026197f95b8107a9de5 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 17:30:39 +0200 Subject: [PATCH 07/18] pin ubuntu --- .github/workflows/cibuildwheel.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 82396e037..1f179b2d5 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -16,7 +16,7 @@ jobs: build_sdist: name: Build source distribution - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -47,17 +47,23 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "macos-latest"] - arch: ["x86_64", "arm64"] - exclude: - - os: ubuntu-latest - arch: arm64 + include: + - os: ubuntu-22.04 + arch: x86_64 + - os: ubuntu-22.04 + arch: aarch64 + - os: macos-14 + arch: arm64 + - os: macos-13 + arch: x86_64 steps: - uses: actions/checkout@v4 - + with: + fetch-depth: 0 + - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" - uses: pypa/cibuildwheel@v2.15.0 + uses: pypa/cibuildwheel@v2.18.1 env: # Skips pypy and musllinux for now. CIBW_SKIP: "pp* cp36-* cp37-* *-musllinux*" @@ -135,7 +141,7 @@ jobs: show-artifacts: needs: [build_bdist, build_sdist, build_wheels_windows] name: "Show artifacts" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/download-artifact@v3 with: @@ -150,7 +156,7 @@ jobs: publish-artifacts-pypi: needs: [build_bdist, build_sdist, build_wheels_windows] name: "Publish to PyPI" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # upload to PyPI for every tag starting with 'v' if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') steps: From 310fcf13493153b9bf84bd4248201cdf6eca379f Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 17:54:20 +0200 Subject: [PATCH 08/18] submodules --- .github/workflows/cibuildwheel.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 1f179b2d5..d7fa0e8bc 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -19,6 +19,8 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: actions/setup-python@v4 name: Install Python @@ -61,6 +63,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + submodules: 'true' - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" uses: pypa/cibuildwheel@v2.18.1 @@ -97,6 +100,9 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: 'true' - uses: actions/setup-python@v4 name: Install Python From 3dbf4b1b8788d165224964d43835d39054ce96f9 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 18:33:47 +0200 Subject: [PATCH 09/18] don't build aarch64 for now --- .github/workflows/cibuildwheel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index d7fa0e8bc..2823a353e 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -52,8 +52,8 @@ jobs: include: - os: ubuntu-22.04 arch: x86_64 - - os: ubuntu-22.04 - arch: aarch64 + # - os: ubuntu-22.04 + # arch: aarch64 - os: macos-14 arch: arm64 - os: macos-13 From 11b470f69c0573d74c2e0f444ec5fe98e1da2ee8 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 18:46:14 +0200 Subject: [PATCH 10/18] increase verbosity --- test/run_all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run_all.py b/test/run_all.py index 705cc6520..ef0df30b1 100755 --- a/test/run_all.py +++ b/test/run_all.py @@ -16,7 +16,7 @@ testsuite.addTests(unittest.TestLoader().loadTestsFromModule(m)) # Run the test suite. -def test(verbosity=1): +def test(verbosity=2): runner = unittest.TextTestRunner(verbosity=verbosity) runner.run(testsuite) From 6f88d6ac162dff7b6d620b887d97c35b560fa0d5 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 18:53:28 +0200 Subject: [PATCH 11/18] increase verbosity, again --- test/run_all.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/run_all.py b/test/run_all.py index ef0df30b1..3c38cbb16 100755 --- a/test/run_all.py +++ b/test/run_all.py @@ -15,10 +15,6 @@ m = __import__(os.path.splitext(f)[0]) testsuite.addTests(unittest.TestLoader().loadTestsFromModule(m)) -# Run the test suite. -def test(verbosity=2): - runner = unittest.TextTestRunner(verbosity=verbosity) - runner.run(testsuite) if __name__ == '__main__': import numpy, cython @@ -28,7 +24,7 @@ def test(verbosity=2): sys.stdout.write('netcdf lib version: %s\n' % __netcdf4libversion__) sys.stdout.write('numpy version %s\n' % numpy.__version__) sys.stdout.write('cython version %s\n' % cython.__version__) - runner = unittest.TextTestRunner(verbosity=1) + runner = unittest.TextTestRunner(verbosity=2) result = runner.run(testsuite) if not result.wasSuccessful(): sys.exit(1) From 2cb4c25c3f2ea743604e1a2f3b786b6549ee9546 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 19:22:14 +0200 Subject: [PATCH 12/18] try to call pytest on Windows instead --- .github/workflows/cibuildwheel.yml | 4 +--- test/run_all.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 2823a353e..cb2ff3635 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -78,7 +78,6 @@ jobs: && dnf install -y hdf5-devel libcurl-devel && sh .ci/build_deps.sh CIBW_BEFORE_BUILD_MACOS: brew install hdf5 netcdf - CIBW_TEST_SKIP: "*_arm64" CIBW_TEST_REQUIRES: pytest cython packaging CIBW_TEST_COMMAND: > python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" && @@ -135,8 +134,7 @@ jobs: CIBW_TEST_REQUIRES: pytest cython packaging CIBW_TEST_COMMAND: > python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" - && xcopy {project}\\test . /E/H - && python run_all.py + && pytest -s -rxs -v {project}\\test - uses: actions/upload-artifact@v3 with: diff --git a/test/run_all.py b/test/run_all.py index 3c38cbb16..deff8c6af 100755 --- a/test/run_all.py +++ b/test/run_all.py @@ -24,7 +24,7 @@ sys.stdout.write('netcdf lib version: %s\n' % __netcdf4libversion__) sys.stdout.write('numpy version %s\n' % numpy.__version__) sys.stdout.write('cython version %s\n' % cython.__version__) - runner = unittest.TextTestRunner(verbosity=2) + runner = unittest.TextTestRunner(verbosity=1) result = runner.run(testsuite) if not result.wasSuccessful(): sys.exit(1) From 33eebb9672494c88614ff22c2a44c121f2ee8275 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 20:31:06 +0200 Subject: [PATCH 13/18] set MACOSX_DEPLOYMENT_TARGET --- .github/workflows/cibuildwheel.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index cb2ff3635..9e30ca9f5 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -56,8 +56,10 @@ jobs: # arch: aarch64 - os: macos-14 arch: arm64 + CIBW_ENVIRONMENT: MACOSX_DEPLOYMENT_TARGET=14.0 - os: macos-13 arch: x86_64 + CIBW_ENVIRONMENT: MACOSX_DEPLOYMENT_TARGET=13.0 steps: - uses: actions/checkout@v4 @@ -77,6 +79,7 @@ jobs: dnf install -y epel-release && dnf install -y hdf5-devel libcurl-devel && sh .ci/build_deps.sh + CIBW_ENVIRONMENT: ${{ matrix.CIBW_ENVIRONMENT }} CIBW_BEFORE_BUILD_MACOS: brew install hdf5 netcdf CIBW_TEST_REQUIRES: pytest cython packaging CIBW_TEST_COMMAND: > From db5b32101f9a045e4131874f3acf984d2508d117 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 21:35:29 +0200 Subject: [PATCH 14/18] make sure all artifacts are available for upload --- .github/workflows/cibuildwheel.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 9e30ca9f5..3d8445ecf 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -38,9 +38,10 @@ jobs: pip install build && python -m build --sdist . --outdir dist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - path: dist/*.tar.gz + name: pypi-artifacts + path: ${{ github.workspace }}/dist/*.tar.gz build_bdist: @@ -86,9 +87,9 @@ jobs: python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" && cd {project}/test && python run_all.py - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - name: pypi-artifacts + name: pypi-artifacts-${{ matrix.os }}-${{ matrix.arch }} path: ${{ github.workspace }}/wheelhouse/*.whl @@ -139,9 +140,9 @@ jobs: python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" && pytest -s -rxs -v {project}\\test - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - name: pypi-artifacts + name: pypi-artifacts-${{ matrix.os }}-${{ matrix.arch }} path: ${{ github.workspace }}/wheelhouse/*.whl From d5521bf91998478d67d21612c3e4e18de2d1174e Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 22:04:39 +0200 Subject: [PATCH 15/18] use pytest instead of run_all for nix --- .github/workflows/cibuildwheel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 3d8445ecf..1b6e0de62 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -84,8 +84,8 @@ jobs: CIBW_BEFORE_BUILD_MACOS: brew install hdf5 netcdf CIBW_TEST_REQUIRES: pytest cython packaging CIBW_TEST_COMMAND: > - python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" && - cd {project}/test && python run_all.py + python -c "import netCDF4; print(f'netCDF4 v{netCDF4.__version__}')" + && pytest -s -rxs -v {project}/test - uses: actions/upload-artifact@v4 with: From 78d1c4f641f6fb9589ad4bf93972cd6218a5b630 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 10 Jun 2024 22:27:38 +0200 Subject: [PATCH 16/18] fix list artifacts --- .github/workflows/cibuildwheel.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 1b6e0de62..8ba9f0412 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -151,10 +151,11 @@ jobs: name: "Show artifacts" runs-on: ubuntu-22.04 steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - name: pypi-artifacts + pattern: pypi-artifacts* path: ${{ github.workspace }}/dist + merge-multiple: true - shell: bash run: | From 1452d902c2f7a34d1fc6766cff7edfb5a5f2cce1 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 11 Jun 2024 08:52:44 +0200 Subject: [PATCH 17/18] reduce matrix load on CIs --- .github/workflows/cibuildwheel.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 8ba9f0412..42e760fd4 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -67,12 +67,26 @@ jobs: with: fetch-depth: 0 submodules: 'true' - + + - name: Build oldest and newest Python + shell: bash + # On PRs we run only oldest and newest Python versions to reduce CI load. + # Skips pypy and musllinux everywhere. + # We are buiding 38 and 312 for now. + # These needs to rotate every new Python release. + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + CIBW_SKIP="pp* cp36-* cp37-* *-musllinux* cp39-* cp310-* cp311-*" + else + CIBW_SKIP="pp* cp36-* cp37-* *-musllinux*" + fi + echo "CIBW_SKIP=$CIBW_SKIP" >> $GITHUB_ENV + echo "Setting CIBW_SKIP=$CIBW_SKIP" + - name: "Building ${{ matrix.os }} (${{ matrix.arch }}) wheels" uses: pypa/cibuildwheel@v2.18.1 env: - # Skips pypy and musllinux for now. - CIBW_SKIP: "pp* cp36-* cp37-* *-musllinux*" + CIBW_SKIP: ${{ env.CIBW_SKIP }} CIBW_ARCHS: ${{ matrix.arch }} CIBW_BUILD_FRONTEND: build CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 From 73d1890ea16a8d04e499aa260b60ad60d9e78ddd Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 12 Jun 2024 10:49:44 +0200 Subject: [PATCH 18/18] use oldest image possible for intel macs --- .github/workflows/cibuildwheel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 42e760fd4..74eb6035e 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -58,9 +58,9 @@ jobs: - os: macos-14 arch: arm64 CIBW_ENVIRONMENT: MACOSX_DEPLOYMENT_TARGET=14.0 - - os: macos-13 + - os: macos-11 arch: x86_64 - CIBW_ENVIRONMENT: MACOSX_DEPLOYMENT_TARGET=13.0 + CIBW_ENVIRONMENT: MACOSX_DEPLOYMENT_TARGET=11.0 steps: - uses: actions/checkout@v4