Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert ruby 3 upgrade #1161

Merged
merged 2 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/brakeman-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:

# Customize the ruby version depending on your needs
- name: Setup Ruby
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1.82.0
with:
ruby-version: '3.0.2'
ruby-version: '2.7.2'

- name: Setup Brakeman
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Ruby
uses: ruby/[email protected]
with:
ruby-version: 3.0.2
ruby-version: 2.7.2
- name: Install dependencies
run: bundle install
- name: Create mail log file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
uses: ruby/[email protected]
with:
bundler-cache: true
ruby-version: '3.0.2'
ruby-version: '2.7.2'

- name: Set up Node
uses: actions/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: ruby/[email protected]
with:
bundler-cache: true
ruby-version: '3.0.2'
ruby-version: '2.7.2'

- name: Set up Node
uses: actions/[email protected]
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
uses: ruby/[email protected]
with:
bundler-cache: true
ruby-version: '3.0.2'
ruby-version: '2.7.2'

- name: Set up Node
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.2
2.7.2
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# To use or update to a ruby version, change {BASE_RUBY_IMAGE}
ARG BASE_RUBY_IMAGE=ruby:3.0.2-alpine3.14
ARG BASE_RUBY_IMAGE=ruby:2.7.2-alpine
# BASE_RUBY_IMAGE_WITH_GEMS_AND_NODE_MODULES will default to early-careers-framework-gems-node-modules
# building all layers above it if a value is not specidied during the build
ARG BASE_RUBY_IMAGE_WITH_GEMS_AND_NODE_MODULES=early-careers-framework-gems-node-modules

# Stage 1: Download gems and node modules.
FROM ${BASE_RUBY_IMAGE} AS builder

ARG BUILD_DEPS="git gcc libc-dev make nodejs yarn postgresql-dev build-base libxml2-dev libxslt-dev ttf-freefont"
ARG BUILD_DEPS="git gcc libc-dev make nodejs yarn postgresql-dev build-base libxml2-dev libxslt-dev ttf-ubuntu-font-family"

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# To use or update to a ruby version, change {BASE_RUBY_IMAGE}
ARG BASE_RUBY_IMAGE=ruby:3.0.2-alpine3.14
ARG BASE_RUBY_IMAGE=ruby:2.7.2-alpine
# BASE_RUBY_IMAGE_WITH_GEMS_AND_NODE_MODULES will default to early-careers-framework-gems-node-modules
# building all layers above it if a value is not specidied during the build
ARG BASE_RUBY_IMAGE_WITH_GEMS_AND_NODE_MODULES=early-careers-framework-gems-node-modules
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

### Prerequisites

- Ruby 3.0.2
- Ruby 2.7.2
- PostgreSQL (we deploy on 11.x)
- NodeJS 14.16.0
- Yarn 1.12.x
Expand Down
2 changes: 1 addition & 1 deletion app/forms/participants/participant_validation_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ParticipantValidationForm
include ActiveModel::Model

# lifted from https://github.com/dwp/nino-format-validation
NINO_REGEX = /(^(?!BG)(?!GB)(?!NK)(?!KN)(?!TN)(?!NT)(?!ZZ)[A-Z&&[^DFIQUV]][A-Z&&[^DFIOQUV]][0-9]{6}[A-D]$)/
NINO_REGEX = /(^(?!BG)(?!GB)(?!NK)(?!KN)(?!TN)(?!NT)(?!ZZ)[A-Z&&[^DFIQUV]][A-Z&&[^DFIOQUV]][0-9]{6}[A-D]$)/.freeze
attr_accessor :step,
:do_you_want_to_add_mentor_information_choice,
:do_you_know_your_trn_choice,
Expand Down
5 changes: 2 additions & 3 deletions app/services/invite_schools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ def run(school_urns)
end

def reached_limit(school)
EMAIL_LIMITS.find do |args|
args => { max:, within: }
NominationEmail.where(school: school, sent_at: within.ago..Float::INFINITY).count >= max
EMAIL_LIMITS.find do |**kwargs|
NominationEmail.where(school: school, sent_at: kwargs[:within].ago..Float::INFINITY).count >= kwargs[:max]
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/services/record_declarations/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Base
implement_class_method :required_params, :valid_declaration_types
implement_instance_method :user_profile

RFC3339_DATE_REGEX = /\A\d{4}-\d{2}-\d{2}T(\d{2}):(\d{2}):(\d{2})([.,]\d+)?(Z|[+-](\d{2})(:?\d{2})?)?\z/i
RFC3339_DATE_REGEX = /\A\d{4}-\d{2}-\d{2}T(\d{2}):(\d{2}):(\d{2})([.,]\d+)?(Z|[+-](\d{2})(:?\d{2})?)?\z/i.freeze

attr_accessor :declaration_date, :declaration_type

Expand Down
6 changes: 3 additions & 3 deletions app/validators/notify_email_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# Notify email validation https://github.com/alphagov/notifications-utils/blob/acbe764fb7f12c7a8b0696156283fbcb5073fcd7/notifications_utils/recipients.py#L494
class NotifyEmailValidator < ActiveModel::EachValidator
HOSTNAME_PART_REGEX = /\A(xn|[a-z0-9]+)(-?-[a-z0-9]+)*\z/i
TLD_REGEX = /\A([a-z]{2,63}|xn--([a-z0-9]+-)*[a-z0-9]+)\z/i
EMAIL_REGEX = /\A[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~\\-]+@([^.@][^@\s]+)\z/
HOSTNAME_PART_REGEX = /\A(xn|[a-z0-9]+)(-?-[a-z0-9]+)*\z/i.freeze
TLD_REGEX = /\A([a-z]{2,63}|xn--([a-z0-9]+-)*[a-z0-9]+)\z/i.freeze
EMAIL_REGEX = /\A[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~\\-]+@([^.@][^@\s]+)\z/.freeze

def validate_each(record, attribute, value)
record.errors.add(attribute, I18n.t("errors.email.invalid")) unless NotifyEmailValidator.valid?(value)
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/school_urn_generator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

ALL_URNS = (1..999_999) unless defined?(ALL_URNS)
ALL_URNS = (1..999_999).freeze unless defined?(ALL_URNS)

class SchoolURNGenerator
class << self
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/trn_generator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

ALL_TRNS = (1111..9_999_999) unless defined?(ALL_TRNS)
ALL_TRNS = (1111..9_999_999).freeze unless defined?(ALL_TRNS)

class TRNGenerator
class << self
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/valid_test_data_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def weighted_choice(selection:, odds:)

class AmbitionSpecificPopulater < LeadProviderPopulater
class << self
FIRST_AMBITION_SEED_DATA_TIME = ("2021-08-18 13:43".."2021-08-18 13:49")
FIRST_AMBITION_SEED_DATA_TIME = ("2021-08-18 13:43".."2021-08-18 13:49").freeze

def call(name:, total_schools: 3, participants_per_school: 3000)
generator = new(name: name)
Expand Down