Skip to content

Commit

Permalink
Merge pull request #786 from davidsiaw/upgrade
Browse files Browse the repository at this point in the history
upgrade everything
  • Loading branch information
davidsiaw authored May 26, 2024
2 parents 26ddb97 + ad77e3a commit 7f989e3
Show file tree
Hide file tree
Showing 18 changed files with 327 additions and 262 deletions.
6 changes: 5 additions & 1 deletion .circleci/compose-unit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.7'
services:
# Unit server
rails-unit:
Expand All @@ -19,6 +18,11 @@ services:
chrome:
image: selenium/standalone-chrome
container_name: chrome
healthcheck:
test: ["CMD", "curl", "-v", "http://localhost:4444/wd/hub/status"]
interval: 10s
timeout: 5s
retries: 3
volumes:
db_data:
active_storage:
16 changes: 5 additions & 11 deletions .circleci/compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.7'
services:
# Rails database
# If you wish to clear the database contents simply run
Expand Down Expand Up @@ -31,12 +30,6 @@ services:
depends_on:
- db
- redis
deploy:
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

# Rails server
# This is the main server.
Expand All @@ -48,8 +41,6 @@ services:
build: ..
container_name: rails
command: sh -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://postgres:postgres@db
REDIS_URL: redis://redis:6379/0
Expand All @@ -67,8 +58,11 @@ services:
chrome:
image: selenium/standalone-chrome-debug
container_name: chrome
ports:
- "5900:5900"
healthcheck:
test: ["CMD", "curl", "-v", "http://localhost:4444/wd/hub/status"]
interval: 10s
timeout: 5s
retries: 3
volumes:
db_data:
active_storage:
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:3.0-node
- image: cimg/ruby:3.3.1-node
environment:
RAILS_ENV: test

Expand All @@ -19,17 +19,17 @@ jobs:
- run:
name: install docker compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
curl -SL https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64 -o ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
- setup_remote_docker:
version: 20.10.7
version: docker24

- run:
name: start stack
command: |
docker-compose -f .circleci/compose.yml up -d
docker-compose -f .circleci/compose.yml up -d --wait
docker-compose -f .circleci/compose.yml exec rails bundle exec rails db:create
docker-compose -f .circleci/compose.yml exec rails bundle exec rails db:schema:load
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
build-unit:
docker:
# specify the version you desire here
- image: circleci/ruby:3.0-node
- image: cimg/ruby:3.3.1-node
environment:
RAILS_ENV: test
working_directory: ~/repo
Expand All @@ -79,17 +79,17 @@ jobs:
- run:
name: install docker compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
curl -SL https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64 -o ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
- setup_remote_docker:
version: 20.10.7
version: docker24

- run:
name: start stack
command: |
docker-compose -f .circleci/compose-unit.yml up -d
docker-compose -f .circleci/compose-unit.yml up -d --wait
# run tests!
- run:
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:

rubocop:
docker:
- image: circleci/ruby:3.0-node
- image: cimg/ruby:3.3.1-node
environment:
RAILS_ENV: development
steps:
Expand All @@ -151,7 +151,7 @@ jobs:

danger:
docker:
- image: circleci/ruby:3.0-node
- image: cimg/ruby:3.3.1-node
environment:
RAILS_ENV: development
steps:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: install docker compose
run: sudo curl -SL https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
- name: Build and run tests
run: |
docker-compose -f .circleci/compose-unit.yml up -d
docker-compose -f .circleci/compose-unit.yml up -d --wait
timeout 60 bash -c -- 'while [[ "$(docker-compose -f .circleci/compose-unit.yml exec -T rails-unit curl -s -o /dev/null -w ''%{http_code}'' http://localhost:3000/api/v1/health)" != "200" ]]; do sleep 1; printf "."; done'
docker-compose -f .circleci/compose-unit.yml exec -T rails-unit bundle exec rails db:test:prepare
docker-compose -f .circleci/compose-unit.yml exec -T rails-unit bundle exec rspec --format progress
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- 4444:4444

container:
image: ruby:3.0-alpine
image: ruby:3.3-alpine

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/ruby/tags/
image: "ruby:3.0-alpine"
image: "ruby:3.3-alpine"

# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.6
TargetRubyVersion: 3.3
Exclude:
- 'db/migrate/*.rb'
- 'db/schema.rb'
Expand Down
16 changes: 7 additions & 9 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,13 @@ end
# ------------------------------------------------------------------------------

begin
unless github.api.organization_member?('bunnylabs', github.pr_author)
# Pay extra attention if they modify stuff
important_files = %w[Gemfile Dangerfile]
modified_important_files = git.modified_files & important_files
unless modified_important_files.empty?
warn <<~WARNING
External contributor has edited these files: #{modified_important_files.to_a.join(', ')}
WARNING
end
# Pay extra attention if they modify stuff
important_files = %w[Gemfile Dangerfile]
modified_important_files = git.modified_files & important_files
unless modified_important_files.empty?
warn <<~WARNING
External contributor has edited these files: #{modified_important_files.to_a.join(', ')}
WARNING
end
rescue URI::InvalidURIError => e
warn <<~WARNING
Expand Down
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.0-alpine
FROM ruby:3.3-alpine

ARG PUID=1000
ARG PGID=1000
Expand Down Expand Up @@ -38,9 +38,4 @@ EXPOSE 3000

ENV RAILS_ENV=development

HEALTHCHECK --interval=1m \
--timeout=3s \
--start-period=20s \
CMD curl -f http://localhost:3000/api/v1/health || exit 1

CMD ["sh", "-c", "rails s -b 0.0.0.0 -p 3000"]
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 7.0.8'
gem 'rails', '~> 7'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
Expand Down Expand Up @@ -42,6 +42,8 @@ gem 'grape-swagger-rails'
gem 'grape-swagger-representable'
gem 'paper_trail'

gem 'faraday-retry'

gem 'ar-uuid'
gem 'ulid-rails', git: 'https://github.com/davidsiaw/ulid-rails'

Expand Down
Loading

0 comments on commit 7f989e3

Please sign in to comment.