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
42 changes: 0 additions & 42 deletions .github/workflows/ruby-unit-test.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/testkit-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Docker Unit Tests

on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:

env:
# CI execution mode for backend tests:
# - container: run `test:docker:<backend>:container` (default)
# - native: run `test:docker:<backend>` on host Ruby
# OPTK_CI_RUN_MODE: ${{ vars.OPTK_CI_RUN_MODE || 'container' }}
# Example override to force native mode in this workflow file:
OPTK_CI_RUN_MODE: native

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
backends: ${{ steps.cfg.outputs.backends }}
steps:
- uses: actions/checkout@v4

- id: cfg
name: Read backend matrix from .ontoportal-testkit.yml
run: |
BACKENDS=$(ruby -ryaml -rjson -e 'c=YAML.safe_load_file(".ontoportal-testkit.yml") || {}; b=c["backends"] || %w[fs ag vo gd]; puts JSON.generate(b)')
echo "backends=$BACKENDS" >> "$GITHUB_OUTPUT"

test:
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
backend: ${{ fromJson(needs.prepare.outputs.backends) }}

steps:
- uses: actions/checkout@v4

- name: Install native system dependencies
if: env.OPTK_CI_RUN_MODE == 'native'
run: |
sudo apt-get update
sudo apt-get install -y raptor2-utils

- name: Set up Ruby from .ruby-version
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true

- name: Run unit tests
env:
CI: "true"
TESTOPTS: "-v"
BACKEND: ${{ matrix.backend }}
run: |
MODE="${OPTK_CI_RUN_MODE:-container}"
TASK="test:docker:${BACKEND}"
if [ "$MODE" = "container" ]; then
TASK="${TASK}:container"
elif [ "$MODE" != "native" ]; then
echo "Invalid OPTK_CI_RUN_MODE=$MODE (expected container or native)"
exit 1
fi

bundle exec rake "$TASK"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests,${{ matrix.backend }}
verbose: true
fail_ci_if_error: false
8 changes: 8 additions & 0 deletions .ontoportal-testkit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
component_name: goo
app_service: test-container
backends:
- fs
- ag
- vo
- gd
dependency_services: []
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.9
22 changes: 4 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
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/*
ARG TESTKIT_BASE_IMAGE=ontoportal/testkit-base:ruby${RUBY_VERSION}-${DISTRO}
FROM ${TESTKIT_BASE_IMAGE}

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 \
# Respect the project's Bundler lock when present.
RUN 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 . ./
Expand Down
5 changes: 1 addition & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ group :test do
gem "pry"
gem 'simplecov'
gem 'simplecov-cobertura' # for submitting code coverage results to codecov.io
gem 'ontoportal_testkit', github: 'alexskr/ontoportal_testkit', branch: 'main'
end

group :profiling do
Expand All @@ -24,7 +25,3 @@ end
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'ontoportal-lirmm-development'
gem "rdf-raptor", github: "ruby-rdf/rdf-raptor", ref: "6392ceabf71c3233b0f7f0172f662bd4a22cd534" # use version 3.3.0 when available
gem 'net-ftp'

# # to remove if no more supporting ruby 2.7
# gem 'faraday', '2.7.11' #unpin if we no more support ruby 2.7
# gem 'public_suffix', '~> 5.1.1'
18 changes: 13 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
GIT
remote: https://github.com/alexskr/ontoportal_testkit.git
revision: c154c17f2e8b1a7931b710febfcadb15e566f672
branch: main
specs:
ontoportal_testkit (0.1.0)
rake (>= 13.0)

GIT
remote: https://github.com/ncbo/sparql-client.git
revision: 2ac20b217bb7ad2b11305befe0ee77d75e44eac5
Expand Down Expand Up @@ -105,7 +113,7 @@ GEM
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rake (13.2.1)
rake (13.3.1)
rdf (3.3.2)
bcp47_spec (~> 0.2)
bigdecimal (~> 3.1, >= 3.1.5)
Expand Down Expand Up @@ -161,20 +169,20 @@ GEM
date
timeout (0.4.3)
tzinfo (0.3.62)
uri (1.0.2)
uri (1.1.1)
uuid (2.3.9)
macaddr (~> 1.0)

PLATFORMS
arm64-darwin-23
arm64-darwin-24
x86_64-linux
arm64-darwin
x86_64-linux-gnu

DEPENDENCIES
activesupport
goo!
minitest (< 5.0)
net-ftp
ontoportal_testkit!
pry
rack-accept
rack-post-body-to-params
Expand Down
2 changes: 2 additions & 0 deletions config/config.test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Goo.config do |config|
end
125 changes: 0 additions & 125 deletions docker-compose.yml

This file was deleted.

Loading