diff --git a/.github/workflows/future_proof.yml b/.github/workflows/future_proof.yml index 60c08d9a..a3b3370e 100644 --- a/.github/workflows/future_proof.yml +++ b/.github/workflows/future_proof.yml @@ -17,8 +17,8 @@ jobs: fail-fast: false matrix: ruby-version: - - '3.1' # Latest ruby 3.1.x - '3.2' # Latest ruby 3.2.x + - '3.3' # Latest ruby 3.3.x name: "Ruby ${{ matrix.ruby-version }} Smoke Tests" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a3984e3d..bdb4bcd4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,19 +11,94 @@ permissions: actions: read jobs: - remaining_test_matrix: + integration_test_matrix: strategy: fail-fast: false matrix: ruby-version: - - '3.1.6' + - '3.2.8' test-group: - "[a-b]" - "[c]" - "[d-m]" - "[n-z]" - name: "Ruby ${{ matrix.ruby-version }} Tests (${{ matrix.test-group }})" + name: "Ruby ${{ matrix.ruby-version }} Integration Tests (${{ matrix.test-group }})" + + runs-on: ubuntu-latest + + services: + postgres: + image: postgres + env: + POSTGRES_USER: rails + POSTGRES_PASSWORD: rails_password + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + --name postgres + ports: + - 5432:5432 + + env: + DB_HOST: localhost + DB_PORT: 5432 + DB_USERNAME: rails + DB_PASSWORD: rails_password + + # Prep the whole stack in test-only mode: + RAILS_ENV: test + + steps: + - uses: actions/checkout@v3 + - name: Set timezone to Europe/London + run: sudo timedatectl set-timezone Europe/London + - name: Use bundled npm files + run: printf 'disable-self-update-check true\nyarn-offline-mirror "./vendor/npm-packages-offline-cache"\nyarn-offline-mirror-pruning false\n' > .yarnrc + - name: Set up Ruby + Bundle + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: ${{ matrix.ruby-version }} + - name: Inject configuration + run: cp config/database.yml{.ci,} + - name: Prepare the database + run: bin/rails db:setup + - name: Precompile assets + # Since ruby/setup-ruby@v1 moved to Node.js v18 we need the extra options + # until we move to newer webpacker / stop using it. + # I've tried using a newer hash function in config/webpack/environment.js + # by adding the following line, but this didn't help with github actions + # # environment.config.set('output.hashFunction', 'sha256') + # https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported/73465262#73465262 + run: NODE_OPTIONS=--openssl-legacy-provider bin/rails yarn:install assets:clobber assets:precompile + - name: Run tests + run: PARALLEL_WORKERS=1 bin/rails test 'test/integration/**/${{ matrix.test-group }}*_test.rb' + + # A utility job upon which Branch Protection can depend, + # thus remaining agnostic of the matrix. + integration_tests: + if: ${{ always() }} + runs-on: ubuntu-latest + # name: Matrix + needs: integration_test_matrix + steps: + - name: Check build matrix status + if: ${{ needs.integration_test_matrix.result != 'success' }} + run: exit 1 + + remaining_test_matrix: + strategy: + fail-fast: false + matrix: + ruby-version: + - '3.2.8' + test-group: + - "[a-z]" + + name: "Ruby ${{ matrix.ruby-version }} Remaining Tests (${{ matrix.test-group }})" runs-on: ubuntu-latest @@ -75,7 +150,7 @@ jobs: # https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported/73465262#73465262 run: NODE_OPTIONS=--openssl-legacy-provider bin/rails yarn:install assets:clobber assets:precompile - name: Run tests - run: PARALLEL_WORKERS=1 bin/rails test 'test/**/${{ matrix.test-group }}*_test.rb' + run: PARALLEL_WORKERS=1 bin/rails test 'test/{builders,controllers,facades,helpers,lib,mailers,models,notifiers,services,validators}/**/${{ matrix.test-group }}*_test.rb' # A utility job upon which Branch Protection can depend, # thus remaining agnostic of the matrix. @@ -95,6 +170,7 @@ jobs: # if: ${{ always() && github.ref == 'refs/heads/master' }} needs: + - integration_tests - remaining_tests runs-on: ubuntu-latest @@ -108,7 +184,7 @@ jobs: COMMIT_MESSAGE: ${{ github.event.commits[0].message }} run: |- node -e " - const passed = '${{ needs.integration_tests.result }}' === 'success' && '${{ needs.models_tests.result }}' === 'success' && '${{ needs.remaining_tests.result }}' === 'success' + const passed = '${{ needs.integration_tests.result }}' === 'success' && '${{ needs.remaining_tests.result }}' === 'success' const text = process.env.COMMIT_MESSAGE diff --git a/.ruby-version b/.ruby-version index 9cec7165..f092941a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.6 +3.2.8 diff --git a/Gemfile b/Gemfile index c0b0dba9..8f043ac1 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ gem 'concurrent-ruby', '1.3.4' # so that we can continue to use aliases in config/locales/en.yml # cf. https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias gem 'psych', '4.0.4' # Exactly match the version on Ruby 3.1 -gem 'stringio', '3.0.1.2' # psych dependency: exactly match the version on Ruby 3.1 +gem 'stringio', '3.1.1' # psych dependency: exactly match the default version on Ruby 3.3 # Use postgresql as the database for Active Record gem 'pg', '~> 1.4.6' # All client instance have postgres version >= 9.3 diff --git a/Gemfile.lock b/Gemfile.lock index f2f412fe..167634ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -338,14 +338,14 @@ GEM net-ssh-gateway (2.0.0) net-ssh (>= 4.0.0) nio4r (2.7.4) - nokogiri (1.16.8) + nokogiri (1.18.8) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.8-arm64-darwin) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86_64-darwin) + nokogiri (1.18.8-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86_64-linux) + nokogiri (1.18.8-x86_64-linux-gnu) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) @@ -515,7 +515,7 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - stringio (3.0.1.2) + stringio (3.1.1) terminal-notifier-guard (1.7.0) test-unit (3.6.2) power_assert @@ -617,7 +617,7 @@ DEPENDENCIES sass-rails simplecov spring - stringio (= 3.0.1.2) + stringio (= 3.1.1) terminal-notifier-guard turbolinks (~> 5.x) web-console @@ -625,4 +625,4 @@ DEPENDENCIES will_paginate BUNDLED WITH - 2.3.27 + 2.4.19 diff --git a/config/deploy.rb b/config/deploy.rb index 4f51f762..a6c6055e 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -18,13 +18,14 @@ set :delayed_job_command, 'bin/delayed_job' # set :delayed_job_args, '-n 1' -if Resolv.getaddresses('ndr-svn.phe.gov.uk').any? +# look for open ports locally instead of checking the DNS +if system("lsof -F n -n -P -a -i TCP@localhost:4142 -sTCP:LISTEN", out: '/dev/null') # Use private repository for some configuration files - set :secondary_repo, 'https://ndr-svn.phe.gov.uk/svn/non-era/mbis' + set :secondary_repo, 'https://localhost:4142/svn/non-era/mbis' # Private repository for encrypted credentials # TODO: Add support for per-deployment encrypted credentials to ndr_dev_support set :credentials_repo, - 'https://ndr-svn.phe.gov.uk/svn/encrypted-credentials-store/mbis_front/base' + 'https://localhost:4142/svn/encrypted-credentials-store/mbis_front/base' else # For off-premise deployments, configuration will be provided to the startup script # in Base64-encoded environment variables. diff --git a/config/deployments.yml b/config/deployments.yml index 842647bb..9a145de6 100644 --- a/config/deployments.yml +++ b/config/deployments.yml @@ -4,7 +4,7 @@ --- beta: branch: 'main' - ruby: 3.1.6 + ruby: 3.2.8 live: branch: 'main' - ruby: 3.1.6 + ruby: 3.2.8 diff --git a/test/integration/create_and_edit_project_test.rb b/test/integration/create_and_edit_project_test.rb index 58a5b8f9..fda80ae2 100644 --- a/test/integration/create_and_edit_project_test.rb +++ b/test/integration/create_and_edit_project_test.rb @@ -12,6 +12,7 @@ def setup within('#projects-panel') do click_button 'New' + assert_text /New$/ click_link 'Project' end @@ -44,6 +45,7 @@ def setup within('#projects-panel') do click_button 'New' + assert_text /New$/ click_link 'Project' end @@ -223,6 +225,7 @@ def setup within('#projects-panel') do click_button 'New' + assert_text /New$/ click_link 'Project' end @@ -243,6 +246,7 @@ def setup within('#projects-panel') do click_button 'New' + assert_text /New$/ click_link 'Project' end @@ -251,9 +255,9 @@ def setup select 'Another User', from: 'project_owner_grant_attributes_user_id' assert_difference('Grant.count', 1) do click_button 'Save' + assert_text('Project was successfully created') end project = Project.find_by(name: 'user creating is project owner') - assert page.has_content?('Project was successfully created') assert project.grants.first.roleable == ProjectRole.fetch(:owner) end @@ -264,6 +268,7 @@ def setup within('#projects-panel') do click_button 'New' + assert_text /New$/ click_link 'Project' end @@ -271,6 +276,7 @@ def setup fill_in 'project_name', with: 'user is creating project for another user' assert_difference('Grant.count', 2) do click_button 'Save' + assert_text 'Project was successfully created' end project = Project.find_by(name: 'user is creating project for another user') assert_equal 1, (project.grants.count { |g| g.roleable == owner_role }) @@ -287,6 +293,7 @@ def setup within('#projects-panel') do click_button 'New' + assert_text /New$/ click_link 'Project' end @@ -294,6 +301,7 @@ def setup fill_in 'project_name', with: 'created for someone else in team' assert_difference('Grant.count', 2) do click_button 'Save' + assert_text 'Project was successfully created' end project = Project.find_by(name: 'created for someone else in team') owner_grant_id = project.owner_grant.id @@ -329,6 +337,7 @@ def setup within('#projects-panel') do click_button 'New' + assert_text /New$/ click_link 'Project' end fill_in 'project_name', with: 'Dataset Project Test' @@ -344,6 +353,7 @@ def setup new_li.find('div.remove_record').click assert_difference('ProjectDataset.count', 1) do click_button 'Save' + assert_text 'Project was successfully created' end end @@ -369,6 +379,7 @@ def setup visit team_path(@team) within('#projects-panel') do click_button 'New' + assert_text /New$/ click_link 'EOI' end @@ -379,6 +390,7 @@ def setup visit team_path(@team) within('#projects-panel') do click_button 'New' + assert_text /New$/ click_link 'EOI' end diff --git a/vendor/cache/nokogiri-1.16.8-arm64-darwin.gem b/vendor/cache/nokogiri-1.16.8-arm64-darwin.gem deleted file mode 100644 index 338bafb5..00000000 Binary files a/vendor/cache/nokogiri-1.16.8-arm64-darwin.gem and /dev/null differ diff --git a/vendor/cache/nokogiri-1.16.8-x86_64-darwin.gem b/vendor/cache/nokogiri-1.16.8-x86_64-darwin.gem deleted file mode 100644 index a737ba5e..00000000 Binary files a/vendor/cache/nokogiri-1.16.8-x86_64-darwin.gem and /dev/null differ diff --git a/vendor/cache/nokogiri-1.16.8-x86_64-linux.gem b/vendor/cache/nokogiri-1.16.8-x86_64-linux.gem deleted file mode 100644 index 128b7212..00000000 Binary files a/vendor/cache/nokogiri-1.16.8-x86_64-linux.gem and /dev/null differ diff --git a/vendor/cache/nokogiri-1.16.8.gem b/vendor/cache/nokogiri-1.16.8.gem deleted file mode 100644 index 30e24049..00000000 Binary files a/vendor/cache/nokogiri-1.16.8.gem and /dev/null differ diff --git a/vendor/cache/nokogiri-1.18.8-arm64-darwin.gem b/vendor/cache/nokogiri-1.18.8-arm64-darwin.gem new file mode 100644 index 00000000..85f6f455 Binary files /dev/null and b/vendor/cache/nokogiri-1.18.8-arm64-darwin.gem differ diff --git a/vendor/cache/nokogiri-1.18.8-x86_64-darwin.gem b/vendor/cache/nokogiri-1.18.8-x86_64-darwin.gem new file mode 100644 index 00000000..0dd9f0eb Binary files /dev/null and b/vendor/cache/nokogiri-1.18.8-x86_64-darwin.gem differ diff --git a/vendor/cache/nokogiri-1.18.8-x86_64-linux-gnu.gem b/vendor/cache/nokogiri-1.18.8-x86_64-linux-gnu.gem new file mode 100644 index 00000000..73db7f3c Binary files /dev/null and b/vendor/cache/nokogiri-1.18.8-x86_64-linux-gnu.gem differ diff --git a/vendor/cache/nokogiri-1.18.8.gem b/vendor/cache/nokogiri-1.18.8.gem new file mode 100644 index 00000000..7d815624 Binary files /dev/null and b/vendor/cache/nokogiri-1.18.8.gem differ diff --git a/vendor/cache/stringio-3.0.1.2.gem b/vendor/cache/stringio-3.0.1.2.gem deleted file mode 100644 index 12908b7c..00000000 Binary files a/vendor/cache/stringio-3.0.1.2.gem and /dev/null differ diff --git a/vendor/cache/stringio-3.1.1.gem b/vendor/cache/stringio-3.1.1.gem new file mode 100644 index 00000000..48ed60e7 Binary files /dev/null and b/vendor/cache/stringio-3.1.1.gem differ diff --git a/vendor/rbenv/cache/ruby-3.2.8.tar.gz b/vendor/rbenv/cache/ruby-3.2.8.tar.gz new file mode 100644 index 00000000..6fdc990e Binary files /dev/null and b/vendor/rbenv/cache/ruby-3.2.8.tar.gz differ diff --git a/vendor/rbenv/rbenv.tar.gz b/vendor/rbenv/rbenv.tar.gz new file mode 100644 index 00000000..1e1f6cd8 Binary files /dev/null and b/vendor/rbenv/rbenv.tar.gz differ diff --git a/vendor/rbenv/ruby-build.tar.gz b/vendor/rbenv/ruby-build.tar.gz new file mode 100644 index 00000000..db626ed4 Binary files /dev/null and b/vendor/rbenv/ruby-build.tar.gz differ