Skip to content

Commit a3166e2

Browse files
authored
chore: Add separate GitHub Actions for PostgreSQL and MySQL CI (#93)
* 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.
1 parent c28a172 commit a3166e2

3 files changed

Lines changed: 121 additions & 37 deletions

File tree

.github/workflows/ci-mysql.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CI Mysql
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
minitest:
8+
runs-on: ubuntu-latest
9+
name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
10+
services:
11+
mysql:
12+
image: mysql/mysql-server:5.7
13+
ports:
14+
- "3306:3306"
15+
env:
16+
MYSQL_USER: with_advisory
17+
MYSQL_PASSWORD: with_advisory_pass
18+
MYSQL_DATABASE: with_advisory_lock_test
19+
MYSQL_ROOT_HOST: '%'
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
ruby:
24+
- '3.2'
25+
- '3.1'
26+
- '3.0'
27+
- '2.7'
28+
- '3.3'
29+
- 'truffleruby'
30+
rails:
31+
- 7.1
32+
- "7.0"
33+
- 6.1
34+
adapter:
35+
- mysql2://with_advisory:with_advisory_pass@0/with_advisory_lock_test
36+
- trilogy://with_advisory:with_advisory_pass@0/with_advisory_lock_test
37+
include:
38+
- ruby: jruby
39+
rails: 6.1
40+
adapter: jdbcmysql://with_advisory:with_advisory_pass@0/with_advisory_lock_test
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
- name: Setup Ruby
45+
uses: ruby/setup-ruby@v1
46+
with:
47+
ruby-version: ${{ matrix.ruby }}
48+
bundler-cache: true
49+
rubygems: latest
50+
env:
51+
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
52+
- name: Test
53+
env:
54+
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
55+
DATABASE_URL: ${{ matrix.adapter }}
56+
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }}
57+
run: bundle exec rake
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CI Postgresql
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
minitest:
8+
runs-on: ubuntu-latest
9+
services:
10+
postgres:
11+
image: 'postgres:14-alpine'
12+
ports: ['5432:5432']
13+
env:
14+
POSTGRES_USER: with_advisory
15+
POSTGRES_PASSWORD: with_advisory_pass
16+
POSTGRES_DB: with_advisory_lock_test
17+
options: >-
18+
--health-cmd pg_isready
19+
--health-interval 10s
20+
--health-timeout 5s
21+
--health-retries 5
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
ruby:
26+
- '3.2'
27+
- '3.1'
28+
- '3.0'
29+
- '2.7'
30+
- '3.3'
31+
- 'truffleruby'
32+
rails:
33+
- 7.1
34+
- "7.0"
35+
- 6.1
36+
adapter:
37+
- postgres://with_advisory:with_advisory_pass@0/with_advisory_lock_test
38+
include:
39+
- ruby: jruby
40+
rails: 6.1
41+
adapter: jdbcpostgresql://with_advisory:with_advisory_pass@0/with_advisory_lock_test
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
- name: Setup Ruby
46+
uses: ruby/setup-ruby@v1
47+
with:
48+
ruby-version: ${{ matrix.ruby }}
49+
bundler-cache: true
50+
rubygems: latest
51+
env:
52+
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
53+
- name: Test
54+
env:
55+
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
56+
DATABASE_URL: ${{ matrix.adapter }}
57+
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }}
58+
run: bundle exec rake

.github/workflows/ci.yml

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,6 @@ on:
99
jobs:
1010
minitest:
1111
runs-on: ubuntu-latest
12-
services:
13-
mysql:
14-
image: mysql/mysql-server:5.7
15-
ports:
16-
- "3306:3306"
17-
env:
18-
MYSQL_ROOT_PASSWORD: root
19-
MYSQL_DATABASE: with_advisory_lock_test
20-
MYSQL_ROOT_HOST: '%'
21-
postgres:
22-
image: 'postgres:14-alpine'
23-
ports: ['5432:5432']
24-
env:
25-
POSTGRES_USER: closure_tree
26-
POSTGRES_PASSWORD: closure_tree
27-
POSTGRES_DB: with_advisory_lock_test
28-
options: >-
29-
--health-cmd pg_isready
30-
--health-interval 10s
31-
--health-timeout 5s
32-
--health-retries 5
33-
3412
strategy:
3513
fail-fast: false
3614
matrix:
@@ -42,24 +20,15 @@ jobs:
4220
- '3.3'
4321
- 'truffleruby'
4422
rails:
45-
- activerecord_7.1
46-
- activerecord_7.0
47-
- activerecord_6.1
23+
- 7.1
24+
- "7.0"
25+
- 6.1
4826
adapter:
4927
- sqlite3:///tmp/test.sqlite3
50-
- mysql2://root:root@0/with_advisory_lock_test
51-
- trilogy://root:root@0/with_advisory_lock_test
52-
- postgres://closure_tree:closure_tree@0/with_advisory_lock_test
5328
include:
5429
- ruby: jruby
55-
rails: activerecord_6.1
56-
adapter: jdbcmysql://root:root@0/with_advisory_lock_test
57-
- ruby: jruby
58-
rails: activerecord_6.1
30+
rails: 6.1
5931
adapter: jdbcsqlite3:///tmp/test.sqlite3
60-
- ruby: jruby
61-
rails: activerecord_6.1
62-
adapter: jdbcpostgresql://closure_tree:closure_tree@0/with_advisory_lock_test
6332
steps:
6433
- name: Checkout
6534
uses: actions/checkout@v4
@@ -71,11 +40,11 @@ jobs:
7140
bundler-cache: true
7241
rubygems: latest
7342
env:
74-
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
43+
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
7544

7645
- name: Test
7746
env:
78-
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
47+
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
7948
DATABASE_URL: ${{ matrix.adapter }}
8049
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }}
8150
run: bundle exec rake

0 commit comments

Comments
 (0)