Skip to content

Commit

Permalink
CI: add a configuration testing numpy 2.0.0rc1
Browse files Browse the repository at this point in the history
Refs OSGeo#9751

This commit should be reverted once alpine:edge switches to numpy 2
  • Loading branch information
rouault committed Apr 25, 2024
1 parent bfe3946 commit dcd1f2c
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/alpine_numpy2/Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
FROM alpine:edge

RUN apk add \
apache-arrow-dev \
armadillo-dev \
basisu-dev \
blosc-dev \
brunsli-dev \
ccache \
cfitsio-dev \
cmake \
curl-dev \
expat-dev \
freexl-dev \
gcc \
g++ \
geos-dev \
giflib-dev \
gnu-libiconv-dev \
hdf5-dev \
json-c-dev \
kealib-dev \
libaec-dev \
libarchive-dev \
libdeflate-dev \
libgeotiff-dev \
libheif-dev \
libjpeg-turbo-dev \
libjxl-dev \
libkml-dev \
libpng-dev \
libpq-dev \
librasterlite2-dev \
libspatialite-dev \
libtirpc-dev \
libwebp-dev \
libxml2-dev \
libxslt-dev \
linux-headers \
lz4-dev \
make \
mariadb-connector-c-dev \
netcdf-dev \
odbc-cpp-wrapper-dev \
ogdi-dev \
openexr-dev \
openjpeg-dev \
openssl-dev \
pcre2-dev \
podofo-dev \
poppler-dev \
proj-dev \
proj-util \
py3-pip \
py3-setuptools \
python3-dev \
qhull-dev \
sfcgal-dev \
snappy-dev \
sqlite-dev \
swig \
tiledb-dev \
tiff-dev \
unixodbc-dev \
xerces-c-dev \
xz-dev \
zlib-dev \
zstd-dev

# Commenting out those packages to be sure to test numpy 2.0.0rc1
# py3-numpy \
# py3-numpy-dev \
# py3-pyarrow \
# py3-pyarrow-pyc \

COPY requirements.txt /tmp/
RUN python3 -m pip install --break-system-packages numpy==2.0.0rc1
RUN python3 -m pip install --break-system-packages -U -r /tmp/requirements.txt

36 changes: 36 additions & 0 deletions .github/workflows/alpine_numpy2/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

set -e

cat << EOF > /tmp/foo.cpp
#include <cstdio>
extern "C" void DeclareDeferredFOO(void);
void DeclareDeferredFOO()
{
FILE* f = fopen("/tmp/DeclareDeferredFOO_has_been_run.bin", "wb");
if (f)
fclose(f);
}
EOF

cmake ${GDAL_SOURCE_DIR:=..} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_UNITY_BUILD=ON \
-DUSE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DIconv_INCLUDE_DIR=/usr/include/gnu-libiconv \
-DIconv_LIBRARY=/usr/lib/libiconv.so \
-DADD_EXTERNAL_DEFERRED_PLUGIN_FOO=/tmp/foo.cpp \
-DCMAKE_C_FLAGS=-Werror -DCMAKE_CXX_FLAGS="-std=c++23 -Werror" -DWERROR_DEV_FLAG="-Werror=dev"
make -j$(nproc)
make -j$(nproc) install DESTDIR=/tmp/install-gdal

# To check if DeclareDeferredFOO() is called by GDALAllRegister()
apps/gdalinfo --version

if test -f /tmp/DeclareDeferredFOO_has_been_run.bin; then
echo "DeclareDeferredFOO() has been run"
else
echo "DeclareDeferredFOO() has NOT been run"
exit 1
fi
6 changes: 6 additions & 0 deletions .github/workflows/linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ jobs:
build_script: build.sh
os: ubuntu-22.04

- name: Alpine, numpy 2
id: alpine_numpy2
container: alpine_numpy2
build_script: build.sh
os: ubuntu-22.04

- name: Alpine, gcc 32-bit
id: alpine_32bit
container: alpine_32bit
Expand Down

0 comments on commit dcd1f2c

Please sign in to comment.