From 18fe4d0f6fe0075c9acdd0951fe9883511ef8bf0 Mon Sep 17 00:00:00 2001 From: bshand Date: Fri, 10 Jul 2026 13:37:37 +0100 Subject: [PATCH] Back-port support for Rails 8.1, Ruby 4.0 to v2.3 branch (#56) * GitHub Actions: Pin actions to SHA hashes GitHub Actions: Disable Slack notifications Add dependabot checks for GitHub Actions * Bump ruby/setup-ruby from 1.301.0 to 1.305.0 (cf. #46) * Include SECURITY.md file (cf. #49) Update GitHub actions dependencies automatically every 6 months * Bump ruby/setup-ruby from 1.305.0 to 1.310.0 (cf. #52) * Bump actions/checkout from 6.0.2 to 7.0.0 (cf. #53) Support minitest 6 * Bump ruby/setup-ruby from 1.310.0 to 1.315.0 (cf. #54) * Support Rails 8.1, Ruby 4.0. Drop support for Ruby 3.2 (cf. #47) * tag version v2.3.4 --- .github/dependabot.yml | 14 ++++++++ .github/workflows/lint.yml | 6 ++-- .github/workflows/test.yml | 74 +++++++++++++++----------------------- 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_error/version.rb | 2 +- ndr_error.gemspec | 26 ++------------ 12 files changed, 100 insertions(+), 96 deletions(-) create mode 100644 .github/dependabot.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 4380a00..4f9e871 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,13 +9,13 @@ 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.4 + ruby-version: 4.0 - name: Install dependencies run: bundle install - name: Run RuboCop against BASE..HEAD changes diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 291e48d..3027196 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,33 +8,17 @@ 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 - # 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' @@ -46,9 +30,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 @@ -70,28 +54,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/CHANGELOG.md b/CHANGELOG.md index 3efd781..9cb4e3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## [Unreleased] * no unreleased changes +## 2.3.4 / 2026-07-10 +### Fixed +* Support Rails 8.1, Ruby 4.0. Drop support for Ruby 3.2 [backported from v2.4.3] + ## 2.3.3 / 2025-11-24 ### Fixed * Support Ruby 3.4, Rails 8.0 [backported from v2.4.3] 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 085807e..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 50624d7..b3b57e7 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 778829b..b263f6b 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..4b958c0 --- /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_error/version.rb b/lib/ndr_error/version.rb index c7322d6..6f20b34 100644 --- a/lib/ndr_error/version.rb +++ b/lib/ndr_error/version.rb @@ -2,5 +2,5 @@ # Contains the version of NdrError. Sourced by the gemspec. module NdrError - VERSION = '2.3.3' + VERSION = '2.3.4' end diff --git a/ndr_error.gemspec b/ndr_error.gemspec index e13bc77..1b994dc 100644 --- a/ndr_error.gemspec +++ b/ndr_error.gemspec @@ -17,16 +17,11 @@ Gem::Specification.new do |s| s.license = 'MIT' s.files = Dir['{app,config,db,lib}/**/*', 'CHANGELOG.md', 'CODE_OF_CONDUCT.md', - 'MIT-LICENSE', 'Rakefile', 'README.md'] - ['.travis.yml'] + 'MIT-LICENSE', 'Rakefile', 'README.md', 'SECURITY.md'] - s.required_ruby_version = '>= 3.0' + s.required_ruby_version = '>= 3.3' - s.add_dependency 'rails', '>= 6.1', '< 8.1' - - # Support rails 6.1 with Ruby 3.1 - s.add_dependency 'net-imap' - s.add_dependency 'net-pop' - s.add_dependency 'net-smtp' + s.add_dependency 'rails', '>= 7.1', '< 8.2' s.add_dependency 'will_paginate' @@ -35,23 +30,8 @@ Gem::Specification.new do |s| s.add_development_dependency 'pry' s.add_development_dependency 'puma' - # Rails 6.1 and 7.0 do not support sqlite3 2.x; they specify gem "sqlite3", "~> 1.4" - # in lib/active_record/connection_adapters/sqlite3_adapter.rb - # cf. gemfiles/Gemfile.rails70 s.add_development_dependency 'sqlite3' - # Workaround build issue on GitHub Actions with ruby <= 3.1 when installing sass-embedded - # gem version 1.81.0: NoMethodError: undefined method `parse' for # - # https://bugs.ruby-lang.org/issues/19371 - s.add_development_dependency 'psych', '< 5' - - # Workaround build issue on GitHub Actions with ruby <= 3.1 when installing sass-embedded - # Versions 1.77.0 and above require ruby >= 3.2 for packaged x86_64-linux binaries - # but say they're compatible with ruby 3.1. - # 1.76.0 has a bug that was fixed in 1.77.1, which we can't use yet. - # https://github.com/sass/dart-sass/issues/2239 - s.add_development_dependency 'sass-embedded', '~> 1.75.0' if RUBY_VERSION.start_with?('3.1') # rubocop:disable Gemspec/RubyVersionGlobalsUsage - s.add_development_dependency 'mocha' s.add_development_dependency 'test-unit', '~> 3.0'