Skip to content

Commit

Permalink
upgrade rails to 7.2 (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlvallelonga authored Nov 1, 2024
1 parent 80335bb commit db435e7
Show file tree
Hide file tree
Showing 26 changed files with 284 additions and 125 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

system_tests:
if: github.repository == 'AllYourBot/hostedgpt'
runs-on: large-runner
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}-system
cancel-in-progress: true
Expand Down Expand Up @@ -101,7 +101,6 @@ jobs:

- name: Run system tests
run: |
echo -e "###\n###\n###\n### NOTICE: If these tests fail because of Net::ReadTimeout then re-run the test suite. I can't figure out this sporadic failure.\n###\n###\n###"
sed -i 's/hoverOnlyWhenSupported: true/hoverOnlyWhenSupported: false/' config/tailwind.config.js
PARALLEL_WORKERS=2 bin/rails test:system
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FROM base-for-fly as build
RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \
apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential libpq-dev libvips libyaml-dev
apt-get install --no-install-recommends -y git build-essential libpq-dev libvips libyaml-dev

# Install application gems
COPY --link Gemfile Gemfile.lock .ruby-version ./
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source "https://rubygems.org"

ruby file: ".ruby-version"

gem "rails", "~> 7.1.3"
gem "rails", "~> 7.2.2"
gem "sprockets-rails" # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "pg", "~> 1.1"
gem "puma", ">= 6.0"
Expand All @@ -13,6 +13,7 @@ gem "turbo-rails", "~> 2.0.5"
gem "stimulus-rails", "~> 1.3.3"
gem "tailwindcss-rails", "~> 2.7.2"
gem "rack-cors"
gem "ostruct"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
# gem "jbuilder"
Expand Down
147 changes: 74 additions & 73 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,84 +1,81 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
actioncable (7.2.2)
actionpack (= 7.2.2)
activesupport (= 7.2.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actioncable-enhanced-postgresql-adapter (1.0.1)
actioncable (>= 6.0)
connection_pool (>= 2.2.5)
pg (~> 1.5)
actionmailbox (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.4)
actionpack (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activesupport (= 7.1.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
actionmailbox (7.2.2)
actionpack (= 7.2.2)
activejob (= 7.2.2)
activerecord (= 7.2.2)
activestorage (= 7.2.2)
activesupport (= 7.2.2)
mail (>= 2.8.0)
actionmailer (7.2.2)
actionpack (= 7.2.2)
actionview (= 7.2.2)
activejob (= 7.2.2)
activesupport (= 7.2.2)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.1.4)
actionview (= 7.1.4)
activesupport (= 7.1.4)
actionpack (7.2.2)
actionview (= 7.2.2)
activesupport (= 7.2.2)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.4)
actionpack (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
useragent (~> 0.16)
actiontext (7.2.2)
actionpack (= 7.2.2)
activerecord (= 7.2.2)
activestorage (= 7.2.2)
activesupport (= 7.2.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.4)
activesupport (= 7.1.4)
actionview (7.2.2)
activesupport (= 7.2.2)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.4)
activesupport (= 7.1.4)
activejob (7.2.2)
activesupport (= 7.2.2)
globalid (>= 0.3.6)
activemodel (7.1.4)
activesupport (= 7.1.4)
activerecord (7.1.4)
activemodel (= 7.1.4)
activesupport (= 7.1.4)
activemodel (7.2.2)
activesupport (= 7.2.2)
activerecord (7.2.2)
activemodel (= 7.2.2)
activesupport (= 7.2.2)
timeout (>= 0.4.0)
activestorage (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activesupport (= 7.1.4)
activestorage (7.2.2)
actionpack (= 7.2.2)
activejob (= 7.2.2)
activerecord (= 7.2.2)
activesupport (= 7.2.2)
marcel (~> 1.0)
activesupport (7.1.4)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
amatch (0.4.1)
Expand Down Expand Up @@ -106,6 +103,7 @@ GEM
aws-eventstream (~> 1, >= 1.0.2)
base64 (0.2.0)
bcrypt (3.1.20)
benchmark (0.3.0)
bigdecimal (3.1.8)
bindex (0.8.1)
bootsnap (1.17.0)
Expand Down Expand Up @@ -170,7 +168,7 @@ GEM
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
logger (1.6.1)
loofah (2.22.0)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
Expand All @@ -191,10 +189,9 @@ GEM
multi_xml (0.7.1)
bigdecimal (~> 3.1)
multipart-post (2.3.0)
mutex_m (0.2.0)
name_of_person (1.1.3)
activesupport (>= 5.2.0)
net-imap (0.4.17)
net-imap (0.5.0)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -228,11 +225,12 @@ GEM
omniauth-rails_csrf_protection (1.0.2)
actionpack (>= 4.2)
omniauth (~> 2.0)
ostruct (0.6.0)
parallel (1.24.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
pg (1.5.6)
pg (1.5.9)
postmark (1.25.1)
json
postmark-rails (0.22.1)
Expand Down Expand Up @@ -266,20 +264,20 @@ GEM
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.4)
actioncable (= 7.1.4)
actionmailbox (= 7.1.4)
actionmailer (= 7.1.4)
actionpack (= 7.1.4)
actiontext (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activemodel (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
rails (7.2.2)
actioncable (= 7.2.2)
actionmailbox (= 7.2.2)
actionmailer (= 7.2.2)
actionpack (= 7.2.2)
actiontext (= 7.2.2)
actionview (= 7.2.2)
activejob (= 7.2.2)
activemodel (= 7.2.2)
activerecord (= 7.2.2)
activestorage (= 7.2.2)
activesupport (= 7.2.2)
bundler (>= 1.15.0)
railties (= 7.1.4)
railties (= 7.2.2)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -294,10 +292,10 @@ GEM
rails_heroicon (2.2.0)
actionview
railties
railties (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
irb
railties (7.2.2)
actionpack (= 7.2.2)
activesupport (= 7.2.2)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
Expand All @@ -311,7 +309,7 @@ GEM
redis-client (>= 0.17.0)
redis-client (0.18.0)
connection_pool
regexp_parser (2.9.2)
regexp_parser (2.8.3)
reline (0.5.10)
io-console (~> 0.5)
rexml (3.3.8)
Expand Down Expand Up @@ -358,6 +356,7 @@ GEM
racc (~> 1.5)
sexp_processor (~> 4.16)
rubyzip (2.3.2)
securerandom (0.3.1)
selenium-webdriver (4.25.0)
base64 (~> 0.2)
logger (~> 1.4)
Expand Down Expand Up @@ -415,6 +414,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
useragent (0.16.10)
version_gem (1.1.4)
web-console (4.2.1)
actionview (>= 6.0.0)
Expand All @@ -428,7 +428,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.7.0)
zeitwerk (2.7.1)

PLATFORMS
x86_64-linux
Expand All @@ -452,12 +452,13 @@ DEPENDENCIES
omniauth (~> 2.1)
omniauth-google-oauth2 (~> 1.1)
omniauth-rails_csrf_protection (~> 1.0.2)
ostruct
pg (~> 1.1)
postmark-rails
pry-rails
puma (>= 6.0)
rack-cors
rails (~> 7.1.3)
rails (~> 7.2.2)
rails-controller-testing
rails_heroicon (~> 2.2.0)
redcarpet (~> 3.6.0)
Expand Down
2 changes: 1 addition & 1 deletion app/models/api_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class APIService < ApplicationRecord

has_many :language_models, -> { not_deleted }

enum driver: %w[ openai anthropic ].index_by(&:to_sym)
enum :driver, %w[ openai anthropic ].index_by(&:to_sym)

validates :url, format: URI::DEFAULT_PARSER.make_regexp(%w[http https]), if: -> { url.present? }
validates :name, :url, presence: true
Expand Down
2 changes: 1 addition & 1 deletion app/models/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Client < ApplicationRecord
has_many :authentications_including_deleted, class_name: "Authentication", inverse_of: :client, dependent: :destroy
scope :authenticated, -> { joins(:authentication).merge(Authentication.not_deleted) }

enum platform: %w[ ios android web api ].index_by(&:to_sym)
enum :platform, %w[ ios android web api ].index_by(&:to_sym)

has_secure_token

Expand Down
2 changes: 1 addition & 1 deletion app/models/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Document < ApplicationRecord
file.variant :large, resize_to_limit: [1200, 900], preprocessed: true
end

enum purpose: %w[fine-tune fine-tune-results assistants assistants_output].index_by(&:to_sym)
enum :purpose, %w[fine-tune fine-tune-results assistants assistants_output].index_by(&:to_sym)

attribute :purpose, default: :assistants

Expand Down
2 changes: 1 addition & 1 deletion app/models/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Message < ApplicationRecord

include Billable

enum role: %w[user assistant tool].index_by(&:to_sym)
enum :role, %w[user assistant tool].index_by(&:to_sym)

delegate :user, to: :conversation

Expand Down
2 changes: 1 addition & 1 deletion app/models/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Run < ApplicationRecord
has_many :steps, dependent: :destroy
has_one :message, dependent: :nullify

enum status: %w[queued in_progress requires_action cancelling cancelled failed completed expired].index_by(&:to_sym)
enum :status, %w[queued in_progress requires_action cancelling cancelled failed completed expired].index_by(&:to_sym)

before_validation :set_model, on: :create
validates :status, :expired_at, :model, :instructions, presence: true
Expand Down
4 changes: 2 additions & 2 deletions app/models/step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ class Step < ApplicationRecord
belongs_to :conversation
belongs_to :run

enum kind: %w[message_creation tool_calls].index_by(&:to_sym)
enum status: %w[in_progress cancelled failed completed expired].index_by(&:to_sym)
enum :kind, %w[message_creation tool_calls].index_by(&:to_sym)
enum :status, %w[in_progress cancelled failed completed expired].index_by(&:to_sym)

validates :kind, :status, presence: true
validates :details, presence: true, allow_blank: true
Expand Down
12 changes: 6 additions & 6 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env sh
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"

if ! gem list rubocop -i --silent; then
echo "Installing rubocop..."
gem install rubocop
fi
# explicit rubocop config increases performance slightly while avoiding config confusion.
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))

bundle exec rubocop --parallel
load Gem.bin_path("rubocop", "rubocop")
Loading

0 comments on commit db435e7

Please sign in to comment.