name: CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby-version: ['2.6', '2.7']

    services:
      postgres:
        image: postgis/postgis
        ports:
          - 5432:5432
        env:
          POSTGRES_DB: spatial_features_test
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    steps:
    - uses: actions/checkout@v2

    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler-cache: true # runs 'bundle install' and caches installed gems automatically

    - name: Install GEOS
      run: sudo apt-get install libgeos-dev libgeos-3.8.0 libproj-dev -y

    - name: Run tests
      env:
        RAILS_ENV: test
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: postgres
      run: bundle exec rake spec
      continue-on-error: true

name: CI

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby-version: ["2.6", "2.7"]
      fail-fast: false

    services:
      postgres:
        image: postgis/postgis
        ports:
          - 5432:5432
        env:
          POSTGRES_DB: spatial_features_test
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    steps:
      - uses: actions/checkout@v2

      # libgeos and gdal are required and must be installed before `bunddle install`
      # NB: if you add libs here that are required for Gem native extensions be sure to clear the
      # bundle cache in `ruby/setup-ruby` so that the gems are re-compiled
      - name: Install GEOS
        run: |
          sudo add-apt-repository ppa:ubuntugis/ppa
          sudo apt-get update
          sudo apt-get install libpq-dev libgeos-dev libgeos-3.8.0 libproj-dev gdal-bin -y

      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
          cache-version: 3

      - name: Run tests
        env:
          RAILS_ENV: test
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        run: bundle exec rspec

Update CI to surface errors properly and fix gdal/geos installation
Update CI to surface errors properly and fix gdal/geos installation
