Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into allow_submission_f…
Browse files Browse the repository at this point in the history
…rom_stock_plate_test_branch
  • Loading branch information
dasunpubudumal committed Oct 15, 2024
2 parents 4475244 + 81b25ef commit 2bccb4d
Show file tree
Hide file tree
Showing 229 changed files with 2,159 additions and 1,996 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/automated_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ jobs:
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

# Actually run our build
- name: Create Build
run: ./compile-build

# Create a release tag based on the branch name and .release-version file
- name: Set release tag
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
# On the develop branch this might create RELEASE_VERSION=2.4.6-987654321-develop
# On the master branch this would then only create RELEASE_VERSION=2.4.6
run: echo "RELEASE_VERSION=$(printf -- '%s%s\n' $(cat .release-version) $([ ${BRANCH_NAME} = "develop" ] && printf -- '-%s-develop' ${GITHUB_RUN_ID} || echo ""))" >> $GITHUB_ENV

# Actually run our build
- name: Create Build
run: ./compile-build '' v${{ env.RELEASE_VERSION }} ${BRANCH_NAME}

# Create a GitHub release with the release asset as an artifact
- name: Create release and upload release.tar.gz
uses: ncipollo/[email protected]
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/check_release_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@ on:
pull_request:
branches:
- master
types:
# defaults
- opened
- synchronize
- reopened
# custom
- ready_for_review # required for Github-created PRs

jobs:
check:
runs-on: ubuntu-latest
# only run when PR is not draft
if: ${{ !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v4

Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/create_release_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Create or update merge-to-master pull requests for production releases
# Note that by design, creating or editing a PR will not trigger a downstream `pull_request` event as this could lead to recursion
name: Release
on:
push:
branches:
- develop
jobs:
pull_request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create or update PR
env:
GH_TOKEN: ${{ github.token }}
run: |
PR_TITLE="[automated] Merge Develop into Master"
# Extract numbers from PRs that have been merged into develop
PR_NUMBERS=$(gh api repos/:owner/:repo/compare/master...develop --jq '
.commits[]
| select(.commit.message
| startswith("Merge pull request"))
| .commit.message
| capture("#(?<pr_number>\\d+)")
| .pr_number'
)
# Fetch titles for each PR number
PR_NUMBERS_AND_TITLES=$(for PR_NUMBER in $PR_NUMBERS; do
gh pr view $PR_NUMBER --json number,title --jq '{number: .number, title: .title}'
done | jq -s 'sort_by(.title)')
# Sort extracted PR numbers by title
SORTED_PR_NUMBERS=$(jq -r '.[].number' <<< "$PR_NUMBERS_AND_TITLES")
STORIES=$(xargs -I {} gh pr view {} --json body --jq '.body | if . | test("Closes #\\d+") then capture("Closes #(?<issue_number>\\d+)") | "- #{}
- Closes #" + .issue_number else "- #{}" end' <<< "$SORTED_PR_NUMBERS") # Note the line-break on this line is for formatting
PR_BODY="#### Changes proposed in this pull request
$(echo "$STORIES")
#### Instructions for Reviewers
- _Check stories are ready for release._
- _Check for any database migrations._
- _Check for debug code._
- _Check version is appropriate._
This description will be overwritten on the next push
This PR was auto-generated on $(TZ=Europe/London date --iso-8601=seconds)"
# Check if a PR already exists
EXISTING_PR=$(gh pr list --base master --head develop --json number --jq '.[0].number')
if [ -z "$EXISTING_PR" ]; then
gh pr create --base master --head develop --title "$PR_TITLE" --body "$PR_BODY" --draft
else
gh pr edit "$EXISTING_PR" --body "$PR_BODY"
fi
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public/stylesheets/*.css
.sass-cache/
*.orig
*.sublime-workspace
/bin
/public/packs
/public/packs-test
/node_modules
Expand Down
4 changes: 3 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"printWidth": 120,
"semi": false,
"singleQuote": true
"rubySingleQuote": true,
"singleQuote": true,
"plugins": ["@prettier/plugin-ruby"]
}
7 changes: 7 additions & 0 deletions .pryrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true
if defined?(PryByebug)
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 'f', 'finish'
Pry.commands.alias_command 'c', 'continue'
end
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.60.0
3.61.1
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Rails/FindBy:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false

# Only use shorthand hash syntax when all keys match the variables for better readability
Style/HashSyntax:
EnforcedShorthandSyntax: consistent

# Filter out all the DSLs
Metrics/BlockLength:
CountAsOne:
Expand Down
51 changes: 43 additions & 8 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,52 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-10-17 14:45:52 UTC using RuboCop version 1.39.0.
# `rubocop --auto-gen-config --no-exclude-limit`
# on 2024-09-20 10:20:24 UTC using RuboCop version 1.65.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 7
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/MethodLength:
Max: 21

# Offense count: 2
# Configuration parameters: LengthThreshold.
Metrics/CollectionLiteralLength:
Exclude:
- 'spec/models/labware_creators/quadrant_split_plate_spec.rb'
- 'spec/helpers/well_helpers_spec.rb'
- 'spec/models/labware_creators/quadrant_split_plate_spec.rb'

# Offense count: 36
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Exclude:
- 'app/controllers/labware_controller.rb'
- 'app/controllers/pipeline_work_in_progress_controller.rb'
- 'app/controllers/plates_controller.rb'
- 'app/helpers/plate_helper.rb'
- 'app/models/concerns/labware_creators/donor_pooling_calculator.rb'
- 'app/models/concerns/presenters/extended_csv.rb'
- 'app/models/concerns/presenters/statemachine.rb'
- 'app/models/labware_creators/custom_tagged_plate.rb'
- 'app/models/labware_creators/final_tube.rb'
- 'app/models/labware_creators/multi_stamp_tubes.rb'
- 'app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb'
- 'app/models/labware_creators/pcr_cycles_binned_plate/csv_file/well_details_header_base.rb'
- 'app/models/labware_creators/pcr_cycles_binned_plate_for_t_nano_seq.rb'
- 'app/models/labware_creators/plate_split_to_tube_racks.rb'
- 'app/models/labware_creators/stamped_plate_adding_randomised_controls.rb'
- 'app/models/labware_creators/well_filter_allowing_partials.rb'
- 'app/models/pipeline_list.rb'
- 'app/models/print_job.rb'
- 'app/models/robots/splitting_robot.rb'
- 'app/models/sequencescape_submission.rb'
- 'app/models/utility/common_dilution_calculations.rb'
- 'app/models/utility/concentration_binning_calculator.rb'
- 'app/models/utility/normalised_binning_calculator.rb'
- 'app/models/validators/stock_state_validator.rb'
- 'config/initializers/settings.rb'
- 'spec/support/api_url_helper.rb'
- 'spec/support/factory_bot_extensions.rb'
- 'spec/support/feature_helpers.rb'
- 'spec/support/with_pmb_stubbed.rb'

Style/NumericPredicate:
Exclude:
- 'lib/deployed_version.rb'
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.6
3.2.5
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.0.6-slim
FROM ruby:3.2.5-slim

ARG bundlerWithout="development test lint"
ARG yarnFlags="--production"
Expand Down
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@ group :lint do
gem 'rubocop', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false

# Ruby dependencies specifically requested by prettier/plugin-ruby v4
# https://github.com/prettier/plugin-ruby
gem 'prettier_print', require: false
gem 'syntax_tree', require: false
gem 'syntax_tree-haml', require: false
gem 'syntax_tree-rbs', require: false
end
27 changes: 25 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ GEM
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
haml (6.3.0)
temple (>= 0.8.2)
thor
tilt
hashdiff (1.1.0)
hashie (5.0.0)
i18n (1.14.5)
Expand Down Expand Up @@ -247,6 +251,7 @@ GEM
parser (3.3.4.0)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand Down Expand Up @@ -309,6 +314,8 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rbs (3.5.3)
logger
rdoc (6.7.0)
psych (>= 4.0.0)
regexp_parser (2.9.2)
Expand Down Expand Up @@ -386,7 +393,19 @@ GEM
state_machines (0.6.0)
stringio (3.1.1)
strscan (3.1.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
syntax_tree-haml (4.0.3)
haml (>= 5.2)
prettier_print (>= 1.2.1)
syntax_tree (>= 6.0.0)
syntax_tree-rbs (1.0.0)
prettier_print
rbs
syntax_tree (>= 2.0.1)
temple (0.10.3)
thor (1.3.1)
tilt (2.4.0)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
Expand All @@ -407,7 +426,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.1)
webrick (1.8.2)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
Expand All @@ -432,6 +451,7 @@ DEPENDENCIES
launchy
oj
pmb-client (= 0.1.0)!
prettier_print
pry
pry-byebug
puma
Expand All @@ -452,11 +472,14 @@ DEPENDENCIES
simplecov-lcov
sprint_client
state_machines
syntax_tree
syntax_tree-haml
syntax_tree-rbs
vite_rails
vite_ruby
web-console
webmock
yard

BUNDLED WITH
2.2.33
2.5.19
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ You must have Docker Desktop installed on your machine. Then the only command
you should need to run is:

```shell
docker-compose up
docker compose up
```

Variations on this command include:

- `docker-compose up -d` which starts the container as a background task
(freeing up the terminal). You can then use `docker-compose down` to turn it
- `docker compose up -d` which starts the container as a background task
(freeing up the terminal). You can then use `docker compose down` to turn it
off again.
- `GENERATE_CONFIG=false docker-compose up` which will avoid running the
- `GENERATE_CONFIG=false docker compose up` which will avoid running the
`config:generate` rake task as Limber is started.
- `PRECOMPILE_ASSETS=false docker-compose up` which will avoid precompiling the
- `PRECOMPILE_ASSETS=false docker compose up` which will avoid precompiling the
assets as Limber is started.
- `docker-compose up --build` which forces a rebuild of the Docker image if your
- `docker compose up --build` which forces a rebuild of the Docker image if your
changes to the Dockerfile or related scripts don't seem to be taking effect.

Limber should be accessible via [http://localhost:3001](http://localhost:3001).
Expand Down Expand Up @@ -158,7 +158,7 @@ Alternatively, run `./compile_build.sh` to compile the build files or run `yarn
If during development changes do not seem to be taking effect, try:

- Restart the application:
- Destroy and recreate the Docker container `docker-compose down && GENERATE_CONFIG=false docker-compose up -d`
- Destroy and recreate the Docker container `docker compose down && GENERATE_CONFIG=false docker compose up -d`
- Rebuild the Docker image, particularly useful for changing dependencies
- Clobber local resources `rails assets:clobber`

Expand All @@ -167,7 +167,7 @@ If during development changes do not seem to be taking effect, try:
The rest of the sections shown here were written for and apply to the native
installation, but can also be used in the Docker container if required. In order
to use Docker, it's probably best to create a shell in the running container.
Assuming you started the container via `docker-compose` you can access the shell
Assuming you started the container via `docker compose` you can access the shell
using:

```shell
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/health_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

# Controller to display a page stating that Limber is up, as a health check endpoint
class HealthController < ApplicationController
def show; end
def show
end
end
9 changes: 5 additions & 4 deletions app/controllers/labware_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def show # rubocop:todo Metrics/AbcSize
format.html { render @presenter.page }
format.csv do
render @presenter.csv
response.headers['Content-Disposition'] =
"attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename
response.headers[
'Content-Disposition'
] = "attachment; filename=#{@presenter.filename(params['offset'])}" if @presenter.filename
end
format.json
end
Expand All @@ -35,7 +36,7 @@ def update # rubocop:todo Metrics/AbcSize
notice = +"Labware: #{params[:labware_barcode]} has been changed to a state of #{params[:state].titleize}."
notice << ' The customer will still be charged.' if update_params[2]

respond_to { |format| format.html { redirect_to(search_path, notice: notice) } }
respond_to { |format| format.html { redirect_to(search_path, notice:) } }
rescue StateChangers::StateChangeError => e
respond_to do |format|
format.html { redirect_to(search_path, alert: e.message) }
Expand Down Expand Up @@ -89,7 +90,7 @@ def state_changer_for(purpose_uuid, labware_uuid)
end

def presenter_for(labware)
presenter = Presenters.lookup_for(labware).new(labware: labware)
presenter = Presenters.lookup_for(labware).new(labware:)

# TODO: {Y24-190} - Remove this line when the API v1 is removed from Presenters::ExtendedCsv
presenter.api = api if presenter.respond_to?(:api=)
Expand Down
Loading

0 comments on commit 2bccb4d

Please sign in to comment.