Skip to content

Commit

Permalink
Merge pull request #160 from dxw/chore/drop-ruby-2-and-rails-5-int-te…
Browse files Browse the repository at this point in the history
…sting

Drop integration tests for Ruby 2 and Rails 5
  • Loading branch information
mec authored Aug 23, 2024
2 parents 8524dcf + 0f1f10d commit fe2cc63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/rails-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ jobs:
outputs:
RAILS_VERSIONS: ${{ steps.compute-outputs.outputs.RAILS_VERSIONS }}
steps:
# Get latest Rails versions for 5.x.x, 6.x.x and 7.x.x
# Get latest Rails versions for 6.x.x and 7.x.x
- id: compute-outputs
name: Compute outputs
# fetches current Rails versions numbers > 5 and not 'beta'
run: |
rails_versions=$(curl https://rubygems.org/api/v1/versions/rails.json | jq 'group_by(.number[:1])[] | (.[0].number) | select(.[:1]|tonumber > 4)' | jq -s -c)
rails_versions=$(curl https://rubygems.org/api/v1/versions/rails.json | jq '[.[] | select(.number | test("beta") | not)] | group_by(.number[:1])[] | (.[0].number) | select(.[:1]|tonumber > 5)' | jq -s -c)
echo "RAILS_VERSIONS=$rails_versions" >> $GITHUB_OUTPUT
build-rails:
strategy:
fail-fast: false
matrix:
# Build containers with the latest 5.x.x, 6.x.x and 7.x.x Rails versions
# Build containers with the latest 6.x.x and 7.x.x Rails versions
rails: ${{ fromJSON(needs.set-matrix.outputs.RAILS_VERSIONS) }}
runs-on: ubuntu-latest
name: Build and cache Docker containers
Expand Down Expand Up @@ -54,7 +55,7 @@ jobs:
mailer-previews:
strategy:
fail-fast: false
# Run against the latest 5.x.x, 6.x.x and 7.x.x Rails versions
# Run against the latest 6.x.x and 7.x.x Rails versions
matrix:
rails: ${{ fromJSON(needs.set-matrix.outputs.RAILS_VERSIONS) }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -114,4 +115,4 @@ jobs:
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
}}
17 changes: 5 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
# We want to support older Rubies
ARG RUBY_VERSION=2.7.8
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
ARG RUBY_VERSION=3.1.6
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base

# Rails app lives here
WORKDIR /rails

# Build stage
FROM base as build
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

# Install Nokigiri version that supports Ruby 2.7.8
RUN gem install nokogiri -v 1.15.6

# Install Rails
ARG RAILS_VERSION=7.1.3.2
ARG RAILS_VERSION=7.2.1
RUN gem install rails -v ${RAILS_VERSION}

# create empty Rails application, we don't need ActiveRecord or JavaScript
Expand All @@ -27,9 +23,6 @@ WORKDIR mail-notify-integration
# install the gems into the bundle
RUN bundle install

# remove gems that will not work in Rails 5.2.8.1
RUN if [ "${RAILS_VERSION}" = "5.2.8.1" ]; then bundle remove selenium-webdriver chromedriver-helper; fi

# Final stage for app image
FROM base

Expand All @@ -45,7 +38,7 @@ COPY --from=build /rails /rails
WORKDIR /rails/mail-notify-integration

# add Mail Notify to the Gemfile
ARG MAIL_NOTIFY_BRANCH=v2
ARG MAIL_NOTIFY_BRANCH=2.0.0
RUN echo "gem 'mail-notify', git: 'https://github.com/dxw/mail-notify', branch: '${MAIL_NOTIFY_BRANCH}'" >> Gemfile

# install the mail-notify gem, we do this here to keep the last container layer small to help caching
Expand Down

0 comments on commit fe2cc63

Please sign in to comment.