Skip to content

Commit

Permalink
Merge pull request #355 from openstax/upgrade-ruby-rails
Browse files Browse the repository at this point in the history
Upgrade ruby rails
  • Loading branch information
chrisbendel authored Mar 19, 2024
2 parents f18bc5c + 1eb773c commit 7ad5b55
Show file tree
Hide file tree
Showing 66 changed files with 465 additions and 573 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.5'
ruby-version: '3.3.0'
bundler-cache: true
working-directory: backend

Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
with:
working-directory: frontend
- name: Build and run docker
run: |
docker compose run api bundle exec rake db:migrate
docker compose up -d
run: docker compose up -d
- name: Run migrations
run: docker compose exec api bundle exec rake db:migrate
- name: Wait for api to boot
working-directory: frontend
run: yarn run wait-on http://localhost:4006/api/v1/openapi.json
Expand Down Expand Up @@ -48,24 +48,24 @@ jobs:
path: ./frontend/test-results
- name: Shutdown docker compose
if: always()
run: docker-compose down
run: docker compose down

rspec:
timeout-minutes: 5
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
bundler-cache: true
working-directory: backend

- name: Build docker image and run specs within it
run: |
CI_ENV=`bash <(curl -s https://codecov.io/env)`
API_DOCKERFILE_EXT=.ci docker-compose build
docker-compose run -T -e CI_ENV="$CI_ENV" -e ENABLE_CODECOV=1 -e CI=true api /bin/bash -c "bundle config path vendor/bundle; bundle install; bundle exec rspec"
docker compose build api postgres postgres_test
docker compose run -T api /bin/bash -c "bundle exec rspec"
- name: Stop containers
if: always()
run: docker-compose down
run: docker compose down
34 changes: 16 additions & 18 deletions Dockerfile.heroku
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
FROM ruby:3.0.5 as ruby

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpq-dev postgresql-client \
&& rm -rf /var/lib/apt/lists/* && \
gem install bundler --no-document && \
bundle config set no-cache 'true' && \
bundle config set silence_root_warning 'true' && \
bundle config set --local deployment 'true'

WORKDIR /code/backend

COPY backend/Gemfile Gemfile
COPY backend/Gemfile.lock Gemfile.lock
RUN bundle install

FROM node:20-slim as node

# variables below will be substituted into the JS while building
Expand All @@ -35,7 +18,22 @@ COPY frontend ./

RUN yarn run build

FROM ruby as ruby2
FROM ruby:3.3.0

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpq-dev postgresql-client \
&& rm -rf /var/lib/apt/lists/* && \
gem install bundler --no-document && \
bundle config set no-cache 'true' && \
bundle config set silence_root_warning 'true' && \
bundle config set --local deployment 'true'

WORKDIR /code/backend

COPY backend/Gemfile Gemfile
COPY backend/Gemfile.lock Gemfile.lock
RUN bundle install

ARG SENTRY_DSN
ARG MG_API_KEY
Expand Down
1 change: 0 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
!/log/.keep
!/tmp/.keep

/coverage/*
/storage

/.env
Expand Down
2 changes: 1 addition & 1 deletion backend/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 3.0.5
TargetRubyVersion: 3.3.0
SuggestExtensions: false
NewCops: enable
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion backend/.ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.5
3.3.0
29 changes: 9 additions & 20 deletions backend/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.0.5'
ruby '3.3.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.5'
gem 'rails', '~> 7.1'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 5.0'
gem 'puma'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'
gem 'bootsnap'

# Use Heroku for review apps
gem 'platform-api'
Expand All @@ -27,9 +24,6 @@ gem 'versionist'
# More concise, one-liner logs (better for production)
gem 'lograge'

# Gives 200 OK from /ping
gem 'openstax_healthcheck'

gem 'dotenv-rails'

gem 'qualtrics_api',
Expand All @@ -38,15 +32,12 @@ gem 'qualtrics_api',

gem 'will_paginate', '~> 3.1.7'

gem 'activesupport_cache_database'

gem 'aws-sdk-dynamodb', '~> 1.84.0'
gem 'aws-sdk-s3', '~> 1.116.0'

gem 'httpx', '~> 0.21'
# API versioning and documentation
gem 'openstax_api', '9.4.1'

gem 'openstax_api', '9.6.0'
gem 'openstax_openapi',
github: 'openstax/openapi-rails',
ref: '3aee76409845d6e31ba2fd90a4f1152bc803ccf5'
Expand All @@ -56,7 +47,7 @@ gem 'openstax_auth',
ref: 'ed2d7da86ca226b93376955b9474c4cf115c611f'

# OpenStax Accounts integration
gem 'openstax_accounts', '9.8.0'
gem 'openstax_accounts', '9.9.0'

gem 'mailgun-ruby', '~>1.2.5'

Expand All @@ -72,20 +63,18 @@ gem 'rubyzip', '3.0.0.alpha'

gem 'sssecrets' # for generating api keys

gem 'image_processing', '~> 1.2'
gem 'image_processing'

group :test do
# Code Climate integration
gem 'codecov', require: false
gem 'simplecov', require: false
end

group :development, :test do
gem 'factory_bot_rails'
gem 'faker'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'rspec-rails', '~> 5.0.0'
gem 'rspec-rails'
gem 'rubocop'
gem 'rubocop-rails'
gem 'rubocop-rspec'
Expand Down
Loading

0 comments on commit 7ad5b55

Please sign in to comment.