Skip to content

Commit dbe9d8d

Browse files
author
Mattia Roccoberton
committed
test: add Rails 7.1 support
1 parent 7b05c62 commit dbe9d8d

14 files changed

Lines changed: 858 additions & 8 deletions

.github/workflows/specs_mysql_60.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v2
43+
uses: actions/checkout@v4
4444

4545
- name: Set up Ruby
4646
uses: ruby/setup-ruby@v1

.github/workflows/specs_mysql_61.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v2
43+
uses: actions/checkout@v4
4444

4545
- name: Set up Ruby
4646
uses: ruby/setup-ruby@v1

.github/workflows/specs_mysql_70.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v2
43+
uses: actions/checkout@v4
4444

4545
- name: Set up Ruby
4646
uses: ruby/setup-ruby@v1
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: Specs Rails 7.1 MySQL
3+
4+
on:
5+
pull_request:
6+
branches: [main]
7+
push:
8+
branches: [main]
9+
10+
jobs:
11+
tests:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
ruby: ['3.0', '3.1', '3.2']
17+
gemfile: ['rails_7_1_mysql']
18+
19+
env:
20+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
21+
DB_TEST: mysql
22+
MYSQL_DB_HOST: 127.0.0.1
23+
MYSQL_DB_USERNAME: root
24+
MYSQL_DB_PASSWORD: root
25+
RAILS: '7.0'
26+
27+
services:
28+
mysql:
29+
image: mysql
30+
env:
31+
MYSQL_USER: root
32+
MYSQL_PASSWORD: root
33+
# options: >-
34+
# --health-cmd="mysqladmin ping"
35+
# --health-interval 10s
36+
# --health-timeout 5s
37+
# --health-retries 5
38+
ports:
39+
- 3306:3306
40+
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v4
44+
45+
- name: Set up Ruby
46+
uses: ruby/setup-ruby@v1
47+
with:
48+
ruby-version: ${{ matrix.ruby }}
49+
bundler-cache: true
50+
51+
- name: Start database service
52+
run: sudo /etc/init.d/mysql start
53+
54+
- name: Create database
55+
run: bundle exec rails db:create
56+
57+
- name: Apply migrations
58+
run: bundle exec rails db:migrate
59+
60+
- name: Run tests
61+
run: bundle exec rspec --profile

.github/workflows/specs_postgres_60.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v2
43+
uses: actions/checkout@v4
4444

4545
- name: Set up Ruby
4646
uses: ruby/setup-ruby@v1

.github/workflows/specs_postgres_61.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v2
43+
uses: actions/checkout@v4
4444

4545
- name: Set up Ruby
4646
uses: ruby/setup-ruby@v1

.github/workflows/specs_postgres_70.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v2
43+
uses: actions/checkout@v4
4444

4545
- name: Set up Ruby
4646
uses: ruby/setup-ruby@v1
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
name: Specs Rails 7.1 Postgres
3+
4+
on:
5+
pull_request:
6+
branches: [main]
7+
push:
8+
branches: [main]
9+
10+
jobs:
11+
tests:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
ruby: ['3.0', '3.1', '3.2']
17+
gemfile: ['rails_7_1_postgres']
18+
19+
env:
20+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
21+
DB_TEST: postgres
22+
PG_DB_HOST: 127.0.0.1
23+
PG_DB_USERNAME: postgres
24+
PG_DB_PASSWORD: postgres
25+
RAILS: '7.0'
26+
27+
services:
28+
postgres:
29+
image: postgres:latest
30+
env:
31+
POSTGRES_USER: postgres
32+
POSTGRES_PASSWORD: postgres
33+
options: >-
34+
--health-cmd pg_isready
35+
--health-interval 10s
36+
--health-timeout 5s
37+
--health-retries 5
38+
ports:
39+
- 5432:5432
40+
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v2
44+
45+
- name: Set up Ruby
46+
uses: ruby/setup-ruby@v1
47+
with:
48+
ruby-version: ${{ matrix.ruby }}
49+
bundler-cache: true
50+
51+
- name: Create database
52+
run: bundle exec rails db:create
53+
54+
- name: Apply migrations
55+
run: bundle exec rails db:migrate
56+
57+
- name: Run tests
58+
run: bundle exec rspec --profile
59+
60+
- name: Code Climate test coverage
61+
uses: paambaati/codeclimate-action@v3.0.0
62+
env:
63+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
64+
with:
65+
coverageLocations: |
66+
${{github.workspace}}/coverage/lcov/active_storage_db.lcov:lcov
67+
68+
# - name: Upload coverage results
69+
# uses: actions/upload-artifact@main
70+
# if: always()
71+
# with:
72+
# name: coverage-report
73+
# path: coverage/index.html

Appraisals

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ appraise 'rails-7_0-postgres' do
1515
gem 'rails', '~> 7.0.0'
1616
end
1717

18+
appraise 'rails-7_1-postgres' do
19+
gem 'pg'
20+
gem 'rails', '~> 7.1.0'
21+
end
22+
1823
appraise 'rails-6_0-mysql' do
1924
gem 'mysql2'
2025
gem 'rails', '~> 6.0.0'
@@ -29,3 +34,8 @@ appraise 'rails-7_0-mysql' do
2934
gem 'mysql2'
3035
gem 'rails', '~> 7.0.0'
3136
end
37+
38+
appraise 'rails-7_1-mysql' do
39+
gem 'mysql2'
40+
gem 'rails', '~> 7.1.0'
41+
end

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
[![maintainability](https://api.codeclimate.com/v1/badges/92e1e703c308744a0f66/maintainability)](https://codeclimate.com/github/blocknotes/active_storage_db/maintainability)
66

77
[![linters](https://github.com/blocknotes/active_storage_db/actions/workflows/linters.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/linters.yml)
8-
[![specs Postgres](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_70.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_70.yml)
9-
[![Specs MySQL](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_70.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_70.yml)
8+
[![specs Postgres](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_71.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_71.yml)
9+
[![specs MySQL](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_71.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_71.yml)
1010

1111
An Active Storage service upload/download plugin that stores files in a PostgreSQL or MySQL database.
1212

0 commit comments

Comments
 (0)