Run tests on both PostgreSQL v15.x and v14.x

pg15
Yamagishi Kazutoshi 2022-12-01 14:45:43 +00:00
parent 18d00055f4
commit 8a434b8bbb
1 changed files with 36 additions and 10 deletions

View File

@ -9,6 +9,10 @@ executors:
parameters: parameters:
ruby-version: ruby-version:
type: string type: string
default: '3.0'
postgres-version:
type: string
default: '14.5'
docker: docker:
- image: cimg/ruby:<< parameters.ruby-version >> - image: cimg/ruby:<< parameters.ruby-version >>
environment: environment:
@ -19,7 +23,7 @@ executors:
DB_USER: root DB_USER: root
DISABLE_SIMPLECOV: true DISABLE_SIMPLECOV: true
RAILS_ENV: test RAILS_ENV: test
- image: cimg/postgres:14.5 - image: cimg/postgres:<< parameters.postgres-version >>
environment: environment:
POSTGRES_USER: root POSTGRES_USER: root
POSTGRES_HOST_AUTH_METHOD: trust POSTGRES_HOST_AUTH_METHOD: trust
@ -37,6 +41,7 @@ commands:
parameters: parameters:
ruby-version: ruby-version:
type: string type: string
default: '3.0'
steps: steps:
- run: - run:
command: | command: |
@ -62,8 +67,7 @@ jobs:
steps: steps:
- checkout - checkout
- install-system-dependencies - install-system-dependencies
- install-ruby-dependencies: - install-ruby-dependencies
ruby-version: '3.0'
- node/install-packages: - node/install-packages:
cache-version: v1 cache-version: v1
pkg-manager: yarn pkg-manager: yarn
@ -82,9 +86,12 @@ jobs:
parameters: parameters:
ruby-version: ruby-version:
type: string type: string
postgres-version:
type: string
executor: executor:
name: default name: default
ruby-version: << parameters.ruby-version >> ruby-version: << parameters.ruby-version >>
postgres-version: << parameters.postgres-version >>
environment: environment:
ALLOW_NOPAM: true ALLOW_NOPAM: true
PAM_ENABLED: true PAM_ENABLED: true
@ -111,14 +118,16 @@ jobs:
- ruby/rspec-test - ruby/rspec-test
test-migrations: test-migrations:
parameters:
postgres-version:
type: string
executor: executor:
name: default name: default
ruby-version: '3.0' postgres-version: << parameters.postgres-version >>
steps: steps:
- checkout - checkout
- install-system-dependencies - install-system-dependencies
- install-ruby-dependencies: - install-ruby-dependencies
ruby-version: '3.0'
- wait-db - wait-db
- run: - run:
command: ./bin/rails db:create command: ./bin/rails db:create
@ -149,14 +158,16 @@ jobs:
name: Check migration result name: Check migration result
test-two-step-migrations: test-two-step-migrations:
parameters:
postgres-version:
type: string
executor: executor:
name: default name: default
ruby-version: '3.0' postgres-version: << parameters.postgres-version >>
steps: steps:
- checkout - checkout
- install-system-dependencies - install-system-dependencies
- install-ruby-dependencies: - install-ruby-dependencies
ruby-version: '3.0'
- wait-db - wait-db
- run: - run:
command: ./bin/rails db:create command: ./bin/rails db:create
@ -206,15 +217,30 @@ workflows:
ruby-version: ruby-version:
- '2.7' - '2.7'
- '3.0' - '3.0'
name: test-ruby<< matrix.ruby-version >> postgres-version:
- '14.5'
- '15.0'
name: test-ruby<< matrix.ruby-version >>-pg<< matrix.postgres-version >>
requires: requires:
- build - build
- test-migrations: - test-migrations:
requires: requires:
- build - build
matrix:
parameters:
postgres-version:
- '14.5'
- '15.0'
name: test-migrations-pg<< matrix.postgres-version >>
- test-two-step-migrations: - test-two-step-migrations:
requires: requires:
- build - build
matrix:
parameters:
postgres-version:
- '14.5'
- '15.0'
name: test-two-step-migrations-pg<< matrix.postgres-version >>
- node/run: - node/run:
cache-version: v1 cache-version: v1
name: test-webui name: test-webui