Skip to content

Commit

Permalink
Merge branch 'upstream' into pl/refacotor-ontology-submission
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Jan 24, 2023
2 parents 85a25e4 + 168eccf commit 747b902
Show file tree
Hide file tree
Showing 29 changed files with 956 additions and 427 deletions.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Git
.git
.gitignore
# Logs
log/*
# Temp files
tmp/*
# Editor temp files
*.swp
*.swo
test/solr
24 changes: 18 additions & 6 deletions .github/workflows/ruby-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@ on:

jobs:
test:
strategy:
matrix:
backend: ['ruby', 'ruby-agraph'] # ruby runs tests with 4store backend and ruby-agraph runs with AllegroGraph backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up solr configsets
run: test/solr/generate_ncbo_configsets.sh
run: ./test/solr/generate_ncbo_configsets.sh
- name: create config.rb file
run: cp config/config.rb.sample config/config.rb
run: cp config/config.test.rb config/config.rb
- name: Build docker-compose
run: docker-compose build
run: docker-compose --profile 4store build #profile flag is set in order to build all containers in this step
- name: Run unit tests
run: docker-compose up --exit-code-from unit-test

# unit tests are run inside a container
# http://docs.codecov.io/docs/testing-with-docker
run: |
ci_env=`bash <(curl -s https://codecov.io/env)`
docker-compose run $ci_env -e CI --rm ${{ matrix.backend }} wait-for-it solr-ut:8983 -- bundle exec rake test TESTOPTS='-v'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
flags: unittests
verbose: true
fail_ci_if_error: false # optional (default = false)
28 changes: 17 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
FROM ruby:2.6
ARG RUBY_VERSION
ARG DISTRO_NAME=bullseye

FROM ruby:$RUBY_VERSION-$DISTRO_NAME

RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
openjdk-11-jre-headless \
raptor2-utils \
wait-for-it \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends vim openjdk-11-jre-headless raptor2-utils
# The Gemfile Caching Trick
RUN mkdir -p /srv/ontoportal/ontologies_linked_data
RUN mkdir -p /srv/ontoportal/bundle
COPY Gemfile* /srv/ontoportal/ontologies_linked_data/

WORKDIR /srv/ontoportal/ontologies_linked_data
RUN gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)"
RUN bundle install --binstubs

COPY . /srv/ontoportal/ontologies_linked_data
RUN gem update --system
RUN gem install bundler
ENV BUNDLE_PATH=/srv/ontoportal/bundle
RUN bundle install

# unit tests have to run with unprivileged user
# otherwise TestOWLApi#test_command_KO_output test fails
RUN adduser --disabled-password ontoportal
RUN chown -R ontoportal /srv/ontoportal/ontologies_linked_data
USER ontoportal
COPY . /srv/ontoportal/ontologies_linked_data
6 changes: 2 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

gem 'activesupport', '~> 4'
gem 'addressable', '= 2.3.5'
gem 'addressable', '~> 2.8'
gem 'bcrypt', '~> 3.0'
gem 'cube-ruby', require: 'cube'
gem 'faraday', '~> 1.9'
Expand All @@ -26,6 +26,7 @@ group :test do
gem 'minitest-reporters', '>= 0.5.0'
gem 'pry'
gem 'simplecov'
gem 'simplecov-cobertura' # for codecov.io
gem 'test-unit-minitest'
end

Expand All @@ -36,6 +37,3 @@ end
# NCBO gems (can be from a local dev path or from rubygems/git)
gem 'goo', github: 'ncbo/goo', branch: 'master'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'master'

# ResourceIndex dependencies (managed per-platform)
gem 'ncbo_resource_index', github: 'ncbo/resource_index'
108 changes: 45 additions & 63 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: d26b364dc5e8a22753cf9f8495a77c398112683f
revision: 077c674a6e277a51dca4ca681e49e3e3a55b918a
branch: master
specs:
goo (0.0.2)
addressable (= 2.3.5)
addressable (~> 2.8)
pry
rdf (= 1.0.8)
redis
rest-client
rsolr
sparql-client
systemu
uuid

GIT
remote: https://github.com/ncbo/resource_index.git
revision: 24a7f14a6da4f4a0eaba1016ca5a378dfccd7441
specs:
ncbo_resource_index (0.0.1)
elasticsearch (= 2.0.0)
mysql2 (= 0.5.2)
pony
ref
ruby-xxHash
sequel
typhoeus

GIT
remote: https://github.com/ncbo/sparql-client.git
revision: fb4a89b420f8eb6dda5190a126b6c62e32c4c0c9
Expand All @@ -46,34 +32,26 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.3.5)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ansi (1.5.0)
ast (2.4.2)
bcrypt (3.1.16)
bcrypt (3.1.18)
builder (3.2.4)
coderay (1.1.3)
concurrent-ruby (1.1.9)
concurrent-ruby (1.1.10)
connection_pool (2.3.0)
cube-ruby (0.0.3)
daemons (1.4.1)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
elasticsearch (2.0.0)
elasticsearch-api (= 2.0.0)
elasticsearch-transport (= 2.0.0)
elasticsearch-api (2.0.0)
multi_json
elasticsearch-transport (2.0.0)
faraday
multi_json
email_spec (2.2.0)
email_spec (2.2.1)
htmlentities (~> 4.3.3)
launchy (~> 2.1)
mail (~> 2.7)
ethon (0.15.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
faraday (1.9.3)
faraday (1.10.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
Expand All @@ -89,8 +67,8 @@ GEM
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
Expand All @@ -100,15 +78,16 @@ GEM
hashie (5.0.0)
htmlentities (4.3.4)
http-accept (1.7.0)
http-cookie (1.0.4)
http-cookie (1.0.5)
domain_name (~> 0.5)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
json_pure (2.6.1)
launchy (2.4.3)
addressable (~> 2.3)
json (2.6.2)
json_pure (2.6.2)
launchy (2.5.0)
addressable (~> 2.7)
libxml-ruby (2.9.0)
logger (1.5.0)
logger (1.5.1)
macaddr (1.7.2)
systemu (~> 2.6.5)
mail (2.7.1)
Expand All @@ -125,15 +104,14 @@ GEM
minitest (>= 2.12, < 5.0)
powerbar
multi_json (1.15.0)
multipart-post (2.1.1)
mysql2 (0.5.2)
multipart-post (2.2.3)
net-http-persistent (2.9.4)
netrc (0.11.0)
oj (2.18.5)
omni_logger (0.1.4)
logger
parallel (1.21.0)
parser (3.1.0.0)
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
pony (1.13.1)
mail (>= 2.0)
Expand All @@ -142,16 +120,19 @@ GEM
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.0)
rack (1.6.13)
rack-test (0.8.3)
rack (>= 1.0, < 3)
rainbow (3.1.1)
rake (10.5.0)
rdf (1.0.8)
addressable (>= 2.2)
redis (4.6.0)
ref (2.0.0)
regexp_parser (2.2.0)
redis (5.0.5)
redis-client (>= 0.9.0)
redis-client (0.11.1)
connection_pool
regexp_parser (2.6.1)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
Expand All @@ -160,28 +141,30 @@ GEM
rexml (3.2.5)
rsolr (1.1.2)
builder (>= 2.1.2)
rubocop (1.25.0)
rubocop (1.39.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.15.1, < 2.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.23.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.15.1)
parser (>= 3.0.1.1)
rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
ruby-xxHash (0.4.0.2)
ruby2_keywords (0.0.5)
rubyzip (1.3.0)
sequel (5.53.0)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3)
simplecov_json_formatter (0.1.4)
systemu (2.6.5)
test-unit-minitest (0.9.1)
minitest (~> 4.7)
Expand All @@ -190,22 +173,21 @@ GEM
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (0.3.60)
tzinfo (0.3.61)
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
unicode-display_width (2.1.0)
unf_ext (0.0.8.2)
unicode-display_width (2.3.0)
uuid (2.3.9)
macaddr (~> 1.0)

PLATFORMS
ruby
x86_64-darwin-21
x86_64-linux

DEPENDENCIES
activesupport (~> 4)
addressable (= 2.3.5)
addressable (~> 2.8)
bcrypt (~> 3.0)
cube-ruby
email_spec
Expand All @@ -216,7 +198,6 @@ DEPENDENCIES
minitest
minitest-reporters (>= 0.5.0)
multi_json (~> 1.0)
ncbo_resource_index!
oj (~> 2.0)
omni_logger
pony
Expand All @@ -229,9 +210,10 @@ DEPENDENCIES
rubocop
rubyzip (~> 1.0)
simplecov
simplecov-cobertura
sparql-client!
test-unit-minitest
thin

BUNDLED WITH
2.1.4
2.3.22
Binary file not shown.
2 changes: 1 addition & 1 deletion config/config.rb.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LinkedData.config do |config|
config.repository_folder = "./test/data/ontology_files/repo"
config.rest_url_prefix = "http://data.bioontology.org/"
config.enable_security = false

config.java_max_heap_size = '10240M'
#PURL server config parameters
config.enable_purl = false
config.purl_host = "purl.bioontology.org"
Expand Down
35 changes: 35 additions & 0 deletions config/config.test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
###
# This file is designed for use in docker based unit testing
#
# All the defaults are set in
# https://github.com/ncbo/ontologies_linked_data/blob/master/lib/ontologies_linked_data/config/config.rb
###

GOO_BACKEND_NAME = ENV.include?("GOO_BACKEND_NAME") ? ENV["GOO_BACKEND_NAME"] : "4store"
GOO_PATH_QUERY = ENV.include?("GOO_PATH_QUERY") ? ENV["GOO_PATH_QUERY"] : "/sparql/"
GOO_PATH_DATA = ENV.include?("GOO_PATH_DATA") ? ENV["GOO_PATH_DATA"] : "/data/"
GOO_PATH_UPDATE = ENV.include?("GOO_PATH_UPDATE") ? ENV["GOO_PATH_UPDATE"] : "/update/"
GOO_PORT = ENV.include?("GOO_PORT") ? ENV["GOO_PORT"] : 9000
GOO_HOST = ENV.include?("GOO_HOST") ? ENV["GOO_HOST"] : "localhost"
REDIS_HOST = ENV.include?("REDIS_HOST") ? ENV["REDIS_HOST"] : "localhost"
REDIS_PORT = ENV.include?("REDIS_PORT") ? ENV["REDIS_PORT"] : 6379
SOLR_TERM_SEARCH_URL = ENV.include?("SOLR_TERM_SEARCH_URL") ? ENV["SOLR_TERM_SEARCH_URL"] : "http://localhost:8983/solr/term_search_core1"
SOLR_PROP_SEARCH_URL = ENV.include?("SOLR_PROP_SEARCH_URL") ? ENV["SOLR_PROP_SEARCH_URL"] : "http://localhost:8983/solr/prop_search_core1"

LinkedData.config do |config|
config.goo_backend_name = GOO_BACKEND_NAME.to_s
config.goo_host = GOO_HOST.to_s
config.goo_port = GOO_PORT.to_i
config.goo_path_query = GOO_PATH_QUERY.to_s
config.goo_path_data = GOO_PATH_DATA.to_s
config.goo_path_update = GOO_PATH_UPDATE.to_s
config.goo_redis_host = REDIS_HOST.to_s
config.goo_redis_port = REDIS_PORT.to_i
config.http_redis_host = REDIS_HOST.to_s
config.http_redis_port = REDIS_PORT.to_i
config.ontology_analytics_redis_host = REDIS_HOST.to_s
config.ontology_analytics_redis_port = REDIS_PORT.to_i
config.search_server_url = SOLR_TERM_SEARCH_URL.to_s
config.property_search_server_url = SOLR_PROP_SEARCH_URL.to_s
# config.enable_notifications = false
end
Loading

0 comments on commit 747b902

Please sign in to comment.