Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build/CI updates for newer gdal version #141

Merged
merged 12 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
_, 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 @@
_, 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 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 Expand Up @@ -3848,7 +3851,7 @@

func (dl *debugLogger) L(ec ErrorCategory, code int, msg string) error {
if ec >= CE_Warning {
return fmt.Errorf(msg)

Check failure on line 3854 in godal_test.go

View workflow job for this annotation

GitHub Actions / Go 1.23 + GDAL release/3.10 test

printf: non-constant format string in call to fmt.Errorf (govet)
}
if ec == CE_Debug {
dl.logs += ",GOTESTDEBUG:" + msg
Expand Down Expand Up @@ -4486,7 +4489,7 @@
defer func() { _ = VSIUnlink(fname) }()
defer gridDs.Close()
originalColors := make([]byte, outXSize*outYSize)
gridDs.Read(0, 0, originalColors, outXSize, outYSize)

Check failure on line 4492 in godal_test.go

View workflow job for this annotation

GitHub Actions / Go 1.23 + GDAL release/3.10 test

Error return value of `gridDs.Read` is not checked (errcheck)

// 2. Put the Dataset generated above, through the `Nearblack` function, to set pixels near BLACK to BLACK
argsNbString := "-near 10 -nb 0"
Expand All @@ -4499,7 +4502,7 @@
defer func() { _ = VSIUnlink(fname2) }()
defer nbDs.Close()
nearblackColors := make([]byte, outXSize*outYSize)
nbDs.Read(0, 0, nearblackColors, outXSize, outYSize)

Check failure on line 4505 in godal_test.go

View workflow job for this annotation

GitHub Actions / Go 1.23 + GDAL release/3.10 test

Error return value of `nbDs.Read` is not checked (errcheck)

// 3. Test on all rows that pixels where abs(0 - pixelValue) <= 10, are set to black (0)
for i := 0; i < outYSize; i++ {
Expand Down Expand Up @@ -4558,7 +4561,7 @@
defer func() { _ = VSIUnlink(fname) }()
defer gridDs.Close()
originalColors := make([]byte, outXSize*outYSize)
gridDs.Read(0, 0, originalColors, outXSize, outYSize)

Check failure on line 4564 in godal_test.go

View workflow job for this annotation

GitHub Actions / Go 1.23 + GDAL release/3.10 test

Error return value of `gridDs.Read` is not checked (errcheck)

// 2. Put the Dataset generated above, through the `Nearblack` function, to set pixels near WHITE to WHITE
argsNbString := "-near 10 -nb 0 -white"
Expand All @@ -4571,7 +4574,7 @@
defer func() { _ = VSIUnlink(fname2) }()
defer nbDs.Close()
nearblackColors := make([]byte, outXSize*outYSize)
nbDs.Read(0, 0, nearblackColors, outXSize, outYSize)

Check failure on line 4577 in godal_test.go

View workflow job for this annotation

GitHub Actions / Go 1.23 + GDAL release/3.10 test

Error return value of `nbDs.Read` is not checked (errcheck)

// 3. Test on all rows that pixels where abs(255 - pixelValue) <= 10, are set to white (255)
for i := 0; i < outYSize; i++ {
Expand Down Expand Up @@ -4657,7 +4660,7 @@
defer func() { _ = VSIUnlink(fname) }()
defer gridDs.Close()
originalColors := make([]byte, outXSize*outYSize)
gridDs.Read(0, 0, originalColors, outXSize, outYSize)

Check failure on line 4663 in godal_test.go

View workflow job for this annotation

GitHub Actions / Go 1.23 + GDAL release/3.10 test

Error return value of `gridDs.Read` is not checked (errcheck)

// 2. Put the Dataset generated above, through the `Nearblack` function, to set pixels near BLACK to BLACK
nbDs, err := Create(Memory, "nbDs", 1, Byte, outXSize, outYSize)
Expand All @@ -4673,7 +4676,7 @@
return
}
nearblackColors := make([]byte, outXSize*outYSize)
nbDs.Read(0, 0, nearblackColors, outXSize, outYSize)

Check failure on line 4679 in godal_test.go

View workflow job for this annotation

GitHub Actions / Go 1.23 + GDAL release/3.10 test

Error return value of `nbDs.Read` is not checked (errcheck)

// 3. Test on all rows that pixels where abs(0 - pixelValue) <= 10, are set to black (0)
for i := 0; i < outYSize; i++ {
Expand Down Expand Up @@ -5085,7 +5088,7 @@
return
}
}
gridDs.SetProjection("epsg:32632")

Check failure on line 5091 in godal_test.go

View workflow job for this annotation

GitHub Actions / Go 1.23 + GDAL release/3.10 test

Error return value of `gridDs.SetProjection` is not checked (errcheck)
defer func() { _ = VSIUnlink(fname) }()
defer gridDs.Close()

Expand Down Expand Up @@ -5220,7 +5223,7 @@
return
}
}
gridDs.SetProjection("epsg:32632")

Check failure on line 5226 in godal_test.go

View workflow job for this annotation

GitHub Actions / Go 1.23 + GDAL release/3.10 test

Error return value of `gridDs.SetProjection` is not checked (errcheck)
defer func() { _ = VSIUnlink(fname) }()
defer gridDs.Close()

Expand Down
Loading