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

CI: Test Against Geos Versions #362

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
106e9fc
Test against Geos versions
keithdoggett Aug 24, 2023
057f3cb
fix typo
keithdoggett Aug 24, 2023
12293aa
fix minitest class naming
keithdoggett Aug 24, 2023
5c2f17a
temporarily cut down on build targets
keithdoggett Aug 24, 2023
b277fc4
no sudo on cmake install
keithdoggett Aug 24, 2023
903e10b
update ci
keithdoggett Aug 24, 2023
90284a9
ldconfig after install
keithdoggett Aug 24, 2023
2b6c566
Merge branch 'main' into ci/multiple-geos-versions
keithdoggett Aug 24, 2023
09bb915
add version conditional to test_invalid_polygon_duplicate_rings
keithdoggett Aug 24, 2023
08797ae
fix gem version matching
keithdoggett Aug 24, 2023
b5a5d94
debug
keithdoggett Aug 24, 2023
c771098
move validity tests failing specifically due to geos versions to CAPI…
keithdoggett Aug 24, 2023
60134db
add macos and other ruby versions back to matrix
keithdoggett Aug 24, 2023
832d4bc
ldconfig only on linux
keithdoggett Aug 24, 2023
fae75b4
force reinstall cmake on macos
keithdoggett Aug 24, 2023
78c9947
debug macos build
keithdoggett Aug 24, 2023
2a5d46e
rm debug
keithdoggett Aug 25, 2023
4bb4d96
reinstall cmake
keithdoggett Aug 25, 2023
aab2b28
update brew in macos ci
keithdoggett Aug 28, 2023
e6eaf56
upgrade brew
keithdoggett Aug 28, 2023
fda17d1
upgrade brew
keithdoggett Aug 28, 2023
5863c32
explicitly set GEOS_LIBRARY_PATH on macos jruby builds
keithdoggett Aug 28, 2023
5a15dff
add more debug info
keithdoggett Aug 28, 2023
2f89a31
add yqq flag
keithdoggett Aug 28, 2023
0d2e457
Only test ubuntu against multiple geos versions
keithdoggett Nov 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 46 additions & 14 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,62 @@ jobs:
os:
- ubuntu
# Windows users, feel free to open a PR :)
# See issue #242, windows support would be welcome.
# - windows
- macos
exclude:
- os: windows # See issue #242, windows support would be welcome.
geos:
- '3.12.0'
- '3.11.2'
- '3.10.5'
- '3.9.4'
- '3.8.3'
runs-on: ${{ matrix.os }}-latest
continue-on-error: ${{ matrix.ruby == 'head' || matrix.os == 'windows' || matrix.os == 'macos' }}
name: Ruby ${{ matrix.ruby }} (${{ matrix.os }})
name: Ruby ${{ matrix.ruby }}, Geos ${{ matrix.geos }} (${{ matrix.os }})
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install Geos (Linux)
- name: Install Packages (Linux)
if: matrix.os == 'ubuntu'
run: |
sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get install -yqq libgeos-dev
- name: Install Geos (Mac)
sudo apt-get install curl libcurl4-openssl-dev libssl-dev cmake
keithdoggett marked this conversation as resolved.
Show resolved Hide resolved
- name: Install Packages (Mac)
if: matrix.os == 'macos'
run: HOMEBREW_NO_INSTALL_CLEANUP=1 brew install geos
- name: Install Geos (Windows)
if: matrix.os == 'windows'
run: TODO
run: |
brew update
HOMEBREW_NO_INSTALL_CLEANUP=1 brew install --force cmake
brew upgrade cmake
- uses: actions/cache@v2
id: geos-cache
with:
path: ./geos-${{ matrix.geos }}
key: geos-${{ matrix.geos }}-${{ matrix.os }}
- name: Download and Compile Geos
if: steps.geos-cache.outputs.cache-hit != 'true'
run: |
wget -c https://download.osgeo.org/geos/geos-${{ matrix.geos }}.tar.bz2
tar -xf geos-${{ matrix.geos }}.tar.bz2
cd geos-${{ matrix.geos }}
mkdir build
cd build
cmake ..
cmake --build . -j2
cd ../../
- name: Install Geos
run: |
cd geos-${{ matrix.geos }}/build
sudo cmake --build . --target install
cd ../../
- name: ldconfig
if: matrix.os == 'ubuntu'
run: sudo ldconfig
- name: Set GEOS_LIBRARY_PATH (macos jruby)
if: matrix.os == 'macos' && matrix.ruby == 'jruby'
run: export GEOS_LIBRARY_PATH=/usr/local/lib/libgeos_c.dylib
- uses: ruby/setup-ruby@v1
Copy link
Member

@BuonOmo BuonOmo Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried on my mac, and I didn't need this GEOS_LIBRARY_PATH variable in my path.

$ ruby -v
jruby 9.4.3.0 (3.1.4) 2023-06-07 3086960792 OpenJDK 64-Bit Server VM 20.0.2 on 20.0.2 +jit [arm64-darwin]
$ geos-config --version
3.12.0

Although my geos installation is done through homebrew

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I'll try again I'm pretty stumped as to why this it isn't recognizing Geos. I shouldn't have to specify a path but clearly something's not configured correctly.

with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Bundle Install
run: bundle install
- name: Set Maintainer Mode
Expand Down
1 change: 1 addition & 0 deletions test/common/validity_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def test_invalid_polygon_inconsistent_area

def test_invalid_polygon_duplicate_rings
poly = @factory.polygon(big_square, [little_square, little_square])

assert_equal(RGeo::Error::SELF_INTERSECTION, poly.invalid_reason)
assert_equal(false, poly.valid?)
end
Expand Down
11 changes: 11 additions & 0 deletions test/geos_capi/validity_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,15 @@ def test_invalid_polygon_self_intersecting_ring_invalid_reason_location
assert_equal(RGeo::Error::SELF_INTERSECTION, poly.invalid_reason)
assert_equal(false, poly.valid?)
end

def test_invalid_polygon_duplicate_rings
poly = @factory.polygon(big_square, [little_square, little_square])

if geos_version_match(">= 3.10.0")
assert_equal(RGeo::Error::SELF_INTERSECTION, poly.invalid_reason)
else
assert_equal(RGeo::Error::DUPLICATE_RINGS, poly.invalid_reason)
end
assert_equal(false, poly.valid?)
end
end
2 changes: 1 addition & 1 deletion test/geos_ffi/misc_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ def test_casting_dumb_objects
end
end

puts "WARNING: FFI-GEOS support not available. Related tests skipped." unless RGeo::Geos.ffi_supported?
puts "WARNING: FFI-GEOS support not available. Related tests skipped. Reason: #{RGeo::Geos::FFI_SUPPORT_EXCEPTION}" unless RGeo::Geos.ffi_supported?
11 changes: 11 additions & 0 deletions test/geos_ffi/validity_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,15 @@ class GeosFFIValidityTest < Minitest::Test # :nodoc:
def setup
@factory = RGeo::Geos.factory(native_interface: :ffi)
end

def test_invalid_polygon_duplicate_rings
poly = @factory.polygon(big_square, [little_square, little_square])

if geos_version_match(">= 3.10.0")
assert_equal(RGeo::Error::SELF_INTERSECTION, poly.invalid_reason)
else
assert_equal(RGeo::Error::DUPLICATE_RINGS, poly.invalid_reason)
end
assert_equal(false, poly.valid?)
end
end
11 changes: 11 additions & 0 deletions test/simple_mercator/validity_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ def setup
@factory = RGeo::Geographic.simple_mercator_factory
end

def test_invalid_polygon_duplicate_rings
poly = @factory.polygon(big_square, [little_square, little_square])

if geos_version_match(">= 3.10.0")
assert_equal(RGeo::Error::SELF_INTERSECTION, poly.invalid_reason)
else
assert_equal(RGeo::Error::DUPLICATE_RINGS, poly.invalid_reason)
end
assert_equal(false, poly.valid?)
end

# Taken from RGeo::Tests::Common::ValidityTests, but adapted to have a
# correct area.
def square_polygon_expected_area
Expand Down