зеркало из
https://github.com/rs-pro/activeadmin-quill_editor.git
synced 2026-09-04 18:55:50 +03:00
build: Improve dev setup
Этот коммит содержится в:
23
.github/workflows/linters.yml
поставляемый
23
.github/workflows/linters.yml
поставляемый
@@ -2,38 +2,35 @@
|
|||||||
name: Linters
|
name: Linters
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
reviewdog:
|
reviewdog:
|
||||||
name: reviewdog
|
name: Reviewdog
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
ruby: ['3.0']
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RUBY_VERSION: ${{ matrix.ruby }}
|
RAILS_VERSION: 7.0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Ruby
|
- name: Set up Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: ${{ matrix.ruby }}
|
ruby-version: 3.0
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
|
|
||||||
- uses: reviewdog/action-setup@v1
|
- name: Set up Reviewdog
|
||||||
|
uses: reviewdog/action-setup@v1
|
||||||
with:
|
with:
|
||||||
reviewdog_version: latest
|
reviewdog_version: latest
|
||||||
|
|
||||||
- name: Run reviewdog
|
- name: Run Reviewdog
|
||||||
env:
|
env:
|
||||||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
20
.github/workflows/specs_rails61.yml
поставляемый
20
.github/workflows/specs_rails61.yml
поставляемый
@@ -1,24 +1,23 @@
|
|||||||
---
|
---
|
||||||
name: Specs Rails 6.1
|
name: Specs Rails 6.1 with ActiveAdmin 2.9
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ruby: ['3.0', '3.1']
|
ruby: ['3.0']
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RAILS_VERSION: 6.1.0
|
RAILS_VERSION: 6.0
|
||||||
|
ACTIVEADMIN_VERSION: 2.9.0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -30,6 +29,9 @@ jobs:
|
|||||||
ruby-version: ${{ matrix.ruby }}
|
ruby-version: ${{ matrix.ruby }}
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Database setup
|
||||||
|
run: bin/rails db:create db:migrate db:test:prepare
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: bundle exec rspec --profile
|
run: bundle exec rspec --profile
|
||||||
|
|
||||||
|
|||||||
17
.github/workflows/specs_rails70.yml
поставляемый
17
.github/workflows/specs_rails70.yml
поставляемый
@@ -2,23 +2,21 @@
|
|||||||
name: Specs Rails 7.0
|
name: Specs Rails 7.0
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ruby: ['3.1']
|
ruby: ['3.0', '3.2']
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RAILS_VERSION: 7.0.0
|
RAILS_VERSION: 7.0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -30,6 +28,9 @@ jobs:
|
|||||||
ruby-version: ${{ matrix.ruby }}
|
ruby-version: ${{ matrix.ruby }}
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Database setup
|
||||||
|
run: bin/rails db:create db:migrate db:test:prepare
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: bundle exec rspec --profile
|
run: bundle exec rspec --profile
|
||||||
|
|
||||||
|
|||||||
17
.github/workflows/specs_rails71.yml
поставляемый
17
.github/workflows/specs_rails71.yml
поставляемый
@@ -2,23 +2,21 @@
|
|||||||
name: Specs Rails 7.1
|
name: Specs Rails 7.1
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ruby: ['3.2']
|
ruby: ['3.2', '3.4']
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RAILS_VERSION: 7.1.0
|
RAILS_VERSION: 7.1
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -30,6 +28,9 @@ jobs:
|
|||||||
ruby-version: ${{ matrix.ruby }}
|
ruby-version: ${{ matrix.ruby }}
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Database setup
|
||||||
|
run: bin/rails db:create db:migrate db:test:prepare
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: bundle exec rspec --profile
|
run: bundle exec rspec --profile
|
||||||
|
|
||||||
|
|||||||
15
.github/workflows/specs_rails72.yml
поставляемый
15
.github/workflows/specs_rails72.yml
поставляемый
@@ -2,15 +2,13 @@
|
|||||||
name: Specs Rails 7.2
|
name: Specs Rails 7.2
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
@@ -18,7 +16,7 @@ jobs:
|
|||||||
ruby: ['3.2', '3.4']
|
ruby: ['3.2', '3.4']
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RAILS_VERSION: 7.2.0
|
RAILS_VERSION: 7.2
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -30,6 +28,9 @@ jobs:
|
|||||||
ruby-version: ${{ matrix.ruby }}
|
ruby-version: ${{ matrix.ruby }}
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Database setup
|
||||||
|
run: bin/rails db:create db:migrate db:test:prepare
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: bundle exec rspec --profile
|
run: bundle exec rspec --profile
|
||||||
|
|
||||||
|
|||||||
17
.github/workflows/specs_rails80.yml
поставляемый
17
.github/workflows/specs_rails80.yml
поставляемый
@@ -2,23 +2,21 @@
|
|||||||
name: Specs Rails 8.0
|
name: Specs Rails 8.0
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ruby: ['3.2', '3.3', '3.4']
|
ruby: ['3.2', '3.4']
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RAILS_VERSION: 8.0.0
|
RAILS_VERSION: 8.0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -30,6 +28,9 @@ jobs:
|
|||||||
ruby-version: ${{ matrix.ruby }}
|
ruby-version: ${{ matrix.ruby }}
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Database setup
|
||||||
|
run: bin/rails db:create db:migrate db:test:prepare
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: bundle exec rspec --profile
|
run: bundle exec rspec --profile
|
||||||
|
|
||||||
|
|||||||
1
.gitignore
поставляемый
1
.gitignore
поставляемый
@@ -8,6 +8,7 @@
|
|||||||
/_misc/
|
/_misc/
|
||||||
/coverage/
|
/coverage/
|
||||||
/spec/dummy/db/*.sqlite3*
|
/spec/dummy/db/*.sqlite3*
|
||||||
|
/spec/dummy/db/schema-dev.rb
|
||||||
/spec/dummy/log/
|
/spec/dummy/log/
|
||||||
/spec/dummy/storage/
|
/spec/dummy/storage/
|
||||||
/spec/dummy/tmp/
|
/spec/dummy/tmp/
|
||||||
|
|||||||
24
Gemfile
24
Gemfile
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
source 'https://rubygems.org'
|
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'
|
if ENV['DEVEL'] == '1'
|
||||||
gem 'activeadmin_quill_editor', path: './'
|
gem 'activeadmin_quill_editor', path: './'
|
||||||
else
|
else
|
||||||
@@ -9,20 +15,22 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
ruby_ver = ENV.fetch('RUBY_VERSION', '')
|
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)
|
gem(*rails)
|
||||||
|
|
||||||
activeadmin = activeadmin_ver.empty? ? ['activeadmin'] : ['activeadmin', "~> #{activeadmin_ver}"]
|
active_admin_ver = ENV.fetch('ACTIVEADMIN_VERSION', '')
|
||||||
gem(*activeadmin)
|
active_admin = eval_version('activeadmin', active_admin_ver)
|
||||||
|
gem(*active_admin)
|
||||||
|
|
||||||
ruby32 = Gem::Version.new(ruby_ver) >= Gem::Version.new('3.2')
|
ruby32 = ruby_ver.empty? || Gem::Version.new(ruby_ver) >= Gem::Version.new('3.2')
|
||||||
rails72 = Gem::Version.new(rails_ver) >= Gem::Version.new('7.2')
|
rails72 = rails_ver.empty? || Gem::Version.new(rails_ver) >= Gem::Version.new('7.2')
|
||||||
sqlite3 = ruby32 || rails72 ? ['sqlite3'] : ['sqlite3', '~> 1.4']
|
sqlite3 = ruby32 && rails72 ? ['sqlite3'] : ['sqlite3', '~> 1.4']
|
||||||
gem(*sqlite3)
|
gem(*sqlite3)
|
||||||
|
|
||||||
|
gem 'zeitwerk', '~> 2.6.18' unless ruby32
|
||||||
|
|
||||||
# NOTE: to avoid error: uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger
|
# NOTE: to avoid error: uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger
|
||||||
gem 'concurrent-ruby', '1.3.4'
|
gem 'concurrent-ruby', '1.3.4'
|
||||||
|
|
||||||
|
|||||||
18
Makefile
18
Makefile
@@ -1,7 +1,14 @@
|
|||||||
include extra/.env
|
include extra/.env
|
||||||
|
|
||||||
help:
|
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
|
# System commands
|
||||||
|
|
||||||
@@ -10,7 +17,7 @@ build:
|
|||||||
@docker compose -f extra/docker-compose.yml build
|
@docker compose -f extra/docker-compose.yml build
|
||||||
|
|
||||||
db_reset:
|
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
|
up: build db_reset
|
||||||
@docker compose -f extra/docker-compose.yml up
|
@docker compose -f extra/docker-compose.yml up
|
||||||
@@ -23,13 +30,16 @@ down:
|
|||||||
|
|
||||||
# App commands
|
# 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
|
@docker compose -f extra/docker-compose.yml exec app bin/rails console
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
@docker compose -f extra/docker-compose.yml exec app bin/rubocop
|
@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}
|
@docker compose -f extra/docker-compose.yml exec app bin/rails server -b 0.0.0.0 -p ${SERVER_PORT}
|
||||||
|
|
||||||
specs:
|
specs:
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ ENV ACTIVEADMIN_VERSION=$ACTIVEADMIN_VERSION
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
RUN bundle install
|
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
|
RUN ln -s /app/extra/.bashrc /home/app/.bashrc
|
||||||
|
|||||||
@@ -4,5 +4,3 @@ export DEVEL=1
|
|||||||
|
|
||||||
export RAILS_VERSION=7.2.2.1
|
export RAILS_VERSION=7.2.2.1
|
||||||
export ACTIVEADMIN_VERSION=3.3.0
|
export ACTIVEADMIN_VERSION=3.3.0
|
||||||
|
|
||||||
export RAILS_ENV=development
|
|
||||||
|
|||||||
@@ -1,29 +1,21 @@
|
|||||||
## Development
|
## Development
|
||||||
|
|
||||||
Overcommit can be used to ensure that Conventional commits are good.
|
|
||||||
|
|
||||||
### Dev setup
|
### Dev setup
|
||||||
|
|
||||||
There 2 ways to interact with this project:
|
There are 2 ways to interact with this project:
|
||||||
|
|
||||||
1) Using Docker:
|
1) Using Docker:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Run rails server on the dummy app (=> http://localhost:3000 to access to ActiveAdmin):
|
make up # starts the dev services (optional env vars: RUBY / RAILS / ACTIVEADMIN)
|
||||||
make up
|
make specs # run the tests (after up)
|
||||||
# Enter in a Rails console (with the dummy app started):
|
make lint # run the linters (after up)
|
||||||
make console
|
make server # run the server (after up)
|
||||||
# Enter in a shell (with the dummy app started):
|
make shell # open a shell (after up)
|
||||||
make shell
|
make down # cleanup (after up)
|
||||||
# Run the linter on the project (with the dummy app started):
|
|
||||||
make lint
|
# Example using specific versions:
|
||||||
# Run the test suite (with the dummy app started):
|
RUBY=3.2 RAILS=7.1 ACTIVEADMIN=3.2.0 make up
|
||||||
make specs
|
|
||||||
# Remove container and image:
|
|
||||||
make cleanup
|
|
||||||
# To try different versions of Ruby/Rails/ActiveAdmin:
|
|
||||||
RUBY=3.2 RAILS=7.1.0 ACTIVEADMIN=3.2.0 make up
|
|
||||||
# For more commands please check the Makefile
|
|
||||||
```
|
```
|
||||||
|
|
||||||
2) With a local setup:
|
2) With a local setup:
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ services:
|
|||||||
context: ..
|
context: ..
|
||||||
dockerfile: extra/Dockerfile
|
dockerfile: extra/Dockerfile
|
||||||
args:
|
args:
|
||||||
ACTIVEADMIN_VERSION: ${ACTIVEADMIN:-}
|
|
||||||
BUNDLER_VERSION: ${BUNDLER_VERSION}
|
BUNDLER_VERSION: ${BUNDLER_VERSION}
|
||||||
RAILS_VERSION: ${RAILS:-}
|
|
||||||
RUBY_IMAGE: ruby:${RUBY:-3.4}-slim
|
RUBY_IMAGE: ruby:${RUBY:-3.4}-slim
|
||||||
|
RAILS_VERSION: ${RAILS:-}
|
||||||
|
ACTIVEADMIN_VERSION: ${ACTIVEADMIN:-}
|
||||||
UID: ${UID}
|
UID: ${UID}
|
||||||
user: ${UID}:${GID}
|
user: ${UID}:${GID}
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user