From 23a46cbcd13951721abc446c8f9a97cbbc10a7f2 Mon Sep 17 00:00:00 2001 From: bshand Date: Fri, 10 Jul 2026 13:13:41 +0100 Subject: [PATCH] Back-port support for Rails 8.1, Ruby 4.0 to v4.1 branch (#91) * GitHub Actions: Pin actions to SHA hashes (cf. #79) GitHub Actions: Disable Slack notifications Add dependabot checks for GitHub Actions * Support Rails 8.1, Ruby 4.0 (cf. #80) * Include SECURITY.md file (cf. #85) Update GitHub actions dependencies automatically every 6 months * Bump actions/checkout from 6.0.2 to 7.0.0 (cf. #89) Support minitest 6 * Bump ruby/setup-ruby from 1.301.0 to 1.315.0 (cf. #90) * tag v4.1.4 --- .github/dependabot.yml | 14 +++++++ .github/workflows/lint.yml | 7 ++-- .github/workflows/test.yml | 77 +++++++++++++++----------------------- .travis.yml | 24 ------------ CHANGELOG.md | 4 ++ SECURITY.md | 35 +++++++++++++++++ gemfiles/Gemfile.rails61 | 12 ------ gemfiles/Gemfile.rails70 | 12 ------ gemfiles/Gemfile.rails71 | 3 ++ gemfiles/Gemfile.rails72 | 3 ++ gemfiles/Gemfile.rails81 | 5 +++ lib/ndr_ui/version.rb | 2 +- ndr_ui.gemspec | 16 +++----- test/test_helper.rb | 10 ++--- 14 files changed, 110 insertions(+), 114 deletions(-) create mode 100644 .github/dependabot.yml delete mode 100644 .travis.yml create mode 100644 SECURITY.md delete mode 100644 gemfiles/Gemfile.rails61 delete mode 100644 gemfiles/Gemfile.rails70 create mode 100644 gemfiles/Gemfile.rails81 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b2690c3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "cron" + cronjob: "0 9 1 1,7 *" # Runs every 6 months at 9am on 1 January and 1 July + cooldown: + default-days: 7 # Wait 7 days after publication diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 81c7841..c25f017 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,15 +9,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # actions/checkout@v6 see https://github.com/actions/checkout/releases/tag/v6 with: fetch-depth: 0 # fetch everything - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@0dafeac902942906541bc140009cdbf32665b601 # ruby/setup-ruby@v1 see https://github.com/ruby/setup-ruby/tree/v1 with: - ruby-version: 3.0 + ruby-version: 4.0 - name: Install dependencies run: bundle install - name: Run RuboCop against BASE..HEAD changes run: bundle exec rake rubocop:diff origin/${GITHUB_BASE_REF#*/} - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 11a1025..a3613bd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,35 +8,20 @@ jobs: fail-fast: false matrix: ruby-version: - - '3.0' - - '3.1' - '3.2' - '3.3' - '3.4' + - '4.0' gemfile: - - gemfiles/Gemfile.rails61 - - gemfiles/Gemfile.rails70 - gemfiles/Gemfile.rails71 - gemfiles/Gemfile.rails72 - gemfiles/Gemfile.rails80 + - gemfiles/Gemfile.rails81 exclude: - # rails 6.1 requires ruby < 3.4 - - ruby-version: '3.4' - gemfile: 'gemfiles/Gemfile.rails61' - # rails 7.0 requires ruby >= 2.7, < 3.4 + # rails 8.1 requires ruby >= 3.2 # https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html - - ruby-version: '3.4' - gemfile: 'gemfiles/Gemfile.rails70' - # rails 7.2 requires ruby >= 3.1 - # https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html - - ruby-version: '3.0' - gemfile: 'gemfiles/Gemfile.rails72' - # rails 8.0 requires ruby >= 3.2 - # https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html - - ruby-version: '3.0' - gemfile: 'gemfiles/Gemfile.rails80' - ruby-version: '3.1' - gemfile: 'gemfiles/Gemfile.rails80' + gemfile: 'gemfiles/Gemfile.rails81' name: Ruby ${{ matrix.ruby-version }} / Bundle ${{ matrix.gemfile }} @@ -46,9 +31,9 @@ jobs: BUNDLE_GEMFILE: ${{ matrix.gemfile }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # actions/checkout@v6 see https://github.com/actions/checkout/releases/tag/v6 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@0dafeac902942906541bc140009cdbf32665b601 # ruby/setup-ruby@v1 see https://github.com/ruby/setup-ruby/tree/v1 with: ruby-version: ${{ matrix.ruby-version }} - name: Install dependencies @@ -68,28 +53,28 @@ jobs: if: ${{ needs.test.result != 'success' }} run: exit 1 - notify: - # Run only on master, but regardless of whether tests past: - if: ${{ always() && github.ref == 'refs/heads/master' }} - - needs: test_matrix - - runs-on: ubuntu-latest - - steps: - - uses: 8398a7/action-slack@v3 - with: - status: custom - fields: workflow,commit,author - custom_payload: | - { - channel: 'C7FQWGDHP', - username: 'CI – ' + '${{ github.repository }}'.split('/')[1], - icon_emoji: ':hammer_and_wrench:', - attachments: [{ - color: '${{ needs.test_matrix.result }}' === 'success' ? 'good' : '${{ needs.test_matrix.result }}' === 'failure' ? 'danger' : 'warning', - text: `${process.env.AS_WORKFLOW} against \`${{ github.ref }}\` (${process.env.AS_COMMIT}) for ${{ github.actor }} resulted in *${{ needs.test_matrix.result }}*.` - }] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} +# notify: +# # Run only on master, but regardless of whether tests past: +# if: ${{ always() && github.ref == 'refs/heads/master' }} +# +# needs: test_matrix +# +# runs-on: ubuntu-latest +# +# steps: +# - uses: 8398a7/action-slack@v3 +# with: +# status: custom +# fields: workflow,commit,author +# custom_payload: | +# { +# channel: 'C7FQWGDHP', +# username: 'CI – ' + '${{ github.repository }}'.split('/')[1], +# icon_emoji: ':hammer_and_wrench:', +# attachments: [{ +# color: '${{ needs.test_matrix.result }}' === 'success' ? 'good' : '${{ needs.test_matrix.result }}' === 'failure' ? 'danger' : 'warning', +# text: `${process.env.AS_WORKFLOW} against \`${{ github.ref }}\` (${process.env.AS_COMMIT}) for ${{ github.actor }} resulted in *${{ needs.test_matrix.result }}*.` +# }] +# } +# env: +# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3ab9213..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: ruby -gemfile: -- gemfiles/Gemfile.rails52 -- gemfiles/Gemfile.rails60 -rvm: -- 2.5 -- 2.6 -- 2.7 -- 3.0 -jobs: - exclude: - - rvm: 3.0 - gemfile: gemfiles/Gemfile.rails52 -sudo: false -cache: bundler -before_install: -- gem update --system -- gem install bundler -script: -- bundle exec rake test -notifications: - slack: - rooms: - secure: ksrYmGtnp2oeGntby/qYoMEvrFh53BGTG1IUDbSpFOSgNjsqZxA0n7tvsbYg9030r7IVCtNFDK50RPjNVrKmkfNXK/xOL1D8qf03EJeeWs7OlEKooFfdU7TGnPMQwlnBmWGbe/gSosoq5XFuLYGUJTkNCOtLk1vorRq+r9fy44rnY1IK0EQbmbyiSk2VjZIiLp6SzjE2HxDrjwYNVB4bCVOp0+87lFXBPjLitXCmZ3gHC5Q++jZiJNZEIcwfqgeEIzCcqRc/Y9q6fEP58phL4N4DA10xBnpsn3kxIJFFmuu5D0J5obImTlEqHSLutafnV2vXwcSBuGz5IAXexGFjozgNDXIYEJUQl0vKCIq/4hLf2Ren2M1Rj6FgdS1DzNG9z/ItvJS1UJruniKI7aOinNsOe4hKTXM/Uc93pztHo0w/u7f+qb39xnHtvG+k+KRikrJ/jNMMg6GVgBu7PuL/gp1uyFac+TDyBIwUR3z/tOTwL8y9gDHqnP4col4WoXzcil/he4A1gs1agUFwdxhPTPnEHV5PKd3mZVd8QaZFsTidSVhFkJzxjhPT6OGgCPDhYYsv2S/J4OYEbUbzdRZCPdtS/zQocnGXtC7shQzc2ACRmFFtYdbIqqDzzERhPJGvg2yvzCMgOtNKjUyOge63zMhQZN04cKL5eR7S4kEnaJc= diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ac04c1..c24f154 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## [Unreleased] * no unreleased changes * +## 4.1.4 / 2026-07-10 +### Fixed +* Support Rails 8.1, Ruby 4.0 [backported from v5.0.5] + ## 4.1.3 / 2025-11-07 ### Fixed * Support Ruby 3.4, Rails 8.0 diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..37d6761 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,35 @@ +# Security + +NHS England takes security and the protection of private data extremely seriously. If you believe you have found a vulnerability or other issue which has compromised or could compromise the security of any of our systems and/or private data managed by our systems, please do not hesitate to contact us using the methods outlined below. + +## Table of Contents + +- [Security](#security) + - [Table of Contents](#table-of-contents) + - [Reporting a vulnerability](#reporting-a-vulnerability) + - [Email](#email) + - [NCSC](#ncsc) + - [General Security Enquiries](#general-security-enquiries) + +## Reporting a vulnerability + +Please note, email is our preferred method of receiving reports. + +### Email + +If you wish to notify us of a vulnerability via email, please include detailed information on the nature of the vulnerability and any steps required to reproduce it. + +You can reach us at: + +- [Brian.Shand@nhs.net](mailto:Brian.Shand@nhs.net) +- [cybersecurity@nhs.net](mailto:cybersecurity@nhs.net) + +### NCSC + +You can send your report to the National Cyber Security Centre, who will assess your report and pass it on to NHS England if necessary. + +You can report vulnerabilities here: [https://www.ncsc.gov.uk/information/vulnerability-reporting](https://www.ncsc.gov.uk/information/vulnerability-reporting) + +## General Security Enquiries + +If you have general enquiries regarding our cybersecurity, please reach out to us at [cybersecurity@nhs.net](mailto:cybersecurity@nhs.net) diff --git a/gemfiles/Gemfile.rails61 b/gemfiles/Gemfile.rails61 deleted file mode 100644 index 8fdb206..0000000 --- a/gemfiles/Gemfile.rails61 +++ /dev/null @@ -1,12 +0,0 @@ -source 'https://rubygems.org' - -gemspec path: '..' - -gem 'rails', '~> 6.1.0' - -# Rails 6.1 does not support sqlite3 2.x; it specifies gem "sqlite3", "~> 1.4" -# in lib/active_record/connection_adapters/sqlite3_adapter.rb -gem 'sqlite3', '~> 1.7' - -# Latest concurrent-ruby breaks Rails < 7.1. See https://github.com/rails/rails/issues/54260 -gem 'concurrent-ruby', '1.3.4' diff --git a/gemfiles/Gemfile.rails70 b/gemfiles/Gemfile.rails70 deleted file mode 100644 index a35c58c..0000000 --- a/gemfiles/Gemfile.rails70 +++ /dev/null @@ -1,12 +0,0 @@ -source 'https://rubygems.org' - -gemspec path: '..' - -gem 'rails', '~> 7.0.0' - -# Rails 7.0 does not support sqlite3 2.x; it specifies gem "sqlite3", "~> 1.4" -# in lib/active_record/connection_adapters/sqlite3_adapter.rb -gem 'sqlite3', '~> 1.7' - -# Latest concurrent-ruby breaks Rails < 7.1. See https://github.com/rails/rails/issues/54260 -gem 'concurrent-ruby', '1.3.4' diff --git a/gemfiles/Gemfile.rails71 b/gemfiles/Gemfile.rails71 index 10c4cfc..cf9be01 100644 --- a/gemfiles/Gemfile.rails71 +++ b/gemfiles/Gemfile.rails71 @@ -6,3 +6,6 @@ gem 'rails', '~> 7.1.0' # sqlite3 2.x is not supported on ruby 3.0 gem 'sqlite3', '~> 1.7' + +# Rails <= 8.0 does not support minitest 6 +gem 'minitest', '>= 5.11', '< 6.0' diff --git a/gemfiles/Gemfile.rails72 b/gemfiles/Gemfile.rails72 index 474de75..2da11e6 100644 --- a/gemfiles/Gemfile.rails72 +++ b/gemfiles/Gemfile.rails72 @@ -3,3 +3,6 @@ source 'https://rubygems.org' gemspec path: '..' gem 'rails', '~> 7.2.0' + +# Rails <= 8.0 does not support minitest 6 +gem 'minitest', '>= 5.11', '< 6.0' diff --git a/gemfiles/Gemfile.rails81 b/gemfiles/Gemfile.rails81 new file mode 100644 index 0000000..c268b54 --- /dev/null +++ b/gemfiles/Gemfile.rails81 @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gemspec path: '..' + +gem 'rails', '~> 8.1.0' diff --git a/lib/ndr_ui/version.rb b/lib/ndr_ui/version.rb index f48e4c0..4fdbe97 100644 --- a/lib/ndr_ui/version.rb +++ b/lib/ndr_ui/version.rb @@ -2,5 +2,5 @@ # This stores the current version of the NdrUi gem. Use semantic versioning http://semver.org module NdrUi - VERSION = '4.1.3' + VERSION = '4.1.4' end diff --git a/ndr_ui.gemspec b/ndr_ui.gemspec index f34e74f..6a29c71 100644 --- a/ndr_ui.gemspec +++ b/ndr_ui.gemspec @@ -1,11 +1,8 @@ $LOAD_PATH.push File.expand_path('lib', __dir__) require 'ndr_ui/version' -unless Gem::Version.new(Gem::VERSION) >= Gem::Version.new('3.0.2') - # See https://github.com/rubygems/rubygems/pull/2516 for details - raise 'Please update RubyGems to at least 3.0.2 - lower versions build a broken ndr_ui.gem!' -end - +# We list development dependencies for all Rails versions here. +# Rails version-specific dependencies can go in the relevant Gemfile. # rubocop:disable Gemspec/DevelopmentDependencies Gem::Specification.new do |spec| spec.name = 'ndr_ui' @@ -19,13 +16,13 @@ Gem::Specification.new do |spec| spec.license = 'MIT' spec.files = Dir['{app,config,lib,vendor}/**/*', 'CHANGELOG.md', 'CODE_OF_CONDUCT.md', - 'LICENSE.txt', 'Rakefile', 'README.md'] - ['.travis.yml'] + 'LICENSE.txt', 'Rakefile', 'README.md', 'SECURITY.md'] - spec.required_ruby_version = '>= 3.0.0' + spec.required_ruby_version = '>= 3.2.0' - spec.add_dependency 'rails', '>= 6.1', '< 8.1' spec.add_dependency 'bootstrap-sass', '~> 3.4.1' spec.add_dependency 'jquery-rails', '~> 4.6' + spec.add_dependency 'rails', '>= 7.1', '< 8.2' spec.add_dependency 'sprockets', '>= 4.0' spec.add_dependency 'sprockets-rails', '>= 3.0.0' @@ -34,9 +31,8 @@ Gem::Specification.new do |spec| # cf. gemfiles/Gemfile.rails70 spec.add_development_dependency 'sqlite3' - spec.add_development_dependency 'mocha', '~> 2.0' + spec.add_development_dependency 'mocha', '~> 3.0' spec.add_development_dependency 'ndr_dev_support', '>= 6.0' - spec.add_development_dependency 'net-smtp' spec.add_development_dependency 'pry' spec.add_development_dependency 'puma' spec.add_development_dependency 'rake' diff --git a/test/test_helper.rb b/test/test_helper.rb index fe8b739..ea7b975 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -15,11 +15,11 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } # Load fixtures from the engine -if ActiveSupport::TestCase.respond_to?(:fixture_path=) - ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__) - ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path - ActiveSupport::TestCase.fixtures :all -end +fixtures_dir = File.expand_path('fixtures', __dir__) +ActiveSupport::TestCase.fixture_paths << fixtures_dir # Rails >= 7.1 +ActionDispatch::IntegrationTest.fixture_paths << fixtures_dir +ActiveSupport::TestCase.file_fixture_path = "#{fixtures_dir}/files" +ActiveSupport::TestCase.fixtures :all # Include all capybara + poltergeist config ENV['INTEGRATION_DRIVER'] ||= 'chrome_headless'