From f9802be50e1420a04f17b61b23f280653f7dfb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Thu, 20 Aug 2026 15:33:38 -0600 Subject: [PATCH] [OMBU-821] Run CI as a dual-boot matrix and bump Postgres to 18.3 The two nearly identical jobs differed only in BUNDLE_GEMFILE, so collapse them into one matrix over [Gemfile, Gemfile.next] with fail-fast disabled, matching skunk.fyi's workflow. Postgres goes from 11.6 to 18.3 to match production, which was upgraded from 15.17 to 18.3 today. Other changes that come with following skunk.fyi: - checkout@v1 -> checkout@v4 - ruby-version: "4.0.6" -> ruby-version-file: .tool-versions, so the version lives in one place - bundler-cache: true instead of hand-rolled `gem install bundler` + `bundle install`. It resolves against BUNDLE_GEMFILE and caches each boot separately. The next job's `bundle update rails` is dropped: both lockfiles are committed and satisfied, so there is nothing to resolve at CI time - drop `bin/setup`, which re-runs bundler, db:prepare, log:clear and restart on top of the db:setup that follows it - drop `cat config/database.yml`, a debugging leftover - hoist the shared env block to job level - add timeout-minutes: 20 No Lint step, unlike skunk.fyi: rubocop is in neither lockfile here. Also ignore .worktrees/, used for local git worktrees. --- .github/workflows/tests.yml | 105 +++++++++++++----------------------- 1 file changed, 36 insertions(+), 69 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ebd9a2a..f30d443 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,6 +1,5 @@ -# .github/workflows/ci.yml - name: CI + on: push: branches: @@ -10,87 +9,55 @@ on: - main jobs: - test-rails-current: + test: + name: test (${{ matrix.gemfile }}) runs-on: ubuntu-latest + timeout-minutes: 20 + + strategy: + fail-fast: false + matrix: + gemfile: [ Gemfile, Gemfile.next ] services: postgres: - image: postgres:11.6-alpine - ports: - - 5432:5432 + # Matches the production Postgres version. + image: postgres:18.3-alpine env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - - steps: - - uses: actions/checkout@v1 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: "4.0.6" - - name: Install PostgreSQL 11 client - run: | - sudo apt-get -yqq install libpq-dev - - - name: Build App - env: - PGHOST: localhost - PGUSER: postgres - RAILS_ENV: test - run: | - gem install bundler - bundle install --jobs 4 --retry 3 - cp config/database.yml.github config/database.yml - cat config/database.yml - bin/setup - bin/rails db:setup - - name: Run tests - run: | - bundle exec rake - test-rails-next: - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:11.6-alpine ports: - 5432:5432 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - # needed because the postgres container does not provide a healthcheck - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + # The postgres image ships no healthcheck of its own. + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + RAILS_ENV: test + PGHOST: localhost + PGUSER: postgres + BUNDLE_GEMFILE: ${{ matrix.gemfile }} steps: - - uses: actions/checkout@v1 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 + - uses: actions/checkout@v4 + + - name: Install the PostgreSQL client + run: sudo apt-get -yqq install libpq-dev + + # bundler-cache runs `bundle install` against BUNDLE_GEMFILE, so each boot + # is resolved from its own committed lockfile and cached separately. + - uses: ruby/setup-ruby@v1 with: - ruby-version: "4.0.6" - - name: Install PostgreSQL 11 client - run: | - sudo apt-get -yqq install libpq-dev + ruby-version-file: .tool-versions + bundler-cache: true - - name: Build App - env: - PGHOST: localhost - PGUSER: postgres - RAILS_ENV: test - BUNDLE_GEMFILE: Gemfile.next + - name: Set up the database run: | - gem install bundler - bundle update rails --jobs 4 --retry 3 cp config/database.yml.github config/database.yml - cat config/database.yml - bin/setup bin/rails db:setup + - name: Run tests - env: - PGHOST: localhost - PGUSER: postgres - RAILS_ENV: test - BUNDLE_GEMFILE: Gemfile.next - run: | - bundle exec rake + run: bundle exec rake