Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/future_proof.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
86 changes: 81 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -95,6 +170,7 @@ jobs:
# if: ${{ always() && github.ref == 'refs/heads/master' }}

needs:
- integration_tests
- remaining_tests

runs-on: ubuntu-latest
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.6
3.2.8
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -617,12 +617,12 @@ DEPENDENCIES
sass-rails
simplecov
spring
stringio (= 3.0.1.2)
stringio (= 3.1.1)
terminal-notifier-guard
turbolinks (~> 5.x)
web-console
webpacker
will_paginate

BUNDLED WITH
2.3.27
2.4.19
7 changes: 4 additions & 3 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions config/deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 13 additions & 1 deletion test/integration/create_and_edit_project_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def setup

within('#projects-panel') do
click_button 'New'
assert_text /New$/
click_link 'Project'
end

Expand Down Expand Up @@ -44,6 +45,7 @@ def setup

within('#projects-panel') do
click_button 'New'
assert_text /New$/
click_link 'Project'
end

Expand Down Expand Up @@ -223,6 +225,7 @@ def setup

within('#projects-panel') do
click_button 'New'
assert_text /New$/
click_link 'Project'
end

Expand All @@ -243,6 +246,7 @@ def setup

within('#projects-panel') do
click_button 'New'
assert_text /New$/
click_link 'Project'
end

Expand All @@ -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

Expand All @@ -264,13 +268,15 @@ def setup

within('#projects-panel') do
click_button 'New'
assert_text /New$/
click_link 'Project'
end

fill_in_project_data
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 })
Expand All @@ -287,13 +293,15 @@ def setup

within('#projects-panel') do
click_button 'New'
assert_text /New$/
click_link 'Project'
end

fill_in_project_data
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
Expand Down Expand Up @@ -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'
Expand All @@ -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

Expand All @@ -369,6 +379,7 @@ def setup
visit team_path(@team)
within('#projects-panel') do
click_button 'New'
assert_text /New$/
click_link 'EOI'
end

Expand All @@ -379,6 +390,7 @@ def setup
visit team_path(@team)
within('#projects-panel') do
click_button 'New'
assert_text /New$/
click_link 'EOI'
end

Expand Down
Binary file removed vendor/cache/nokogiri-1.16.8-arm64-darwin.gem
Binary file not shown.
Binary file removed vendor/cache/nokogiri-1.16.8-x86_64-darwin.gem
Binary file not shown.
Binary file removed vendor/cache/nokogiri-1.16.8-x86_64-linux.gem
Binary file not shown.
Binary file removed vendor/cache/nokogiri-1.16.8.gem
Binary file not shown.
Binary file added vendor/cache/nokogiri-1.18.8-arm64-darwin.gem
Binary file not shown.
Binary file added vendor/cache/nokogiri-1.18.8-x86_64-darwin.gem
Binary file not shown.
Binary file added vendor/cache/nokogiri-1.18.8-x86_64-linux-gnu.gem
Binary file not shown.
Binary file added vendor/cache/nokogiri-1.18.8.gem
Binary file not shown.
Binary file removed vendor/cache/stringio-3.0.1.2.gem
Binary file not shown.
Binary file added vendor/cache/stringio-3.1.1.gem
Binary file not shown.
Binary file added vendor/rbenv/cache/ruby-3.2.8.tar.gz
Binary file not shown.
Binary file added vendor/rbenv/rbenv.tar.gz
Binary file not shown.
Binary file added vendor/rbenv/ruby-build.tar.gz
Binary file not shown.
Loading