diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2952dca2..882b32fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,18 @@ on: - cron: "0 18 * * 6" # Saturdays at 12pm CST workflow_dispatch: +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: test: + name: Ruby ${{ matrix.ruby-version }} / Active Record ${{ matrix.active-record.label }} runs-on: ubuntu-latest + timeout-minutes: 20 services: postgres: image: postgres:latest @@ -32,45 +41,47 @@ jobs: CI: true PGHOST: 127.0.0.1 PGUSER: postgres - PGPASS: postgres strategy: fail-fast: false matrix: ruby-version: ["3.3", "3.4", "4.0"] - active-record-version-env: - - ACTIVE_RECORD_VERSION="~> 7.2.0" - - ACTIVE_RECORD_VERSION="~> 8.0.0" - - ACTIVE_RECORD_VERSION="~> 8.1.0" + active-record: + - { label: "7.2", env: "ACTIVE_RECORD_VERSION=~> 7.2.0" } + - { label: "8.0", env: "ACTIVE_RECORD_VERSION=~> 8.0.0" } + - { label: "8.1", env: "ACTIVE_RECORD_VERSION=~> 8.1.0" } allow-failure: [false] include: - - ruby-version: "ruby-head" - active-record-version-env: ACTIVE_RECORD_VERSION="~> 8.1.0" - allow-failure: true - ruby-version: "4.0" - active-record-version-env: ACTIVE_RECORD_BRANCH="main" + active-record: { label: "main", env: "ACTIVE_RECORD_BRANCH=main" } allow-failure: true - ruby-version: "4.0" - active-record-version-env: ACTIVE_RECORD_BRANCH="8-1-stable" + active-record: { label: "8-1-stable", env: "ACTIVE_RECORD_BRANCH=8-1-stable" } allow-failure: true - ruby-version: "4.0" - active-record-version-env: ACTIVE_RECORD_BRANCH="8-0-stable" + active-record: { label: "8-0-stable", env: "ACTIVE_RECORD_BRANCH=8-0-stable" } allow-failure: true - ruby-version: "4.0" - active-record-version-env: ACTIVE_RECORD_BRANCH="7-2-stable" + active-record: { label: "7-2-stable", env: "ACTIVE_RECORD_BRANCH=7-2-stable" } + allow-failure: true + - ruby-version: "ruby-head" + active-record: { label: "8.1", env: "ACTIVE_RECORD_VERSION=~> 8.1.0" } allow-failure: true continue-on-error: ${{ matrix.allow-failure }} steps: - uses: actions/checkout@v6 + - name: Select ActiveRecord version + env: + ACTIVE_RECORD_ENV: ${{ matrix.active-record.env }} + run: echo "$ACTIVE_RECORD_ENV" >> "$GITHUB_ENV" - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true + cache-version: ${{ matrix.active-record.env }} - 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 + run: bundle exec rake