Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,35 @@
name: Linters

on:
push:
branches:
- main
pull_request:
branches: [main]
push:
branches: [main]

jobs:
reviewdog:
name: reviewdog
name: Reviewdog
runs-on: ubuntu-latest

strategy:
matrix:
ruby: ['3.0']

env:
RUBY_VERSION: ${{ matrix.ruby }}
RAILS_VERSION: 7.0

steps:
- name: Check out code
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
ruby-version: 3.0
bundler-cache: true

- uses: reviewdog/action-setup@v1
- name: Set up Reviewdog
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest

- name: Run reviewdog
- name: Run Reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/specs_rails61.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
---
name: Specs Rails 6.1
name: Specs Rails 6.1 with ActiveAdmin 2.9

on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]

jobs:
tests:
test:
runs-on: ubuntu-latest

strategy:
matrix:
ruby: ['3.0', '3.1']
ruby: ['3.0']

env:
RAILS_VERSION: 6.1.0
RAILS_VERSION: 6.0
ACTIVEADMIN_VERSION: 2.9.0

steps:
- name: Checkout repository
Expand All @@ -30,6 +29,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare

- name: Run tests
run: bundle exec rspec --profile

Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/specs_rails70.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@
name: Specs Rails 7.0

on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]

jobs:
tests:
test:
runs-on: ubuntu-latest

strategy:
matrix:
ruby: ['3.1']
ruby: ['3.0', '3.2']

env:
RAILS_VERSION: 7.0.0
RAILS_VERSION: 7.0

steps:
- name: Checkout repository
Expand All @@ -30,6 +28,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare

- name: Run tests
run: bundle exec rspec --profile

Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/specs_rails71.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@
name: Specs Rails 7.1

on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]

jobs:
tests:
test:
runs-on: ubuntu-latest

strategy:
matrix:
ruby: ['3.2']
ruby: ['3.2', '3.4']

env:
RAILS_VERSION: 7.1.0
RAILS_VERSION: 7.1

steps:
- name: Checkout repository
Expand All @@ -30,6 +28,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare

- name: Run tests
run: bundle exec rspec --profile

Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/specs_rails72.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@
name: Specs Rails 7.2

on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]

jobs:
tests:
test:
runs-on: ubuntu-latest

strategy:
matrix:
ruby: ['3.2', '3.4']

env:
RAILS_VERSION: 7.2.0
RAILS_VERSION: 7.2

steps:
- name: Checkout repository
Expand All @@ -30,6 +28,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare

- name: Run tests
run: bundle exec rspec --profile

Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/specs_rails80.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@
name: Specs Rails 8.0

on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]

jobs:
tests:
test:
runs-on: ubuntu-latest

strategy:
matrix:
ruby: ['3.2', '3.3', '3.4']
ruby: ['3.2', '3.4']

env:
RAILS_VERSION: 8.0.0
RAILS_VERSION: 8.0

steps:
- name: Checkout repository
Expand All @@ -30,6 +28,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare

- name: Run tests
run: bundle exec rspec --profile

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/_misc/
/coverage/
/spec/dummy/db/*.sqlite3*
/spec/dummy/db/schema-dev.rb
/spec/dummy/log/
/spec/dummy/storage/
/spec/dummy/tmp/
25 changes: 16 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,35 @@

source 'https://rubygems.org'

def eval_version(dependency, version)
return [dependency] if version.empty?

version.count('.') < 2 ? [dependency, "~> #{version}.0"] : [dependency, version]
end

if ENV['DEVEL'] == '1'
gem 'activeadmin_quill_editor', path: './'
else
gemspec
end

ruby_ver = ENV.fetch('RUBY_VERSION', '')
rails_ver = ENV.fetch('RAILS_VERSION', '')
activeadmin_ver = ENV.fetch('ACTIVEADMIN_VERSION', '')

rails = rails_ver.empty? ? ['rails'] : ['rails', "~> #{rails_ver}"]
rails_ver = ENV.fetch('RAILS_VERSION', '')
rails = eval_version('rails', rails_ver)
gem(*rails)

activeadmin = activeadmin_ver.empty? ? ['activeadmin'] : ['activeadmin', "~> #{activeadmin_ver}"]
gem(*activeadmin)
active_admin_ver = ENV.fetch('ACTIVEADMIN_VERSION', '')
active_admin = eval_version('activeadmin', active_admin_ver)
gem(*active_admin)

ruby32 = Gem::Version.new(ruby_ver) >= Gem::Version.new('3.2')
rails72 = Gem::Version.new(rails_ver) >= Gem::Version.new('7.2')
sqlite3 = ruby32 || rails72 ? ['sqlite3'] : ['sqlite3', '~> 1.4']
ruby32 = ruby_ver.empty? || Gem::Version.new(ruby_ver) >= Gem::Version.new('3.2')
rails72 = rails_ver.empty? || Gem::Version.new(rails_ver) >= Gem::Version.new('7.2')
sqlite3 = ruby32 && rails72 ? ['sqlite3'] : ['sqlite3', '~> 1.4']
gem(*sqlite3)

gem 'zeitwerk', '~> 2.6.18' unless ruby32

# NOTE: to avoid error: uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger
gem 'concurrent-ruby', '1.3.4'

Expand All @@ -39,7 +47,6 @@ gem 'capybara'
gem 'cuprite'
gem 'rspec_junit_formatter'
gem 'rspec-rails'
gem 'rspec-retry'
gem 'simplecov', require: false

# Linters
Expand Down
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
include extra/.env

help:
@echo "Main targets: build / specs / up / server / specs / shell"
@echo -e "${COMPOSE_PROJECT_NAME} - Main project commands:\n\
make up # starts the dev services (optional env vars: RUBY / RAILS / ACTIVEADMIN)\n\
make specs # run the tests (after up)\n\
make lint # run the linters (after up)\n\
make server # run the server (after up)\n\
make shell # open a shell (after up)\n\
make down # cleanup (after up)\n\
Example: RUBY=3.2 RAILS=7.1 ACTIVEADMIN=3.2.0 make up"

# System commands

Expand All @@ -10,7 +17,7 @@ build:
@docker compose -f extra/docker-compose.yml build

db_reset:
@docker compose -f extra/docker-compose.yml run --rm app bin/rails db:reset db:test:prepare
@docker compose -f extra/docker-compose.yml run --rm app bin/rails db:create db:migrate db:test:prepare

up: build db_reset
@docker compose -f extra/docker-compose.yml up
Expand All @@ -23,13 +30,16 @@ down:

# App commands

console:
seed:
@docker compose -f extra/docker-compose.yml exec app bin/rails db:seed

console: seed
@docker compose -f extra/docker-compose.yml exec app bin/rails console

lint:
@docker compose -f extra/docker-compose.yml exec app bin/rubocop

server:
server: seed
@docker compose -f extra/docker-compose.yml exec app bin/rails server -b 0.0.0.0 -p ${SERVER_PORT}

specs:
Expand Down
2 changes: 1 addition & 1 deletion extra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ ENV ACTIVEADMIN_VERSION=$ACTIVEADMIN_VERSION
WORKDIR /app
COPY . /app
RUN bundle install
RUN mkdir -p /app/spec/dummy/db && chown -R app:app /app/spec/dummy/db /usr/local/bundle
RUN chown -R app:app /usr/local/bundle

RUN ln -s /app/extra/.bashrc /home/app/.bashrc
2 changes: 0 additions & 2 deletions extra/dev_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ export DEVEL=1

export RAILS_VERSION=7.2.2.1
export ACTIVEADMIN_VERSION=3.3.0

export RAILS_ENV=development
Loading