Skip to content

Commit

Permalink
chore: Add separate GitHub Actions for PostgreSQL and MySQL CI (#93)
Browse files Browse the repository at this point in the history
* chore: Add separate GitHub Actions for PostgreSQL and MySQL CI

Separated PostgreSQL and MySQL configurations into distinct GitHub Actions for clarity and easier maintenance. Updated .github/workflows/ci.yml to remove redundancies while creating ci-postgresql.yml and ci-mysql.yml with respective configurations. This enhances our CI/CD pipeline by organizing workflows better and ensuring clear separation between SQL variants.
  • Loading branch information
seuros authored Feb 8, 2024
1 parent c28a172 commit a3166e2
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 37 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci-mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI Mysql
on:
pull_request:
branches:
- master
jobs:
minitest:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
services:
mysql:
image: mysql/mysql-server:5.7
ports:
- "3306:3306"
env:
MYSQL_USER: with_advisory
MYSQL_PASSWORD: with_advisory_pass
MYSQL_DATABASE: with_advisory_lock_test
MYSQL_ROOT_HOST: '%'
strategy:
fail-fast: false
matrix:
ruby:
- '3.2'
- '3.1'
- '3.0'
- '2.7'
- '3.3'
- 'truffleruby'
rails:
- 7.1
- "7.0"
- 6.1
adapter:
- mysql2://with_advisory:with_advisory_pass@0/with_advisory_lock_test
- trilogy://with_advisory:with_advisory_pass@0/with_advisory_lock_test
include:
- ruby: jruby
rails: 6.1
adapter: jdbcmysql://with_advisory:with_advisory_pass@0/with_advisory_lock_test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
rubygems: latest
env:
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
- name: Test
env:
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
DATABASE_URL: ${{ matrix.adapter }}
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }}
run: bundle exec rake
58 changes: 58 additions & 0 deletions .github/workflows/ci-postgresql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI Postgresql
on:
pull_request:
branches:
- master
jobs:
minitest:
runs-on: ubuntu-latest
services:
postgres:
image: 'postgres:14-alpine'
ports: ['5432:5432']
env:
POSTGRES_USER: with_advisory
POSTGRES_PASSWORD: with_advisory_pass
POSTGRES_DB: with_advisory_lock_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
ruby:
- '3.2'
- '3.1'
- '3.0'
- '2.7'
- '3.3'
- 'truffleruby'
rails:
- 7.1
- "7.0"
- 6.1
adapter:
- postgres://with_advisory:with_advisory_pass@0/with_advisory_lock_test
include:
- ruby: jruby
rails: 6.1
adapter: jdbcpostgresql://with_advisory:with_advisory_pass@0/with_advisory_lock_test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
rubygems: latest
env:
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
- name: Test
env:
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
DATABASE_URL: ${{ matrix.adapter }}
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }}
run: bundle exec rake
43 changes: 6 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,6 @@ on:
jobs:
minitest:
runs-on: ubuntu-latest
services:
mysql:
image: mysql/mysql-server:5.7
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: with_advisory_lock_test
MYSQL_ROOT_HOST: '%'
postgres:
image: 'postgres:14-alpine'
ports: ['5432:5432']
env:
POSTGRES_USER: closure_tree
POSTGRES_PASSWORD: closure_tree
POSTGRES_DB: with_advisory_lock_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
Expand All @@ -42,24 +20,15 @@ jobs:
- '3.3'
- 'truffleruby'
rails:
- activerecord_7.1
- activerecord_7.0
- activerecord_6.1
- 7.1
- "7.0"
- 6.1
adapter:
- sqlite3:///tmp/test.sqlite3
- mysql2://root:root@0/with_advisory_lock_test
- trilogy://root:root@0/with_advisory_lock_test
- postgres://closure_tree:closure_tree@0/with_advisory_lock_test
include:
- ruby: jruby
rails: activerecord_6.1
adapter: jdbcmysql://root:root@0/with_advisory_lock_test
- ruby: jruby
rails: activerecord_6.1
rails: 6.1
adapter: jdbcsqlite3:///tmp/test.sqlite3
- ruby: jruby
rails: activerecord_6.1
adapter: jdbcpostgresql://closure_tree:closure_tree@0/with_advisory_lock_test
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -71,11 +40,11 @@ jobs:
bundler-cache: true
rubygems: latest
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile

- name: Test
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
DATABASE_URL: ${{ matrix.adapter }}
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }}
run: bundle exec rake

0 comments on commit a3166e2

Please sign in to comment.