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 9185751
Show file tree
Hide file tree
Showing 12 changed files with 500 additions and 53 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: unit-tests

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


env:
API_URL: ${{ secrets.API_URL }}
API_KEY: ${{ secrets.API_KEY }}
BIOMIXER_URL: ${{ secrets.BIOMIXER_URL }}
FAIRNESS_URL: ${{ secrets.FAIRNESS_URL }}
ANNOTATOR_URL: ${{ secrets.ANNOTATOR_URL }}
DB_HOST: ${{ secrets.DB_HOST || '127.0.0.1' }}

jobs:
test:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: set up config file
run: cp .env.sample .env && cp config/database.yml.sample config/database.yml
- name: build docker
run: docker compose --profile cache-db up -d
- name: run test docker
run: bin/rails test -v
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"]
43 changes: 22 additions & 21 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.5)
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 @@ -280,7 +281,7 @@ GEM
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
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 9185751

Please sign in to comment.