Skip to content

Commit

Permalink
Build/CI updates for newer gdal version (#141)
Browse files Browse the repository at this point in the history
account for the fact that all drivers can now be disabled at gdal compile time
  • Loading branch information
tbonfort authored Jan 7, 2025
1 parent fbabeff commit 3ca5b20
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 19 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build-gdal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ if [ -f CMakeLists.txt ]; then
-DGDAL_USE_GEOS=ON \
-DBUILD_JAVA_BINDINGS=OFF \
-DBUILD_CSHARP_BINDINGS=OFF \
-DGDAL_ENABLE_DRIVER_GTIFF=ON \
-DGDAL_ENABLE_DRIVER_VRT=ON \
-DGDAL_ENABLE_DRIVER_MEM=ON \
-DOGR_ENABLE_DRIVER_MEM=ON \
-DOGR_ENABLE_DRIVER_GEOJSON=ON \
-DOGR_ENABLE_DRIVER_TAB=ON \
-DOGR_ENABLE_DRIVER_VRT=ON \
-DOGR_ENABLE_DRIVER_SHAPE=ON \
-DOGR_ENABLE_DRIVER_SQLITE=ON

make -j8
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
fail-fast: false
matrix:
gdal: [ 'release/3.6', 'release/3.7', 'release/3.8', 'release/3.9', 'master' ]
gdal: ['release/3.7', 'release/3.8', 'release/3.9', 'release/3.10', 'master' ]
steps:
- name: optgdal
run: sudo mkdir /optgdal && sudo chown -R $USER /optgdal
Expand All @@ -55,7 +55,7 @@ jobs:
fail-fast: false
matrix:
go: [ '1.22', '1.23' ]
gdal: [ 'release/3.6', 'release/3.7', 'release/3.8', 'release/3.9', 'master' ]
gdal: [ 'release/3.7', 'release/3.8', 'release/3.9', 'release/3.10', 'master' ]
name: Go ${{ matrix.go }} + GDAL ${{ matrix.gdal }} test
steps:
- name: APT
Expand Down Expand Up @@ -89,16 +89,25 @@ jobs:
env:
PKG_CONFIG_PATH: /optgdal/lib/pkgconfig/
- name: Send coverage
if: ${{ matrix.go == '1.23' && matrix.gdal == 'release/3.9' }}
if: ${{ matrix.go == '1.23' && matrix.gdal == 'release/3.10' }}
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
- name: staticcheck
if: ${{ matrix.go == '1.23' && matrix.gdal == 'release/3.10' }}
uses: reviewdog/action-staticcheck@v1
env:
PKG_CONFIG_PATH: /optgdal/lib/pkgconfig/
with:
level: error
fail_on_error: true
- name: golangci-lint
if: ${{ matrix.go == '1.23' && matrix.gdal == 'release/3.9' }}
uses: reviewdog/action-golangci-lint@v1
if: ${{ matrix.go == '1.23' && matrix.gdal == 'release/3.10' }}
uses: reviewdog/action-golangci-lint@v2
env:
PKG_CONFIG_PATH: /optgdal/lib/pkgconfig/
with:
golangci_lint_flags: "--timeout=5m --skip-files=doc_test.go"
level: error
fail_on_error: true
cache: false
fail_level: error
4 changes: 0 additions & 4 deletions godal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1301,10 +1301,6 @@ func RegisterRaster(drivers ...DriverName) error {
C.GDALRegister_MEM()
case VRT:
C.GDALRegister_VRT()
case HFA:
C.GDALRegister_HFA()
case GTiff:
C.GDALRegister_GTiff()
default:
fnname := fmt.Sprintf("GDALRegister_%s", driver)
drv, ok := driverMappings[driver]
Expand Down
21 changes: 12 additions & 9 deletions godal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,18 @@ func TestRegisterDrivers(t *testing.T) {
_, err := Open("testdata/test.img")
assert.Error(t, err)

_ = RegisterRaster(HFA)
_, ok = RasterDriver(HFA)
assert.True(t, ok)
hfa_err := RegisterRaster(HFA)
if hfa_err == nil { //HFA is not available by default with gdal >= 3.10
_, ok = RasterDriver(HFA)
assert.True(t, ok)

ds, err := Open("testdata/test.img")
assert.NoError(t, err)
ds.Close()
} else {
_, ok = RasterDriver(HFA)
assert.False(t, ok)
}
_, ok = VectorDriver(HFA)
assert.False(t, ok)

Expand All @@ -264,10 +272,6 @@ func TestRegisterDrivers(t *testing.T) {
_, ok = RasterDriver(GeoJSON)
assert.False(t, ok)

ds, err := Open("testdata/test.img")
assert.NoError(t, err)
ds.Close()

_, ok = RasterDriver("bazbaz")
assert.False(t, ok)

Expand Down Expand Up @@ -1233,8 +1237,7 @@ func TestBandMask(t *testing.T) {
}

func TestSetNoData(t *testing.T) {
_ = RegisterRaster("HFA")
ds, _ := Open("testdata/test.img")
ds, _ := Open("testdata/test.tif")
err := ds.SetNoData(0.5)
if err == nil {
t.Error("err not raised")
Expand Down

0 comments on commit 3ca5b20

Please sign in to comment.