.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main, develop ]

permissions:
  contents: read

jobs:
  test:
    name: Ruby specs
    runs-on: ubuntu-latest

    env:
      RAILS_ENV: test

    services:
      db:
        image: postgis/postgis:16-3.4-alpine
        ports: ['5432:5432']
        env:
          POSTGRES_PASSWORD: postgres

        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

      redis:
        image: redis
        ports: ['6379:6379']
        options: --entrypoint redis-server

    steps:
      - name: Install GEOS
        run: |
          sudo apt-get update
          sudo apt-get -yq --no-install-suggests --no-install-recommends install libgeos-dev
      - name: Set up Actions
        uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.3.5'
          bundler-cache: true
      - uses: pnpm/action-setup@v4
      - name: Set up Node
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'pnpm'
      - name: Install node dependencies
        run: pnpm install
      - name: Set up Database
        run: bundle exec rails db:prepare
      - name: Force reinstall of RGeo with native extensions # Ref: diowa/icare#1783
        run: |
          bundle show rgeo
          rm -rf `bundle show rgeo`
          bundle
      - name: Check GEOS support
        run: bundle exec rails rgeo_supports_geos
      - name: Run specs
        run: bundle exec rake spec
      - name: Coveralls
        uses: coverallsapp/github-action@v2
        with:
          github-token: ${{ secrets.github_token }}
          path-to-lcov: 'coverage/lcov.info'