| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | # prevent any prompts when |
| 6 | # apt/yum installing tzdata |
| 7 | export DEBIAN_FRONTEND="noninteractive" |
| 8 | export TZ="Europe/London" |
| 9 | |
| 10 | # Make sure zlib headers are available on linux |
| 11 | export CIBW_BEFORE_ALL_LINUX="yum install -y zlib-devel || apt-get install -y zlib1g-dev || apk add zlib-dev || true" |
| 12 | |
| 13 | # ZLIB is compiled into indexed_gzip on windwos - |
| 14 | # see .ci/download_zlib.sh and setup.py |
| 15 | export CIBW_ENVIRONMENT_WINDOWS="ZLIB_HOME='$ZLIB_HOME'" |
| 16 | |
| 17 | # Run quick test suite on built wheels. |
| 18 | export CIBW_TEST_REQUIRES="cython pytest numpy nibabel coverage pytest-cov" |
| 19 | |
| 20 | # Skip i686 and aarch64 tests: |
| 21 | # |
| 22 | # - I have experienced hangs on these platforms, |
| 23 | # which I traced to a trivial numpy operation - |
| 24 | # "numpy.linalg.det(numpy.eye(3))". |
| 25 | # |
| 26 | # - Numpy wheels are not available for these |
| 27 | # platforms for all pyvers, so has to be compiled |
| 28 | # from source during the build, which massively |
| 29 | # increases build time and complexity. |
| 30 | |
| 31 | # Skip windows tests for some python versions: |
| 32 | # |
| 33 | # - Some tests fail in the GHA Windows environment |
| 34 | # for certain Python versions. I don't know why, |
| 35 | # as the tests pass for the same Python versions |
| 36 | # in other environments. I don't have easy access |
| 37 | # to a Windows machine to try and reproduce this |
| 38 | # locally, so am disabling them for the time |
| 39 | # being. |
| 40 | # |
| 41 | export CIBW_TEST_SKIP="*i686* *aarch64* cp312-win* cp313-win* cp313t-win*" |
| 42 | |
| 43 | # Enable free-threaded builds for Python versions (3.13t) that support it |
| 44 | export CIBW_ENABLE=cpython-freethreading |
| 45 | |
| 46 | # Pytest makes it *very* awkward to run tests |
| 47 | # from an installed package, and still find/ |
| 48 | # interpret a conftest.py file correctly. |
| 49 | echo '#!/usr/bin/env bash' > testcmd |
| 50 | echo 'cp $1/pyproject.toml .' >> testcmd |
| 51 | echo 'python -m indexed_gzip.tests -c pyproject.toml --no-cov -m "not slow_test" -k "not test_zran"' >> testcmd |
| 52 | chmod a+x testcmd |
| 53 | |
| 54 | export CIBW_TEST_COMMAND="bash {project}/testcmd {project}" |
| 55 | |
| 56 | python -m pip install --upgrade pip |
| 57 | python -m pip install --upgrade setuptools |
| 58 | python -m pip install cibuildwheel |
| 59 | python -m cibuildwheel --output-dir ./dist |