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
18 changes: 12 additions & 6 deletions .github/workflows/ruby-unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Ruby Unit Test

on: [push, pull_request]
on:
push:
branches:
- '**'
tags-ignore:
- '**' # ignore all tag pushes
pull_request:

permissions:
contents: read
Expand All @@ -13,11 +19,11 @@ jobs:
fail-fast: false
matrix:
goo-slice: [ '100']
ruby-version: [ '3.2.0' ]
triplestore: [ 'fs', 'ag', 'vo', 'gb' ]
ruby-version: [ '3.2' ]
triplestore: [ 'fs', 'ag', 'vo', 'gd' ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get -y install raptor2-utils
- name: Set up Ruby
Expand All @@ -29,8 +35,8 @@ jobs:
# tempoaray workaround for the config.rb file requirement
run: echo 'Goo.config do |config| end' > config/config.rb
- name: List directory contents
run: ls -R ./test/data
run: ls -R ./test/fixtures
- name: Run tests
run: GOO_SLICES=${{ matrix.goo-slice }} bundle exec rake test:docker:${{ matrix.triplestore }} TESTOPTS="-v"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG RUBY_VERSION=3.2
ARG DISTRO=bullseye

FROM ruby:$RUBY_VERSION-$DISTRO

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
libxml2 \
libxslt-dev \
libxslt1-dev zlib1g-dev \
# openjdk-11-jre-headless \
raptor2-utils \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY Gemfile* *.gemspec ./

#Install the exact Bundler version from Gemfile.lock (if it exists)
RUN gem update --system && \
if [ -f Gemfile.lock ]; then \
BUNDLER_VERSION=$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1 | tr -d ' '); \
gem install bundler -v "$BUNDLER_VERSION"; \
else \
gem install bundler; \
fi

RUN bundle config set --global no-document 'true'
RUN bundle install --jobs 4 --retry 3

COPY . ./

CMD ["bundle", "exec", "rake"]
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,42 @@ To see Goo in action browse to the following links:
- [BioPortal New API Documentation](http://stagedata.bioontology.org/documentation)
- [BioPortal New API Access](http://stagedata.bioontology.org/)

## Tests

Run the unit tests:

```
bundle exec rake test
```

Run docker-backed tests (host Ruby):

```
bundle exec rake test:docker:fs
bundle exec rake test:docker:ag
bundle exec rake test:docker:vo
bundle exec rake test:docker:gd
```

Run docker-backed tests inside the Linux container:

```
bundle exec rake test:docker:fs:linux
bundle exec rake test:docker:ag:linux
bundle exec rake test:docker:vo:linux
bundle exec rake test:docker:gd:linux
```

Start a shell in the Linux test container (default backend `fs`):

```
bundle exec rake test:docker:shell
bundle exec rake test:docker:shell[ag]
```

Set `OP_KEEP_CONTAINERS=1` to keep services up after tests or shell exit.
Set `OP_TEST_DOCKER_BACKEND=ag` (or `fs`, `vo`, `gd`) to change the default backend for `test:docker:shell`, `test:docker:up`, and `test:docker:down`.


## Schema Definitions (DSL)

Expand Down
8 changes: 4 additions & 4 deletions config/config.rb.sample
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
Goo.config do |config|
# 4store
config.goo_backend_name = '4store'
config.goo_port = 8080
config.goo_port = 9000
config.goo_host = 'localhost'
config.goo_path_query = '/sparql/'
config.goo_path_data = '/data/'
config.goo_path_update = '/update/'

# AllegroGraph
# config.goo_backend_name = 'AG'
# config.goo_backend_name = 'allegrograph'
# config.goo_port = 10035
# config.goo_host = 'localhost'
# config.goo_path_query = "/repositories/ontoportal"
# config.goo_path_data = "/repositories/ontoportal/statements/"
# config.goo_path_update = "/repositories/ontoportal/statements/"

config.search_server_url = 'http://localhost:8983/solr/'
config.redis_host = 'localhost'
config.redis_port = 6379
config.goo_redis_host = 'localhost'
config.goo_redis_port = 6379
config.bioportal_namespace = 'http://data.bioontology.org/'
config.queries_debug = false
end
16 changes: 16 additions & 0 deletions dev/compose/linux/ag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
test-linux:
environment:
GOO_BACKEND_NAME: allegrograph
GOO_PORT: 10035
GOO_HOST: agraph-ut
GOO_PATH_QUERY: /repositories/ontoportal_test
GOO_PATH_DATA: /repositories/ontoportal_test/statements
GOO_PATH_UPDATE: /repositories/ontoportal_test/statements
depends_on:
solr-ut:
condition: service_healthy
redis-ut:
condition: service_healthy
agraph-ut:
condition: service_healthy
13 changes: 13 additions & 0 deletions dev/compose/linux/fs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
test-linux:
environment:
GOO_BACKEND_NAME: '4store'
GOO_HOST: 4store-ut
GOO_PORT: 9000
depends_on:
solr-ut:
condition: service_healthy
redis-ut:
condition: service_healthy
4store-ut:
condition: service_healthy
19 changes: 19 additions & 0 deletions dev/compose/linux/gd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
test-linux:
environment:
GOO_BACKEND_NAME: graphdb
GOO_PORT: 7200
GOO_HOST: graphdb-ut
GOO_PATH_QUERY: /repositories/ontoportal_test
GOO_PATH_DATA: /repositories/ontoportal_test/statements
GOO_PATH_UPDATE: /repositories/ontoportal_test/statements
depends_on:
solr-ut:
condition: service_healthy
redis-ut:
condition: service_healthy
graphdb-ut:
condition: service_healthy

graphdb-ut:
ports:
13 changes: 13 additions & 0 deletions dev/compose/linux/no-ports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
redis-ut:
ports: []
solr-ut:
ports: []
agraph-ut:
ports: []
4store-ut:
ports: []
virtuoso-ut:
ports: []
graphdb-ut:
ports: []
16 changes: 16 additions & 0 deletions dev/compose/linux/vo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
test-linux:
environment:
GOO_BACKEND_NAME: 'virtuoso'
GOO_HOST: virtuoso-ut
GOO_PORT: 8890
GOO_PATH_QUERY: /sparql
GOO_PATH_DATA: /sparql
GOO_PATH_UPDATE: /sparql
depends_on:
solr-ut:
condition: service_healthy
redis-ut:
condition: service_healthy
virtuoso-ut:
condition: service_healthy
Loading