diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..81778be --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,35 @@ +name: Tests +on: [push, pull_request] + +jobs: + tests: + runs-on: ${{ matrix.os }}-latest + strategy: + matrix: + ruby: + - head + - "3.0" + - "2.7" + - "2.6" + - "jruby-9.3.7.0" + os: + - ubuntu + - macos + steps: + - name: Set Up Gems + uses: actions/checkout@v2 + - name: Install Geos (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) + if: matrix.os == 'macos' + run: HOMEBREW_NO_INSTALL_CLEANUP=1 brew install geos + - name: Set Up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Test + run: bundle exec rake diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cebe15a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -cache: bundler -addons: - apt: - packages: - - libgeos-dev -language: ruby -rvm: - - 2.7 - - 2.6 - - 2.5 - - 2.4 - - 2.3 - - jruby-9.2.13.0 diff --git a/Gemfile b/Gemfile index 20c4453..3bc2247 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,5 @@ source "https://rubygems.org" gemspec gem "ffi-geos", ">= 0.0.4" + +gem "rgeo", "~> 3.0.0.pre.rc.3" diff --git a/README.md b/README.md index d8ae556..38ad37a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # rgeo-geojson [![Gem Version](https://badge.fury.io/rb/rgeo-geojson.svg)](http://badge.fury.io/rb/rgeo-geojson) -[![Build Status](https://travis-ci.org/rgeo/rgeo-geojson.svg?branch=master)](https://travis-ci.org/rgeo/rgeo-geojson) +[![CI](https://github.com/rgeo/rgeo-geojson/workflows/CI/badge.svg)](https://github.com/rgeo/rgeo-geojson/actions?query=workflow%3ACI+branch%3Amaster+event%3Apush) `rgeo-geojson` is an extension to [RGeo](https://github.com/rgeo/rgeo) that provides GeoJSON encoding and decoding. diff --git a/test/basic_test.rb b/test/basic_test.rb index da78bf6..8adb2da 100644 --- a/test/basic_test.rb +++ b/test/basic_test.rb @@ -4,7 +4,8 @@ require_relative "../lib/rgeo-geojson" class BasicTest < Minitest::Test # :nodoc: def setup - @geo_factory = RGeo::Cartesian.simple_factory(srid: 4326) + ruby_wkt_opts = { convert_case: :upper } + @geo_factory = RGeo::Cartesian.simple_factory(srid: 4326, wkt_generator: ruby_wkt_opts) @geo_factory_z = RGeo::Cartesian.simple_factory(srid: 4326, has_z_coordinate: true) @geo_factory_m = RGeo::Cartesian.simple_factory(srid: 4326, has_m_coordinate: true) @geo_factory_zm = RGeo::Cartesian.simple_factory(srid: 4326, has_z_coordinate: true, has_m_coordinate: true) @@ -22,13 +23,13 @@ def test_nil def test_decode_simple_point json = %({"type":"Point","coordinates":[1,2]}) - point = RGeo::GeoJSON.decode(json) + point = RGeo::GeoJSON.decode(json, geo_factory: @geo_factory) assert_equal "POINT (1.0 2.0)", point.as_text end def test_decode_point json = '{"type":"Feature","geometry":{"type":"Point","coordinates":[2.5,4.0]},"properties":{"color":"red"}}' - feature = RGeo::GeoJSON.decode(json) + feature = RGeo::GeoJSON.decode(json, geo_factory: @geo_factory) assert_equal "red", feature["color"] assert_equal "POINT (2.5 4.0)", feature.geometry.as_text end @@ -223,10 +224,10 @@ def test_feature_collection @geo_factory.point(10, 20) ] object = @entity_factory.feature_collection([ - @entity_factory.feature(geometries[0]), - @entity_factory.feature(geometries[1]), - @entity_factory.feature(geometries[2], 8) - ]) + @entity_factory.feature(geometries[0]), + @entity_factory.feature(geometries[1]), + @entity_factory.feature(geometries[2], 8) + ]) json = { "type" => "FeatureCollection", "features" => [