Casecommons/pg_search

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: build

on:
  push:
    branches:
      - master
      - github-actions
  pull_request:
    branches:
      - master
  schedule:
    - cron: "0 18 * * 6" # Saturdays at 12pm CST
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:latest
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          - 5432:5432
    env:
      CI: true
      PGHOST: 127.0.0.1
      PGUSER: postgres
      PGPASS: postgres
    strategy:
      fail-fast: false
      matrix:
        ruby-version: ['3.0', '3.1', '3.2', '3.3']
        active-record-version-env:
          - ACTIVE_RECORD_VERSION="~> 6.1.0"
          - ACTIVE_RECORD_VERSION="~> 7.0.0"
          - ACTIVE_RECORD_VERSION="~> 7.1.0"
          - ACTIVE_RECORD_VERSION="~> 7.2.0"
        allow-failure: [false]
        exclude:
          - ruby-version: '3.0'
            active-record-version-env: ACTIVE_RECORD_VERSION="~> 7.2.0"
        include:
          - ruby-version: '3.3'
            active-record-version-env: ACTIVE_RECORD_BRANCH="main"
            allow-failure: true
          - ruby-version: '3.3'
            active-record-version-env: ACTIVE_RECORD_BRANCH="7-2-stable"
            allow-failure: true
          - ruby-version: '3.3'
            active-record-version-env: ACTIVE_RECORD_BRANCH="7-1-stable"
            allow-failure: true
          - ruby-version: '3.3'
            active-record-version-env: ACTIVE_RECORD_BRANCH="7-0-stable"
            allow-failure: true
          - ruby-version: '3.3'
            active-record-version-env: ACTIVE_RECORD_BRANCH="6-1-stable"
            allow-failure: true
    continue-on-error: ${{ matrix.allow-failure }}
    steps:
    - uses: actions/checkout@v4
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler-cache: true
    - name: Set up test database
      env:
        PGPASSWORD: postgres
      run: createdb pg_search_test
    - name: Update bundle
      run: ${{ matrix.active-record-version-env }} bundle update
    - name: Run tests
      run: ${{ matrix.active-record-version-env }} bundle exec rake