GitHub Actions中RGeo项目无法启用Geos CAPI,求可行配置方案
GitHub Actions中RGeo无法启用GEOS CAPI支持,求可行配置方案
我维护的一个使用RGeo的Rails项目,在GitHub Actions上始终没法配置出正确环境,导致RGeo::Geos.capi_supported?返回false,而非预期的true。有没有人成功配置过类似环境?
项目依赖
Gemfile包含:
... gem 'rgeo-geojson' ...
当前GitHub Actions配置(.github/workflows/backend_test.yml)
name: Backend Test on: [push] jobs: test: runs-on: ubuntu-latest defaults: run: working-directory: . services: postgres: image: geographica/postgis:dev_diplodocus ports: - 5432:5432 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: test options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 env: RAILS_ENV: test RAILS_DATABASE_HOST: 127.0.0.1 RAILS_DATABASE_USER: postgres RAILS_DATABASE_PASSWORD: postgres steps: - uses: actions/checkout@v3 - name: Install Geos (Linux) run: | sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable sudo apt-get install libgeos-dev -y - name: Install postgis run: sudo apt-get install postgis -y - name: Install Proj run: sudo apt-get install libproj-dev -y - uses: ruby/setup-ruby@v1 with: ruby-version: 2.7.4 bundler-cache: true working-directory: . - name: Manually install RGeo run: gem install rgeo - name: Migration run: | cp config/database.example.yml config/database.yml bundle exec rails db:create bundle exec rake db:schema:load - name: Run rspec run: bundle exec rspec
已尝试的调整
我调整过步骤顺序,在数据库迁移后重新安装RGeo:
- name: Migration run: | cp config/database.example.yml config/database.yml bundle exec rails db:create bundle exec rake db:schema:load - name: Manually reinstall RGeo run: gem uninstall rgeo && gem install rgeo
期望与实际结果
- 期望结果:
RGeo::Geos.capi_supported? == true - 实际结果:
RGeo::Geos.capi_supported? == false
内容的提问来源于stack exchange,提问作者jnicho02
相关产品推荐
相关产品推荐

