Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Nov 2, 2023
1 parent 27a8192 commit 5e25a2f
Show file tree
Hide file tree
Showing 13 changed files with 518 additions and 57 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "Ruby on Rails CI"

on:
push:
pull_request_target:
types: [ opened, reopened ]

jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: bioportal_ui_test
MYSQL_USER: root
MYSQL_PASSWORD: bp_user
steps:
- name: Checkout code
uses: actions/checkout@v3
# Add or replace dependency steps here
- name: Install Ruby and gems
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
ruby-version: 2.7.8
bundler-cache: true
# Add or replace database setup steps here
- name: set up config file
run: cp config/database.yml.sample config/database.yml
- name: Set up database schema
run: RAILS_ENV=test bin/rails db:schema:load
# Add or replace test runners here
- name: Run tests
run: RAILS_ENV=test bin/rake

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ruby and gems
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
ruby-version: 2.7.8
bundler-cache: true
# Add or replace any other lints here
- name: Security audit dependencies
run: bin/bundler-audit --update
- name: Security audit application code
run: bin/brakeman -q -w2
- name: Lint Ruby files
run: bin/rubocop --parallel
34 changes: 13 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.7.5-alpine AS app
FROM ruby:2.7.8-alpine AS app

WORKDIR /app

Expand All @@ -17,34 +17,26 @@ RUN apk add --no-cache \
less \
&& addgroup --gid ${GID} ruby \
&& adduser -u ${UID} -G ruby -D ruby \
&& chown ruby:ruby -R /app \
&& mkdir /node_modules \
&& chown ruby:ruby -R /node_modules /app
&& mkdir /node_modules

USER ruby

COPY --chown=ruby:ruby bin/ ./bin
RUN chmod 0755 bin/*
COPY --chown=ruby:ruby Gemfile* ./
COPY --chown=ruby:ruby package.json *yarn* ./

ARG RAILS_ENV="production"
# Set ownership and permissions
RUN chown -R ruby:ruby /app

ENV RAILS_ENV="${RAILS_ENV}" \
NODE_ENV="${NODE_ENV}" \
PATH="${PATH}:/home/ruby/.local/bin:/node_modules/.bin" \
USER="ruby" \
BUNDLE_PATH=/usr/local/bundle
USER ruby

COPY --chown=ruby:ruby Gemfile* ./
# Install dependencies
RUN bundle install --jobs "$(nproc)"
RUN gem install rails


RUN gem install rails
RUN yarn install

RUN echo "--modules-folder /node_modules" > .yarnrc
COPY --chown=ruby:ruby package.json *yarn* ./
RUN yarn install

# Copy application code
COPY --chown=ruby:ruby . .

EXPOSE 3000

CMD ["sh"]
CMD ["bash"]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ gem 'i18n'
gem 'rails-i18n', '~> 7.0.0'
gem 'iconv'
gem 'multi_json'
gem 'mysql2', '0.5.3'
gem 'mysql2'
gem 'oj'
gem 'open_uri_redirections'
gem 'pry'
Expand Down
47 changes: 24 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ GEM
smart_properties
bindata (2.4.15)
bindex (0.8.1)
bootsnap (1.16.0)
bootsnap (1.17.0)
msgpack (~> 1.2)
bootstrap (4.2.1)
autoprefixer-rails (>= 9.1.0)
Expand Down Expand Up @@ -156,7 +156,7 @@ GEM
erubi (1.12.0)
erubis (2.7.0)
eventmachine (1.2.7)
excon (0.103.0)
excon (0.104.0)
execjs (2.9.1)
faraday (2.0.1)
faraday-net_http (~> 2.0)
Expand All @@ -169,13 +169,13 @@ GEM
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (2.1.0)
ffi (1.16.1)
ffi (1.16.3)
flag-icons-rails (3.4.6.1)
sass-rails
flamegraph (0.9.5)
globalid (1.2.1)
activesupport (>= 6.1)
graphql (2.1.3)
graphql (2.1.6)
racc (~> 1.4)
graphql-client (0.18.0)
activesupport (>= 3.0)
Expand All @@ -197,20 +197,21 @@ GEM
domain_name (~> 0.5)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
i18n-tasks (1.0.12)
i18n-tasks (1.0.13)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
better_html (>= 1.0, < 3.0)
erubi
highline (>= 2.0.0)
i18n
parser (>= 2.2.3.0)
parser (>= 3.2.2.1)
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
iconv (1.0.8)
importmap-rails (1.2.1)
importmap-rails (1.2.3)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
inline_svg (1.9.0)
activesupport (>= 3.0)
Expand Down Expand Up @@ -274,13 +275,13 @@ GEM
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.3.0)
mysql2 (0.5.3)
mysql2 (0.5.5)
net-ftp (0.2.0)
net-protocol
time
net-http (0.3.2)
uri
net-imap (0.4.1)
net-imap (0.4.3)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -293,7 +294,8 @@ GEM
net-protocol
net-ssh (7.2.0)
netrc (0.11.0)
newrelic_rpm (9.5.0)
newrelic_rpm (9.6.0)
base64
nio4r (2.5.9)
nokogiri (1.15.4-x86_64-darwin)
racc (~> 1.4)
Expand Down Expand Up @@ -345,7 +347,7 @@ GEM
public_suffix (5.0.3)
puma (5.6.7)
nio4r (~> 2.0)
racc (1.7.1)
racc (1.7.2)
rack (2.2.8)
rack-accept (0.4.5)
rack (>= 0.4)
Expand Down Expand Up @@ -391,24 +393,24 @@ GEM
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdoc (6.3.3)
recaptcha (5.9.0)
json
redcarpet (3.6.0)
regexp_parser (2.8.1)
reline (0.3.8)
regexp_parser (2.8.2)
reline (0.3.9)
io-console (~> 0.5)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.6)
rouge (4.1.3)
rouge (4.2.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
Expand All @@ -426,8 +428,7 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rubocop (1.56.3)
base64 (~> 0.1.1)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -438,7 +439,7 @@ GEM
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
Expand Down Expand Up @@ -480,16 +481,16 @@ GEM
stackprof (0.2.25)
stimulus-rails (1.3.0)
railties (>= 6.0.0)
temple (0.10.2)
temple (0.10.3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
terser (1.1.18)
terser (1.1.19)
execjs (>= 0.3.0, < 3)
thin (1.8.2)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (1.2.2)
thor (1.3.0)
tilt (2.3.0)
time (0.2.2)
date
Expand Down Expand Up @@ -532,7 +533,7 @@ GEM
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.34)
zeitwerk (2.6.11)
zeitwerk (2.6.12)

PLATFORMS
x86_64-darwin-21
Expand Down Expand Up @@ -574,7 +575,7 @@ DEPENDENCIES
listen
lookbook (~> 1.5.5)
multi_json
mysql2 (= 0.5.3)
mysql2
net-ftp (~> 0.2.0)
net-http
newrelic_rpm
Expand Down
5 changes: 1 addition & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ def domain_ontology_set
Thread.current[:slice] = @subdomain_filter
end

def anonymous_user
user = DataAccess.getUser($ANONYMOUS_USER)
user ||= User.new({"id" => 0})
end


def ontology_not_found(ontology_acronym)
not_found("Ontology #{ontology_acronym} not found")
Expand Down
1 change: 1 addition & 0 deletions app/controllers/landscape_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def index
# Get hash of natural language use
if !sub.naturalLanguage.nil? && !sub.naturalLanguage.empty?
sub.naturalLanguage.each do |sub_lang|
next unless sub_lang.is_a?(String)
# replace lexvo URI by lexvo prefix
prefixed_sub_lang = sub_lang
if sub_lang.start_with?("http://lexvo.org/id/iso639-3/")
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%h1.tab_header= t("projects.self")
%p.tab_description
= t("projects.index.intro", site: "#{$SITE}")
= link_to(help_path(anchor: "Projects_Tab"), id: "projects-help", aria: {label: t("projects.view_projects_help")}) do
= link_to("#{Rails.configuration.settings.links[:help]}#Projects_Tab", id: "projects-help", aria: {label: t("projects.view_projects_help")}) do
%i.fas.fa-question-circle.fa-lg{aria: {hidden: "true"}, style: "margin-left: .25em"}

%div{:style => "padding:10px;"}
Expand Down
Loading

0 comments on commit 5e25a2f

Please sign in to comment.