Skip to content

Commit

Permalink
Upgrade to Rails 7.1 (#585)
Browse files Browse the repository at this point in the history
* Update Ruby version in DockerfileBase to 3.3

* button_to changes

* Load new defaults

* Update deps

* Fixes

* Log background daemon also to stdout for convenience

* Occasionally print the names of running background tasks

* Fixes

* Import fixes

* Small fixes

* Update bundler version

* Dockerfile update

* Update Ruby version to 3.0 in GitHub actions

* Fix factories

* Test fixes

* Belongs to changes

* Fix rest of model specs

* Fix controller specs

* WIP usermanual tests

* Rubocop

* Install chromium in Dockerfile

* Revert "WIP usermanual tests"

This reverts commit abd9f90.

* Test fixes

* Update Docker compose commands in CI workflow

* Stop running spec/usermanual
  • Loading branch information
nygrenh authored Aug 6, 2024
1 parent 4399c1e commit 7c70c08
Show file tree
Hide file tree
Showing 74 changed files with 688 additions and 536 deletions.
60 changes: 18 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
git submodule update --init --recursive
- name: Docker compose build
run: docker-compose build
run: docker compose build
- name: Setup database & test env
run: docker-compose run web bin/rake db:create db:schema:load RAILS_ENV=test
run: docker compose run web bin/rake db:create db:schema:load RAILS_ENV=test
- name: Run spec_v8 tests
run: docker-compose run web bin/spec_v8
run: docker compose run web bin/spec_v8

spec_models:
runs-on: ubuntu-latest
Expand All @@ -36,11 +36,11 @@ jobs:
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
git submodule update --init --recursive
- name: Docker compose build
run: docker-compose build
run: docker compose build
- name: Setup database & test env
run: docker-compose run web bin/rake db:create db:schema:load RAILS_ENV=test
run: docker compose run web bin/rake db:create db:schema:load RAILS_ENV=test
- name: Run spec_models tests
run: docker-compose run web bin/spec_models
run: docker compose run web bin/spec_models

spec_controllers:
runs-on: ubuntu-latest
Expand All @@ -54,11 +54,11 @@ jobs:
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
git submodule update --init --recursive
- name: Docker compose build
run: docker-compose build
run: docker compose build
- name: Setup database & test env
run: docker-compose run web bin/rake db:create db:schema:load RAILS_ENV=test
run: docker compose run web bin/rake db:create db:schema:load RAILS_ENV=test
- name: Run spec_controllers tests
run: docker-compose run web bin/spec_controllers
run: docker compose run web bin/spec_controllers

spec_features:
runs-on: ubuntu-latest
Expand All @@ -72,11 +72,11 @@ jobs:
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
git submodule update --init --recursive
- name: Docker compose build
run: docker-compose build
run: docker compose build
- name: Setup database & test env
run: docker-compose run web bin/rake db:create db:schema:load RAILS_ENV=test
run: docker compose run web bin/rake db:create db:schema:load RAILS_ENV=test
- name: Run spec_features tests
run: docker-compose run web bin/spec_features
run: docker compose run web bin/spec_features

spec_lib:
runs-on: ubuntu-latest
Expand All @@ -90,11 +90,11 @@ jobs:
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
git submodule update --init --recursive
- name: Docker compose build
run: docker-compose build
run: docker compose build
- name: Setup database & test env
run: docker-compose run web bin/rake db:create db:schema:load RAILS_ENV=test
run: docker compose run web bin/rake db:create db:schema:load RAILS_ENV=test
- name: Run spec_lib tests
run: docker-compose run web bin/spec_lib
run: docker compose run web bin/spec_lib

spec_integration:
runs-on: ubuntu-latest
Expand All @@ -108,32 +108,8 @@ jobs:
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
git submodule update --init --recursive
- name: Docker compose build
run: docker-compose build
run: docker compose build
- name: Setup database & test env
run: docker-compose run web bin/rake db:create db:schema:load RAILS_ENV=test
run: docker compose run web bin/rake db:create db:schema:load RAILS_ENV=test
- name: Run spec_integration tests
run: docker-compose run web bin/spec_integration

spec_usermanual:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: false
- name: Setup git submodules
run: |
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
git submodule update --init --recursive
- name: Docker compose build
run: docker-compose build
- name: Setup database & test env
run: docker-compose run web bin/rake db:create db:schema:load RAILS_ENV=test
- name: Run spec_usermanual tests
run: docker-compose run web bin/spec_usermanual
- name: Update manual to testmycode-usermanual
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: doc/usermanual
target-folder: usermanual
run: docker compose run web bin/spec_integration
4 changes: 2 additions & 2 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.6
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 3.0
- name: Cache gems
uses: actions/cache@v1
with:
Expand Down
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM eu.gcr.io/moocfi-public/tmc-server-base:latest
LABEL name tmc-server
LABEL name=tmc-server

RUN apt-get update \
&& apt-get -y install curl gnupg nodejs chromium \
&& rm -rf /var/lib/apt/lists/*

ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install --system --gemfile /app/Gemfile
RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get -y install nodejs
RUN bundle config set path.system true \
&& bundle install --gemfile /app/Gemfile

ADD . /app
2 changes: 1 addition & 1 deletion DockerfileBase
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.6
FROM ruby:3.3
LABEL name tmc-server-base

ENV PHANTOMJS_VERSION 2.1.1
Expand Down
108 changes: 55 additions & 53 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,79 +4,81 @@ source 'https://rubygems.org'
# An alternative when rubygems.org is down
# source 'http://production.cf.rubygems.org/'

gem 'rails', '~> 6.1'
gem 'rails', '~> 7.1', '>= 7.1.3.4'

gem 'activerecord-import', '~> 1.2'
gem 'activerecord-session_store', '~> 2.0'
gem 'argon2', '~> 2.0' # Held back, higher requires Ruby 2.6 from tmc-server-base
gem 'activerecord-import', '~> 1.7'
gem 'activerecord-session_store', '~> 2.1'
gem 'argon2', '~> 2.3'
gem 'bootstrap', '~> 4.6' # Held back to 4.6
gem 'cancancan', '~> 3.3'
gem 'doorkeeper', '~> 5.5'
gem 'doorkeeper-openid_connect'
gem 'file_validators' # Used to validate organization logo
gem 'font-awesome-rails'
gem 'google_drive', '~> 3.0', require: false
gem 'gravtastic', '~> 3.2' # Used to display user avatars
gem 'image_processing' # Used by active_storage to make logo 100x100 on the fly
gem 'logstasher', '~> 2.1'
gem 'natcmp', '~> 1.4'
gem 'newrelic_rpm', '~> 8.0'
gem 'pdfkit', '~> 0.8', require: false
gem 'pg', '~> 1.2'
gem 'pghero', '~> 2.8'
gem 'rack-attack', '~> 6.5', require: false
gem 'rack-cors', '~> 1.1'
gem 'rack-mini-profiler', '~> 2.3'
gem 'rake'
gem 'responders', '~> 3.0'
gem 'cancancan', '~> 3.6', '>= 3.6.1'
gem 'doorkeeper', '~> 5.7', '>= 5.7.1'
gem 'doorkeeper-openid_connect', '~> 1.8', '>= 1.8.9'
gem 'file_validators', '~> 3.0' # Used to validate organization logo
gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.8'
gem 'google_drive', '~> 3.0', '>= 3.0.7', require: false
gem 'gravtastic', '~> 3.2', '>= 3.2.6' # Used to display user avatars
gem 'image_processing', '~> 1.12', '>= 1.12.2' # Used by active_storage to make logo 100x100 on the fly
gem 'logstasher', '~> 2.1', '>= 2.1.5'
gem 'natcmp', '~> 1.4', '>= 1.4.3'
gem 'newrelic_rpm', '~> 9.11'
gem 'pdfkit', '~> 0.8.7.3', require: false
gem 'pg', '~> 1.5', '>= 1.5.6'
gem 'pghero', '~> 3.5'
gem 'rack-attack', '~> 6.7', require: false
gem 'rack-cors', '~> 2.0', '>= 2.0.2'
gem 'rack-mini-profiler', '~> 3.3', '>= 3.3.1'
gem 'rake', '~> 13.2', '>= 13.2.1'
gem 'responders', '~> 3.1', '>= 3.1.1'
gem 'rest-client', '~> 2.1', require: false
gem 'swagger-blocks', '~> 3.0'
gem 'sassc-rails', '~> 2.1'
gem 'xml-simple', '~> 1.1', require: false
gem 'sassc-rails', '~> 2.1', '>= 2.1.2'
gem 'xml-simple', '~> 1.1', '>= 1.1.9', require: false
gem 'cgi', '~> 0.3.6'

gem 'hiredis', '~> 0.6' # Redis for caching
gem 'hiredis', '~> 0.6.3' # Redis for caching
gem 'readthis', '~> 2.2' # Redis for caching
gem 'redis', '~> 4.5' # Redis for caching (TODO: Remove and migrate to rails cache)

group :assets do
gem 'jquery-rails', '~> 4.4'
gem 'sprockets-rails', require: 'sprockets/railtie'
gem 'jquery-rails', '~> 4.6'
gem 'sprockets-rails', '~> 3.5', '>= 3.5.1', require: 'sprockets/railtie'
gem 'uglifier', '~> 4.2'
end

group :development, :test do
gem 'capybara', '~> 3.35'
gem 'factory_bot_rails', '~> 6.2'
gem 'puma', '~> 5.5'
gem 'capybara', '~> 3.40'
gem 'factory_bot_rails', '~> 6.4', '>= 6.4.3'
gem 'puma', '~> 6.4', '>= 6.4.2'
gem 'thin', '~> 1.8', '>= 1.8.2' # A transitive dependency, this forces the latest version
# gem 'passenger', '~> 5.0', require: "phusion_passenger/rack_handler"
gem 'poltergeist', '~> 1.18'
gem 'rspec', '~> 3.10'
gem 'rspec-activemodel-mocks', '~> 1.1'
gem 'rspec-core', '~> 3.10'
gem 'rspec-rails', '~> 5.0'
gem 'rails-controller-testing'
gem 'poltergeist', '~> 1.18', '>= 1.18.1'
gem 'rspec', '~> 3.13'
gem 'rspec-activemodel-mocks', '~> 1.2'
gem 'rspec-core', '~> 3.13'
gem 'rspec-rails', '~> 6.1', '>= 6.1.3'
gem 'rails-controller-testing', '~> 1.0', '>= 1.0.5'
# gem 'selenium-webdriver', '~> 2.44.0'
gem 'irb'
gem 'brakeman', require: false
gem 'bundler-audit'
gem 'pry'
gem 'pry-byebug'
gem 'pry-rails'
gem 'irb', '~> 1.14'
gem 'brakeman', '~> 6.1', '>= 6.1.2', require: false
gem 'bundler-audit', '~> 0.9.1'
gem 'pry', '~> 0.14.2'
gem 'pry-byebug', '~> 3.10', '>= 3.10.1'
gem 'pry-rails', '~> 0.3.11'

gem 'database_cleaner', '~> 2.0'
gem 'launchy' # for capybara's save_and_open_page
gem 'mimic', '~> 0.4'
gem 'railroady' # for doc/diagrams
gem 'rubocop', '~> 1.13', require: false # HoundCI requires 1.5.2
gem 'rubocop-rails_config', '~> 1.5' # Rubocop locked
gem 'ruby-prof', '~> 1.4' # for performance tests
gem 'simplecov', require: false
gem 'database_cleaner', '~> 2.0', '>= 2.0.2'
gem 'launchy', '~> 3.0', '>= 3.0.1' # for capybara's save_and_open_page
gem 'mimic', '~> 0.4.4'
gem 'railroady', '~> 1.6' # for doc/diagrams
gem 'rubocop', '~> 1.65', require: false
gem 'rubocop-rails_config', '~> 1.16' # Rubocop locked
gem 'ruby-prof', '~> 1.7' # for performance tests
gem 'simplecov', '~> 0.22.0', require: false
end

group :development do
gem 'letter_opener', '~> 1.7'
gem 'letter_opener', '~> 1.10'
end

group :test do
gem 'json-schema', '~> 2.8'
gem 'json-schema', '~> 4.3'
end
Loading

0 comments on commit 7c70c08

Please sign in to comment.