Skip to content

Commit

Permalink
Dependencies: Rails 7.2 (#701)
Browse files Browse the repository at this point in the history
* chore: upgrade rails to 7.2

* chore: remove raising exception on missing callback actions

* chore: update active_job config to not use good_job for tests

* chore: fix enum deprecations

* chore: fix action mailer config in test

* chore: update asserts for no jobs to ignore turbo jobs

* chore: run migrations and revert change in ruby github action that wasn't running all the tests

* chore: fix flakey test due to Turbo::Streams::BroadcastStreamJob being enqueued

* chore: update cuprite and remove addition to ruby github action

* chore: disable cuprite inspector

* chore: increase capybara timeout

* chore: more attempts at test issues in github actions

* chore: update capybara and cuprite setup

* chore: fix flaky group links test

* chore: use precompiled assets in testing when CI=true

* chore: increase ferrum page load timeout to 75 from 60

* chore: add in FERRUM_GOTO_WAIT in ruby github actions setup and set it to 0.2 default is 0.1

* chore: increase ferrum timeout to 0.5 seconds

* chore: revert changes in axe_helper.rb, modify cuprite timeout to default of 5 seconds, and increase capybara max wait time to 20 seconds

* chore: fix flakey project groups link test

* chore: ran bin/rails app:update and added missing files

* chore: increase cuprite page load timeout to 15 seconds from 5 seconds

* chore: fix flaky groups groups link test

* chore: increase cuprite page load timeout to 30 seconds

* chore: change assert order in test to fix random flakes
  • Loading branch information
ericenns authored Aug 15, 2024
1 parent 6c66172 commit 3f14cf1
Show file tree
Hide file tree
Showing 37 changed files with 488 additions and 358 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: rubocop
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
POSTGRES_PASSWORD: test
POSTGRES_USER: test
POSTGRES_HOST: postgres
FERRUM_GOTO_WAIT: 0.5 # wait 0.5 seconds before checking is network traffic is still pending
ports:
- 5432:5432
# Set health checks to wait until postgres has started
Expand All @@ -29,8 +30,10 @@ jobs:
--health-retries 5
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y curl libjemalloc2 libvips
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -46,9 +49,19 @@ jobs:
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Precompile assets
run: |
bin/rails assets:precompile
- name: Run tests
run: |
bin/rails test:all
- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots
path: ${{ github.workspace }}/tmp/screenshots
if-no-files-found: ignore
- name: Report coverage
if: github.event_name == 'pull_request'
uses: aki77/simplecov-report-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sapporo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
48 changes: 20 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# syntax = docker/dockerfile:1

# docker build -t my-app .
# docker run -d -p 80:80 -p 443:443 --name irida-next -e RAILS_MASTER_KEY=<value from config/master.key> irida-next

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.1
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
FROM docker.io/library/ruby:$RUBY_VERSION-slim as base

# Rails app lives here
WORKDIR /rails

# Install base packages
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Set production environment
ENV RAILS_ENV=production \
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development"
Expand All @@ -19,15 +27,8 @@ FROM base as build

# Install packages needed to build gems and node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
build-essential \
curl \
git \
libpq-dev \
libvips \
node-gyp \
pkg-config \
python-is-python3
apt-get install --no-install-recommends -y build-essential git libpq-dev node-gyp pkg-config python-is-python3 && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Install JavaScript dependencies
ARG NODE_VERSION=20.14.0
Expand Down Expand Up @@ -55,31 +56,22 @@ COPY . .
RUN bundle exec bootsnap precompile app/ lib/

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE=fakekeyforassets ./bin/rails assets:precompile
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile

RUN rm -rf node_modules

# Final stage for app image
FROM base

# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
libvips \
postgresql-client \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Upgrade all packages
RUN apt-get update -qq && \
apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /rails /rails

# Run and own only the runtime files as a non-root user for security
RUN useradd rails --home /rails --shell /bin/bash && \
chown -R rails:rails db log storage tmp private private/pipelines
USER rails:rails
RUN groupadd --system --gid 1000 rails && \
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
chown -R rails:rails db log storage tmp
USER 1000:1000

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
Expand Down
11 changes: 7 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.3.1'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem 'rails', '~> 7.1.3'
gem 'rails', '~> 7.2.0'

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem 'sprockets-rails'
Expand Down Expand Up @@ -36,7 +36,7 @@ gem 'jbuilder'
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
gem 'tzinfo-data', platforms: %i[windows jruby]

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false
Expand Down Expand Up @@ -66,7 +66,7 @@ gem 'view_component', '~> 3.12'
gem 'pagy', '~> 6.1' # omit patch digit

# Ransack
gem 'ransack', '~> 4.1', '>= 4.1.1'
gem 'ransack', '~> 4.2.1'

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"
Expand Down Expand Up @@ -128,7 +128,10 @@ gem 'local_time', '~> 3.0', '>= 3.0.2'

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'debug', platforms: %i[mri mingw x64_mingw]
gem 'debug', platforms: %i[mri windows], require: 'debug/prelude'

# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
gem 'brakeman', require: false
end

group :development do
Expand Down
Loading

0 comments on commit 3f14cf1

Please sign in to comment.