Skip to content

Commit

Permalink
Add a CI setup for the bundled builds
Browse files Browse the repository at this point in the history
  • Loading branch information
weiznich committed Apr 2, 2024
1 parent 14ad7fe commit 22ea5d6
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 31 deletions.
49 changes: 43 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ jobs:
- name: Check with Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Check with Clippy (--all-features)
run: cargo clippy --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets --features "default bindgen array" -- -D warnings
- name: Build
run: cargo build
- name: Run tests
run: cargo test
- name: Build (--all-features)
run: cargo build --all-features
run: cargo build --features "default bindgen array"
- name: Run tests (--all-features)
run: cargo test --all-features -- --nocapture
run: cargo test --features "default bindgen array" -- --nocapture

ubuntu_lts:
name: "ci ubuntu-lts"
Expand Down Expand Up @@ -104,18 +104,55 @@ jobs:
- name: Check with Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Check with Clippy (--all-features)
run: cargo clippy --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets --features "default bindgen array" -- -D warnings
- name: Build
run: cargo build
- name: Run tests
run: cargo test
- name: Build (--all-features)
run: cargo build --all-features
run: cargo build --features "default bindgen array"
- name: Run tests (--all-features)
run: cargo test --all-features -- --nocapture
run: cargo test --features "default bindgen array" -- --nocapture
- name: Install valgrind and cargo-valgrind
run: |
sudo apt-get install valgrind -y
cargo install cargo-valgrind
- name: Run --lib tests under valgrind
run: cargo valgrind test --lib
gdal_static:
name: "ci gdal-static"
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest # x86_64
- macos-14 # aarch64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
run: |
rustup install --no-self-update --profile minimal stable
rustup component add rustfmt clippy
# we need to have the sqlite binary in path for building proj from source
- name: Install Sqlite (Windows)
if: runner.os == 'Windows'
run: |
choco install sqlite
echo "C:\ProgramData\chocolatey\lib\SQLite\tools" >> $GITHUB_PATH
sqlite3 --version
# use the minimal driver set for clippy as the other
# drivers do not change the rust code
# enable `DRIVER_SQLITE` to force statically linking libsqlite3 for proj
- name: Check with Clippy (bundled)
run: cargo clippy --all-targets --features "gdal-sys/bundled gdal-src gdal-src/DRIVER_SQLITE" -- -D warnings
# we only build tests here as we have disabled features
# that are required for running tests
- name: Test bundled (minimal features)
run: cargo test --features "gdal-sys/bundled gdal-src" --no-run
- name: Test bundled (all features)
run: cargo test --features "gdal-sys/bundled gdal-src gdal-src/enable_all_drivers gdal-src/geos_static"
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ thiserror = "1.0"
libc = "0.2"
geo-types = { version = "0.7.11" }
gdal-sys = { path = "gdal-sys", version = "^0.9" }
gdal-src = { path = "gdal-src", optional = true, default-features = false }
ndarray = { version = "0.15", optional = true }
chrono = { version = "0.4.26", default-features = false }
bitflags = "2.4"
Expand All @@ -48,3 +49,4 @@ rustdoc-args = ["--cfg", "docsrs"]

[patch.crates-io]
proj-sys = { git = "https://github.com/GiGainfosystems/proj", rev = "44a503869709ea793a5f8452bfb9e2a99b7160fc" }
pq-src = { git = "https://github.com/sgrif/pq-sys", rev = "7300e96574cc0eeb95985881fbbc2cf95886cca2" }
10 changes: 6 additions & 4 deletions gdal-src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ netcdf-src = { version = "0.3.2", optional = true }
pq-src = { version = "0.1.1", optional = true }
curl-sys = { version = "0.4.70", features = ["static-curl"], optional = true }
libz-sys = { version = "1.1.15", features = ["static"], optional = true }
geos-src = { version = "0.2.1", optional = true }
geos-sys = { version = "2", optional = true }
geos-sys = { version = "2.0.6", optional = true }
# we need to depend directly on `geos-src` for the static
# build as otherwise `DEP_GEOSSRC_ROOT` is not set
geos-src = { version = "0.2.3", optional = true }


[build-dependencies]
Expand Down Expand Up @@ -51,7 +53,7 @@ enable_all_drivers = [
# that you statically link libgeos and
# therefore makes your binary fall under
# LGPL as well
geos_static = ["geos-src", "geos"]
geos_static = ["geos", "geos-sys/static", "geos-src"]
# as long as the `geos_static` feature
# is not enabled that will only
# dynamically link geos
Expand Down Expand Up @@ -315,7 +317,7 @@ DRIVER_NETCDF = ["dep:netcdf-src", "DRIVER_HDF5", "dep:hdf5-sys"]
#DRIVER_PDF = []

# combined
# these miss at least one dependency
# these are missing at least one dependency
# DRIVER_MVT = [] # requires sqlite + geos
# DRIVER_OSM = [] # requires sqlite + libexpat
# DRIVER_ZARR = [] # requires liblz4, libxz, libzstd and libblocs
Expand Down
7 changes: 4 additions & 3 deletions gdal-src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ fn main() {
format!("{}/include", proj_root.display()),
)
.define("PROJ_LIBRARY", proj_library)
.pic(true)
.define("ACCEPT_MISSING_LINUX_FS_HEADER", "ON");
// enable the gpkg driver

Expand Down Expand Up @@ -226,7 +225,7 @@ fn main() {
let hdf5_dir = std::env::var("DEP_HDF5SRC_ROOT").expect("This is set by hdf5-src");
let hl_library = std::env::var("DEP_HDF5SRC_HL_LIBRARY").expect("This is set by hdf5-src");
let netcdf_lib = find_library("netcdf", &netcdf_root_dir);
let hl_library_path = find_library(&hl_library, &hdf5_dir);
let hl_library_path = find_library(&hl_library, hdf5_dir);
let hl_library_path = std::path::PathBuf::from(hl_library_path);
let hl_library_path = hl_library_path.parent().unwrap();

Expand Down Expand Up @@ -308,7 +307,9 @@ fn main() {

if cfg!(feature = "geos_static") {
let geos_root = std::env::var("DEP_GEOSSRC_ROOT").expect("this is set by geos-src");
config.define("GEOS_INCLUDE", format!("{geos_root}/include"));
config.define("GEOS_INCLUDE_DIR", format!("{geos_root}/include"));
let lib_path = find_library("geos", geos_root);
config.define("GEOS_LIBRARY", lib_path);
}

if cfg!(target_env = "msvc") {
Expand Down
2 changes: 1 addition & 1 deletion gdal-src/source
Submodule source updated 81 files
+0 −22 .github/workflows/code_checks.yml
+1 −1 .github/workflows/fedora_rawhide/Dockerfile.ci
+2 −2 CITATION.cff
+14 −11 HOWTO-RELEASE
+129 −1 NEWS.md
+1 −1 VERSION
+6 −0 apps/gdalinfo_lib.cpp
+19 −8 apps/gdalwarp_lib.cpp
+11 −1 apps/ogr2ogr_lib.cpp
+134 −0 autotest/cpp/test_cpl.cpp
+5 −0 autotest/cpp/test_ogr.cpp
+12 −2 autotest/gcore/bmp_read.py
+ autotest/gcore/data/bmp/huge_header.bmp.bin
+9 −0 autotest/gcore/data/bmp/huge_sparse.xml
+334 −75 autotest/gdrivers/eedai.py
+19 −0 autotest/gdrivers/pdf.py
+7 −1 autotest/gdrivers/wms.py
+17 −0 autotest/ogr/data/kml/gx_track_without_when.kml
+2 −2 autotest/ogr/ogr_csv.py
+26 −0 autotest/ogr/ogr_factory.py
+18 −0 autotest/ogr/ogr_libkml.py
+5 −0 autotest/ogr/ogr_mysql.py
+30 −0 autotest/utilities/test_gdalwarp_lib.py
+4 −1 cmake/helpers/configure.cmake
+8 −4 cmake/modules/packages/FindECW.cmake
+6 −0 cmake/modules/packages/FindSQLite3.cmake
+9 −0 cmake/template/cpl_config.h.in
+5 −4 docker/ubuntu-full/Dockerfile
+16 −14 frmts/bmp/bmpdataset.cpp
+4 −0 frmts/eeda/eedacommon.cpp
+1 −1 frmts/exr/exrdataset.cpp
+15 −5 frmts/grib/degrib/degrib/clock.c
+3 −2 frmts/netcdf/netcdfdataset.cpp
+8 −2 frmts/pcidsk/sdk/core/pcidsk_utils.cpp
+15 −3 frmts/pdf/pdfdataset.cpp
+2 −1 frmts/pdf/pdfreadvectors.cpp
+2 −16 frmts/pds/pds4dataset.h
+10 −0 frmts/pds/pds4vector.cpp
+1 −1 frmts/plmosaic/plmosaicdataset.cpp
+23 −4 frmts/vrt/vrtpansharpened.cpp
+2 −2 frmts/wms/gdalwmscache.cpp
+1 −1 frmts/wmts/wmtsdataset.cpp
+3 −3 gcore/gdal_version.h.in
+24 −26 gcore/gdaloverviewdataset.cpp
+7 −4 ogr/ogrgeometryfactory.cpp
+32 −2 ogr/ogrsf_frmts/arrow_common/ograrrowlayer.hpp
+9 −1 ogr/ogrsf_frmts/cad/libopencad/cadheader.cpp
+2 −3 ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp
+2 −0 ogr/ogrsf_frmts/georss/ogr_georss.h
+11 −10 ogr/ogrsf_frmts/georss/ogrgeorssdatasource.cpp
+8 −7 ogr/ogrsf_frmts/georss/ogrgeorsslayer.cpp
+1 −1 ogr/ogrsf_frmts/gmlas/ogrgmlasschemaanalyzer.cpp
+5 −5 ogr/ogrsf_frmts/gpkg/ogrgeopackagedatasource.cpp
+2 −0 ogr/ogrsf_frmts/gpx/ogr_gpx.h
+9 −8 ogr/ogrsf_frmts/gpx/ogrgpxdatasource.cpp
+11 −11 ogr/ogrsf_frmts/gpx/ogrgpxlayer.cpp
+11 −8 ogr/ogrsf_frmts/jml/ogrjmllayer.cpp
+18 −14 ogr/ogrsf_frmts/kml/kml.cpp
+24 −17 ogr/ogrsf_frmts/libkml/ogrlibkmlfield.cpp
+2 −1 ogr/ogrsf_frmts/lvbag/ogr_lvbag.h
+3 −6 ogr/ogrsf_frmts/lvbag/ogrlvbaglayer.cpp
+2 −0 ogr/ogrsf_frmts/mssqlspatial/ogr_mssqlspatial.h
+41 −6 ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialdatasource.cpp
+33 −15 ogr/ogrsf_frmts/mysql/ogrmysqltablelayer.cpp
+10 −8 ogr/ogrsf_frmts/ods/ogrodsdatasource.cpp
+25 −9 ogr/ogrsf_frmts/sqlite/ogrsqliteexecutesql.cpp
+11 −0 ogr/ogrsf_frmts/sqlite/ogrsqlitevirtualogr.cpp
+2 −0 ogr/ogrsf_frmts/svg/ogr_svg.h
+8 −8 ogr/ogrsf_frmts/svg/ogrsvgdatasource.cpp
+9 −8 ogr/ogrsf_frmts/svg/ogrsvglayer.cpp
+22 −19 ogr/ogrsf_frmts/xlsx/ogrxlsxdatasource.cpp
+14 −0 port/cpl_strtod.cpp
+33 −15 port/cpl_vsil_curl.cpp
+4 −3 port/cpl_vsil_curl_class.h
+1 −1 port/cpl_vsil_sparsefile.cpp
+22 −5 port/cpl_vsisimple.cpp
+0 −113 scripts/clang-format.sh
+2 −2 scripts/install_bash_completions.cmake.in
+0 −13 swig/python/CMakeLists.txt
+1 −1 swig/python/README.rst
+1 −1 swig/python/gdal-utils/osgeo_utils/__init__.py
4 changes: 2 additions & 2 deletions src/programs/raster/mdimtranslate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ mod tests {
use crate::{DriverManager, GdalOpenFlags};

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
fn test_build_tiff_from_path() {
let fixture = "/vsizip/fixtures/cf_nasa_4326.zarr.zip";

Expand Down Expand Up @@ -263,7 +263,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
fn test_build_tiff_from_dataset() {
let fixture = "/vsizip/fixtures/cf_nasa_4326.zarr.zip";

Expand Down
28 changes: 14 additions & 14 deletions src/raster/mdarray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ mod tests {
use crate::{test_utils::TempFixture, Dataset, GdalOpenFlags};

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_root_group_name() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand All @@ -866,7 +866,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_array_names() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand All @@ -888,7 +888,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_n_dimension() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand All @@ -909,7 +909,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_n_elements() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand All @@ -930,7 +930,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_dimension_name() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand Down Expand Up @@ -966,7 +966,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_dimension_size() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand All @@ -991,7 +991,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_read_data() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand Down Expand Up @@ -1028,7 +1028,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_1), major_ge_4))]
fn test_read_string_array() {
// Beware https://github.com/georust/gdal/issues/299 if you want to reuse this
Expand Down Expand Up @@ -1062,7 +1062,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_datatype() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand All @@ -1089,7 +1089,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_spatial_ref() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand All @@ -1115,7 +1115,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_no_data_value() {
let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip";
Expand All @@ -1137,7 +1137,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_attributes() {
let fixture = "/vsizip/fixtures/cf_nasa_4326.zarr.zip";
Expand Down Expand Up @@ -1189,7 +1189,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_unit() {
let fixture = "/vsizip/fixtures/cf_nasa_4326.zarr.zip";
Expand Down Expand Up @@ -1230,7 +1230,7 @@ mod tests {
}

#[test]
#[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)]
#[cfg_attr(any(not(all(major_ge_3, minor_ge_4)), feature = "gdal-src"), ignore)]
#[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))]
fn test_stats() {
// make a copy to avoid writing the statistics into the original file
Expand Down
3 changes: 2 additions & 1 deletion src/vector/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ mod tests {
fn test_layer_try_get_extent() {
let ds = Dataset::open(fixture("roads.geojson")).unwrap();
let layer = ds.layer(0).unwrap();
assert!(layer.try_get_extent().unwrap().is_none());
assert!(cfg!(feature = "gdal-src") || layer.try_get_extent().unwrap().is_none());
}

#[test]
Expand All @@ -839,6 +839,7 @@ mod tests {

assert!(!layer.has_capability(OLCFastSpatialFilter));
assert!(layer.has_capability(OLCFastFeatureCount));
#[cfg(not(feature = "gdal-src"))]
assert!(!layer.has_capability(OLCFastGetExtent));
assert!(layer.has_capability(OLCRandomRead));
assert!(layer.has_capability(OLCStringsAsUTF8));
Expand Down
1 change: 1 addition & 0 deletions src/vector/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ mod tests {
}

#[test]
#[cfg_attr(feature = "gdal-src", ignore)]
fn test_sql_with_dialect() {
let query = "SELECT * FROM roads WHERE highway = 'pedestrian' and NumPoints(GEOMETRY) = 3";
let ds = Dataset::open(fixture("roads.geojson")).unwrap();
Expand Down

0 comments on commit 22ea5d6

Please sign in to comment.